I'm using the evaluation module TMS320C6657 and I'm trying to receive external data from a custom board. I alredy configured the McBSP port correctly (I believe) and now I need to receive the data continuously, so I started configuring the EDMA in Ping-Pong mode.
I need to receive 32 samples with 1 Byte size each. At first, I created a receive buffer (RXBuff) with 64 bytes size (32 for ping, 32 for pong). My EDMA configurations are (FIFO is enabled):
syncType = EDMA3_DRV_SYNC_A;
paramSetRX.srcAddr = (unsigned int)readaddress;
paramSetRX.destAddr = (unsigned int)RXBuff;
paramSetRX.srcBIdx = 0;
paramSetRX.destBIdx = 1;
paramSetRX.srcCIdx = 0;
paramSetRX.destCIdx = 0;
paramSetRX.aCnt = 1;
paramSetRX.bCnt = 32;
paramSetRX.cCnt = 1;
paramSetRX.bCntReload = 32;
paramSetRX.opt &= 0xFFFFF8FFu;
paramSetRX.opt |= 0x80000000;
paramSetRX.opt &= 0xFFFFFFFCu;
paramSetRX.opt |= ((tcc1 << CSL_TPCC_PARAM_OPT_TCC_SHIFT) & CSL_TPCC_PARAM_OPT_TCC_MASK);
paramSetRX.opt |= (1 << CSL_TPCC_PARAM_OPT_TCINTEN_SHIFT);
paramSetRX.opt &= 0xFFFFFFFBu; //sync A
I used syncType = SYNC_A, TCC = 36 (McBSP0 RX event), and enabled only the TCINTEN interruption.
After that, I set the parameters to 3 channels. The master one, link channel 1 and link channel 2.
EDMA3_DRV_setPaRAM (hEdma, ch1, ¶mSetRX);
EDMA3_DRV_setPaRAM(hEdma, ch1l1, ¶mSetRX);
paramSetRX.destAddr = (unsigned int) (RXBuff + FRAME_SIZE);
EDMA3_DRV_setPaRAM(hEdma, ch1l2, ¶mSetRX);
As you can see, for link channel 2, I changed the destination address to RXBuff + FRAME_SIZE (position 32, Pong buffer). After that, I linked all channels.
EDMA3_DRV_linkChannel (hEdma, ch1, ch1l2);
EDMA3_DRV_linkChannel (hEdma, ch1l2, ch1l1);
EDMA3_DRV_linkChannel (hEdma, ch1l1, ch1l2);
After that, I enabled the transfer for the RX port. The data I expect to receive is:
8 bytes of 0xD5
8 bytes of 0x00;
8 bytes of 0xD5;
8 bytes of 0x00;
The problem is, after enabling the transfer, I get this:
I'm getting the same data both in Ping and Pong buffers. Why? I've set the bcnt and BCntReload to 32 bytes, why am I receiving 64 bytes of data?
And, the second problem is, from the second transfer onwards, everything "fall apart" and I start to receive my data on random positions inside the RXBuff.
What am I missing? Am I configuration something wrong in the DMA? Do I need to change something at the callback function to work with Ping-Pong buffers?
Thanks In advance for any help.
Regards,
Leonardo Batista