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.

TMS470R1 DMA-controlled SPI problem

Other Parts Discussed in Thread: TMS470R1B1M

Hello,

I'm working on DMA-controlled SPI on TMS470R1. The SPI is configured as follows:

1) Baud rate at 1MHz

2) Data length at 16 bits

I run into a problem where DMA always copies one data from SPIBUF through RX channel, before it writes one data to SPIDAT, when SPI receive overrun occurs. This problem is illustrated in the following picture:

Currently, I set up a DMA RX (one transfer count) to read out the data left in SPIBUF before I start DMA transfer for my normal data transfer routine. May I know how could I resolve this? Is there any register (DMA or SPI) I could use to clear the SPI controller event to DMA controller?

Thank you.

  • Chii,

    What TMS470R1 part are you using?

    Please be aware that the TMS470R1 Series is not recommended for new designs.  Please see the full 'NRDN' notice here.

    Abhishek

  • Hello,

    The SPI generates a request to the DMA controller whenever the SPIRX buffer is full and also when the SPITX buffer is empty.

    By default, the SPIRX buffer is empty. In master mode of operation, the first DMA transfer occurs from the defined location to the SPIDAT. This data gets copied to the TXBUF from where it gets transmitted. The SPI generates a new DMA request to copy the next data to be transmitted. Also, once the transfer is completed, there will be a DMA request to copy the received data out from the SPIBUF.

    I do not clearly understand the issue you are having, and have to ask a few questions:

    • Are you enabling both the RX and TX DMA requests for the SPI?
    • Is the SPI configured as a master or a slave?
    • Do you see that the SPIBUF is empty by default (no new received data)? You can check this by making sure that the RXINTFLG in the SPICTRL3 register is cleared.
    • Do you see an RX DMA transfer happen before a TX DMA transfer?

    Regards,

    Sunil

  • Hello Arora,

    I'm using TMS470R1VF48C and I understand that it is not recommended for new designs.

  • Hello Sunil,

    Thank you for replying. Let me answer your questions:

    • Yes, RX and TX DMA requests are enabled for SPI.
    • The SPI is configured as slave.
    • I cannot recall if the SPIBUF is empty when the problem occurs. However, whenever there is SPI receiver overrun error, the problem I'm facing will occur when the RX DMA request is enabled for SPI.
    • Yes, RX DMA transfer happens before a TX DMA transfer.

    May I know how to initialize DMA properly to avoid RX DMA transfer happens before a TX DMA transfer, when SPI receiver overrun occurs?

    Thank you,

    ChiiAik

  • accept 192bit and baud rate 10MHz'data use TMS470R1B1M'SPI,how to set SPI?

  • Rui,

    You need to set up and enable DMA module before setting up SPI. Once SPI is enabled, it will generate a TX DMA request pulse immediately because SPIDAT register is empty. The first TX DMA request pulse would be missed if DMA is not set up. For SPI slave mode operation, you should use the 4 pin mode (with SPIENA pin) for the synchronization with SPI master.

    Thanks and regards,

    Zhaohong

  • Hello Rui,

    Did the suggested answer above resolve your issue? If so, please verify the answer to that we can close the thread and so others may reference this information with confidence.