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.

TMS570LS1224: Problems getting started with SPI slave and DMA

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN

Hello,

I want to be using my TMS570ls1224 as a slave in my SPI communication. I don't have the time in my program to stop and wait for my master to get data, so therefore I want to use DMA with the SPI. However, I can't seem to find any examples or anything on how to use the controller in slave mode or using the DMA correctly for that matter. If someone could possible help me just to get started(e.g. with a simple example if there exists one) that would be much appreciated.

Eirik Nobuki Kosaka

  • Hello Eirik,

    The code for SPI slave and master are similar. The following can be used as a reference:

    1. spiInit(), generated by HALCoGen, RX and TX interrupt should be enabled
    2. dmaEnable()
    3. Enable interrupt after reception of data
    dmaEnableInterrupt(DMA_CH0, FTC); //Frame transfer complete
    dmaEnableInterrupt(DMA_CH0, BTC); //Block transfer complete
    dmaEnableInterrupt(DMA_CH0, HBC); //Half block transfer complete
    4. Assign DMA request line to DMA channel
    dmaReqAssign(DMA_CH0, 24); //SPI4 RX
    dmaReqAssign(DMA_CH1, 25); //SPI4 TX
    5. Configure DMA RX and TX control packets
    6. Set the DMA channel to trigger the HW request
    dmaSetChEnable(DMA_CH0, DMA_HW); //SPI4 RX, hardware triggering
    dmaSetChEnable(DMA_CH1, DMA_HW); //SPI4 TX, hardware triggering
    6. Enable SPI
    spiREG4->GCR1 = (spiREG4->GCR1 & 0xFFFFFFFFU) | 0x01000000U;
    7. Enable DMA request
    spiREG4->INT0 = (0x1 << 16);

    The SPI clock is from master.
  • Thanks for a great answer!

    A few things though, I am not able to enable TX interrupt. I have added a picture from what I think I should check HalCoGen just to be sure that I am doing it right.

    It is also unclear what DMA request line I should be using? I am using SPI5 and found the following table in one of your datasheets

    Since SPI5 and MIBSPI5 share lines can I use all the lines above that seems to have a connection to MIBSPI5?

    Eirik Nobuki Kosaka

  • Hi Eirik,

    SPI5 RX DMA request line is 30
    SPI5 TX DMA request line is 31

    The TX interrupt is enabled in the data transfer function: spiSendData(..)