2021-08-02 01:02 AM
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 ?
2021-08-02 05:36 AM
Maybe SPI SLAVE
2021-08-02 06:36 AM
Use HAL_SPI_Transmit_DMA and disable the interrupts after calling it.
2021-08-10 05:13 AM
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