DSPRelated.com
Forums

EDMA looses samples

Started by muelleradalbert November 10, 2003
Hi there,

I'm new in programming DSP's. I'm using the C6711DSK.

At the moment i'm trying to set up a edma transfer to capture sound
samples from codec/mcbsp.
Therefore I used the link feature of the edma controller.

I'm using the channel for McBSP0 (#13), configure it to my demands and
enable linking. For the linking, i have two additional parameter sets,
which are linked to each other.

On the first glance it seems to work. But on a closer look, i see some
missing samples form McBSP. At the moment i can't say if they're
dropped by edma or by McBSP.

Anybody a idea or some hints? I read in the documentation it's
possible to get the edma stalled, if the priority queue for a level is
full. But I don't think this is the reason, because the debugger shows
in PQSR no full queue. Are there any other known reasons?

Thanks,

Adalbert
Here's the code i use to init mcbsp and edma:

void configMCBSP()
{
hMcbsp0 = MCBSP_open(MCBSP_DEV0, 0);

if(hMcbsp0 != INV)
{
MCBSP_configArgs( hMcbsp0,
// 0x01000000, //SPCR
0x01002000, //SPCR - right justify and sign extend
0x00050040, //RCR
// 0x00010040, //RCR - unexpected sync, restart transfer
0x00050040, //XCR
// 0x00010040, //XCR - unexpected sync, restart transfer
0x20000001, //SRGR
0x00000000, //MCR
0x00000000, //RCER
0x00000000, //XCER
0x00000000 //PCR
);

// ???Wait till all registers are set, especially interrupt registers???
//removing reset bits from SPCR
MCBSP_enableRcv(hMcbsp0);
MCBSP_enableXmt(hMcbsp0);
}
}

void configEDMA()
{
EDMA_Config Configuration; // initial parameter set, link to reload1

EDMA_Handle hrecevt0;
EDMA_Handle hreload0; // Link to reload parameter 0
EDMA_Handle hreload1; // Link to reload parameter 1

EDMA_Handle hinbuff02work;
EDMA_Handle hinbuff12work;

// setting up channel 13 for McBSP0 receive event
hrecevt0 = EDMA_open(EDMA_CHA_REVT0, EDMA_OPEN_RESET); // using channel 10/11 for transfers from inbuffer 0/1 to workingbuffer
hinbuff02work = EDMA_open(EDMA_CHA_TCC10, EDMA_OPEN_RESET);
hinbuff12work = EDMA_open(EDMA_CHA_TCC11, EDMA_OPEN_RESET); //allocate place for the parameter table
hreload0 = EDMA_allocTable(-1);
hreload1 = EDMA_allocTable(-1); //checking for valid handles
if( hinbuff02work != EDMA_HINV &&
hinbuff12work != EDMA_HINV &&
hrecevt0 != EDMA_HINV &&
hreload0 != EDMA_HINV &&
hreload1 != EDMA_HINV)
{

//fill structure for parameter table
Configuration.opt = 0x28380003; // TransferCompleteCode TCC = 8,
allow TCCInterrupt
Configuration.src = 0x30000000; // memorymapped data receive
register of MCBSP0
Configuration.dst = (Uint32)inbuffer0;
Configuration.cnt = (((Uint16)BUFFERSIZE - 1) << 16) | 0x0001;
Configuration.idx = 0x00000001; // set elemtent index to 1
Configuration.rld = (0x0000<<16) | (hreload1 & 0xFFFF); //link to
reloadparameter

//write structures to tables
EDMA_config(hrecevt0, &Configuration);
EDMA_config(hreload0, &Configuration);

Configuration.dst = (Uint32)inbuffer1;
Configuration.rld = (0x0000<<16) | (hreload0 & 0xFFFF);
Configuration.opt = 0x28390003; // TransferCompleteCode TCC = 9,
allow TCCInterrupt EDMA_config(hreload1, &Configuration);
//setup channel to move data from inbuffer0 to workingbuffer
Configuration.opt = 0x293A0001; //TCC = A, no reload, always use
the same values. Sync by event
Configuration.src = (Uint32)inbuffer0;
Configuration.dst = (Uint32)workingbuffer;
Configuration.cnt = ((Uint16)(0x0000) << 16) | BUFFERSIZE; //copy
the whole chunk at once
Configuration.idx = 0x00000001; // - set element index to 1
Configuration.rld = ((BUFFERSIZE - 1) << 16) | 0x0000;
EDMA_config(hinbuff02work, &Configuration);

//setup channel to move data from inbuffer1 to workingbuffer
Configuration.src = (Uint32)inbuffer1;
Configuration.opt = 0x293B0001; //TCC = B, no reload
EDMA_config(hinbuff12work, &Configuration); ////////////////////////////////////
//make able to generate interrupts//
////////////////////////////////////

//clear pending channel interrupts
EDMA_CIPR = 0xFFFF;

//enable INT for channel 13(TCC 8/9), channel 10(TCC 10) und channel
11(TCC11)
EDMA_CIER |= 0x00000F00;

//enable event from MCBSP0 for channel 13
EDMA_EER |= 0x00002000;
}
else
{
//reset CPU?
while(TRUE);
}
}