cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743VIT6 How to use SPI with DMA and without interrupt

ADejo.1
Associate II

Especially, I want to use the external ADC ADS8353IRTER.

To get the data, it requires 48 CLK at 20MHz on SPI.

We face lots of issues with the SPI linked with DMA (trigged by CC of timer).

How to use SPI periph with 48CLK ?

Up to now we need to send 3 times the stream of DMA (linked to SPI), the SPI LTSIZE configured at 3 to get the consecutive 48CLK and the SS well used of the SPI periph.

This is the first data frame, for the second one, we must Reset EOT, Set TXTFC & CSTART. To have the system automatic, we reconfigure these by 2 DMA streams.

It works for 100 frames and stopped after.

My request is quite easy: 48CLK with SS manage by periph of SPI (linked DMA), repeated each 5.21µs (trigged by timer)

If I use an interrupt, due to processor load, timings fluctuates

Is there a way to have SPI full automatic without interrupt ?

3 REPLIES 3
MM..1
Chief II

Maybe SPI SLAVE

TDK
Guru

Use HAL_SPI_Transmit_DMA and disable the interrupts after calling it.

If you feel a post has answered your question, please click "Accept as Solution".
Petr Sladecek
ST Employee

Hello,

the H7 SPI features quite flexible configuration. If you need to read just 48 bits at regular intervals I suggest to retire from any DMA usage. Just configure SPI for Motorola master simplex receiver (MASTER=1, SP=0, COMM=1 with required clock polarity and phase settings) for reception of data packet consisting from two 24-bit data frames under SS HW control (DSIZE=23, FTHLV=1, TSIZE=2, SSOM=0, SSOE=1) and run whenever the initial reading sequence by SPI enable and CSTART setting. Then you can wait either for EOT or better check if EOT is found set within the next triggering timer interrupt service. Anyway, based on EOT event, perform two times 32-bit reading access of the RxDR to read & store 2x 24 bit data received from ADC stored at the RxFIFO (optionally you can use 3x 16-bit access here if apply DSIZE=15, FTHLV=2 and TSIZE=3 setting). Then at timer service, disable SPI and start next ADC reading cycle by setting SPE followed by CSTART again. That is all. EOT flag should be cleared automatically by SPI re-enable. Few lines of code inside EOT and/or Timer interrupt service can handle this simple task easily.

Best regards,

Petr, the IP owner, STMicroelectronics