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.

TMS570LS1114: DMA configuration

Part Number: TMS570LS1114

Hello, I want to use DMA to implement CAN message reception and I would like to ask the following questions.

1. I want to receive multi-byte data, how do I configure the dmaConfigCtrlRxPacket function? What is its trigger mechanism?Why can I only receive one frame of data to the destination address at a time.When I sent data to the MCU, the interrupt only entered once, and there was no response when I sent it again.My configuration is shown inpicture.

2.Can DMA only use interrupts to trigger reception?what about polling mode? Are there any related routines for DMA to receive large amounts of data?

Thanks for your help.

  • I want to receive multi-byte data, how do I configure the dmaConfigCtrlRxPacket function?

    Your DMA packet configuration is correct for DMA frame transfer. You can transfer ElmntCnt 64-bit words by every trigger.

    What is its trigger mechanism?

    DMA supports HW request and SW request. The DMA transfer can be triggered by writing to SW Channel Enable Set and Status Register, this is called SW request or SW trigger. The HW request or trigger is related ot the request from the peripheral. 

    The DCAN IF3 register set can automatically be updated with received message objects without the need to initiate the transfer from Message RAM by CPU. A DMA request is generated when DCAN IF3 update is complete.

    When I sent data to the MCU, the interrupt only entered once, and there was no response when I sent it again.My configuration is shown inpicture.

    For DMA frame transfer, one request only triggers one frame transfer. You need to issue another request to trigger another frame transfer. Please use the HW request instead of SW request in your code.

    Can DMA only use interrupts to trigger reception?what about polling mode?

    You can use either interrupt mode or polling mode. 

    This is an example for polling mode:

    while(dmaGetInterruptStatus(DMA_CH0, FTC) == FALSE);

  • Thanks for your help, I can receive multi-frame of data,But now there is a new problem.

    I want to use CAN's sending FIFO, and the sending ID will be updated every time. I think my program doesn't  use  the FIFO function.Can you help me answer it?

        for(u8lv_messageBox = 33u; u8lv_messageBox < 33u+u8lv_pkt_num; u8lv_messageBox++)
        {
            u32lv_msgBoxArbitVal_val_temp = canGetID(node, u8lv_messageBox);
            u32lv_msgBoxArbitVal_val = cfig_id_val(node,u32lv_msgBoxArbitVal_val_temp,u8lv_link_type,u8_frm_type);
            canUpdateID(node,u8lv_messageBox,u32lv_msgBoxArbitVal_val);
            canUpdateDLC_trans(node,u8lv_messageBox,u8lv_dlc_len);
    
            canTransmit(node,u8lv_messageBox,u8lv_send_data_buff);
            u8lp_dat_send += 8;
            u8lv_sent_cnt= u8lv_messageBox-32u;
        }
     

  • You can update the message ID by calling the API: canUpdateID().

    I think the better way is use different mailboxs for different message IDs. Are all the mailboxes used by your application?

    Here is the CAN FIFO example I posted weeks ago:

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1053548/tms570ls1114-fifo-receive-program-code/3901063#3901063

  • Yes,I configured all massageboxes between 33-64 with the same ID.When I am ready to send data, I will update the ID of the corresponding messageBox first, and then send it, but I think this sending method is no different from using a messageBox sending method? It seems that the FIFO function is not used?

    What do you think of this method of transmit, and do you have any good suggestions?

  • Thank you so much.

    And do you know how to clear unnecessary RX and TX data in CAN FIFO?

  • In DCAN FIFO mode, the received message with the same arbitration and mask IDs are supposed to be placed in the FIFO in the order which they are received. The CPU will then retrieve the received messages from the FIFO via the IF1/IF2 interface registers.

    Bear in mind that some messages may be placed in the FIFO out of the order in which they were received. If the order of the messages is critical to the application for processing, then this behavior will prevent the proper use of the DCAN FIFO mode.

  • how to clear unnecessary RX and TX data in CAN FIFO?

    You can program the message object with data=0, or you can write 0 to msgVal. If msgVal=0, the message object will be ignored by the Message Handler.