This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS3173 CAN using DMA RX

Now, I was using DMA receive msg from can bus. The length of the msg from the other end of can bus was changable, maybe 500B or 200B or 4B. I don't know how to setup the DMA reg when the block is not fixed. I don't want to using 1B per block, because it's not a good idear. my code as following:

    g_dmaCtrPkt.SADD = (UINT32)(&pCanReg->IF3ARB);
    g_dmaCtrPkt.DADD = pBuff;
    g_dmaCtrPkt.FRCNT = length;
    g_dmaCtrPkt.ELCNT = 4U;
    g_dmaCtrPkt.CHCTRL    = 0U;                 /* channel control            */
    g_dmaCtrPkt.ELDOFFSET = 4U;
    g_dmaCtrPkt.ELSOFFSET = 4U;

    g_dmaCtrPkt.FRDOFFSET = 16U;                 /* frame destination offset   */
    g_dmaCtrPkt.FRSOFFSET = 0U;                 /* frame source offset   */
    g_dmaCtrPkt.PORTASGN = 4U;/*PortB*/
    g_dmaCtrPkt.RDSIZE = ACCESS_32_BIT;/*8bit read*/
    g_dmaCtrPkt.WRSIZE = ACCESS_32_BIT;/*8bit read*/
    g_dmaCtrPkt.TTYPE = BLOCK_TRANSFER;
    g_dmaCtrPkt.ADDMODERD = ADDR_OFFSET;
    g_dmaCtrPkt.ADDMODEWR = ADDR_INC1;
    g_dmaCtrPkt.AUTOINIT = AUTOINIT_OFF;
    g_dmaCtrPkt.COMBO = 0U;

    dmaSetCtrlPacket(dmaChanel, &g_dmaCtrPkt);
    dmaSetChEnable(dmaChanel, (UINT32)DMA_SW);

  • The max length of a CAN message is 8 bytes. If you do not want miss any data, You can do 2 32 bit transfers per each DCAN DMA request. If the data block size is in the first message, you may be able to set up the DMA block size for the rest. I do not see that there is other ways to do it.

    Thanks and regards,

    Zhaohong