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.

TMS570LC4357: want the sample code for the SPI communication using DMA.

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Hi,

I am working on the TMS570LC4357 controller for the SPI communication Using DMA Modes. So tried to exist the communication on the board but couldn't.

Thus, can you just provide any sample code for the same.

Regards,

Shivam Kakad

  • Specifically i want to use the DMA request by channel chaining control packet.

  • Hello,

    There is an example code for using DMA under HALCoGen example folder ( by default c:\ti\Hercules\HALCoGen\v04.07.01\examples\TMS570LC43x\ ). Description how to set and use the example is in HALCoGen help ( Help-->Help topics-->Examples ).

    Chain[5:0] field of the Channel Control Register is used to program the chaining (Section 20.2.13 of device TRM: ).

    Best regards,
    Miro

  • Part Number: TMS570LC4357

    Tool/software: Code Composer Studio

    Hi,

    I am working on the TMS570LC4357 board for the SPI - DMA communication using the channel chaining mode.

    I want to use it as a ping pong buffer/mode.

    Can you please provide me the example code for the same. that will be very helpful.

    Regards,

    Shivam Kakad 

  • Hello,

    We don't have example code for chaining. Chain[5:0] field of the Channel Control Register is used to program the chaining.

    Best regards,
    Miro

  • Hi,

    For SPI-DMA currently i am using the dma req lines 0 and 1 for the reception and transmission of SPI1 respectively, where the req lines is assigned to channel 0 and 1.

    with this it is working properly.

    Now when i want to use the dma req lines 4 and 5 as reception and transmission for SPI1 as well, i am not getting any response in the RXDATA which is receive buffer in SRAM.

    I am assigning this req lines with the channel number 4 and 5 respectively.

    I am using following lines of code where g_dmaCTRLPKT2 packet configured for reception and g_dmaCTRLPKT1 as transmission

    /* - setting dma control packets */
    dmaSetCtrlPacket(DMA_CH4,g_dmaCTRLPKT2);

    dmaSetCtrlPacket(DMA_CH5,g_dmaCTRLPKT1);

    /* - setting the dma channel to trigger on h/w request */

    dmaSetChEnable(DMA_CH4, DMA_HW);

    dmaSetChEnable(DMA_CH5, DMA_HW);

    /*5-transmit,4-receive*/

    dmaReqAssign(DMA_CH4, DMA_REQ4);
    dmaReqAssign(DMA_CH5, DMA_REQ5);

    dmaEnable();

    dmaEnableInterrupt(DMA_CH4, BTC, DMA_INTA);

    spiREG1->INT0 |= 0x00010000;

    while(dmaGetInterruptStatus(DMA_CH4, BTC) != TRUE);

    dmaDisableInterrupt(DMA_CH4, BTC);

    Same thing is happening when i am using req lines 8 and 9.only working with the req lines 0 and 1. why is it so?

    Do I need to consider any other register, if for a particular req line has more than single module is assigned?(TRM 6.17.3)

    Can you please help me with this?

    Regards,

    Shivam Kakad.

  • Hello,

    Here I found example for chaining: 

    For using DMA with SPI1 in compatible mode you have to use DMAREQ[0] and DMAREQ[1]

    Best regards,
    Miro

  • Thanks Miro. 

    What channels we can use for SPI with DMA in chaining mode for TMS570LC43xx where we need to handle both TX and RX operations?