2021-10-07 05:23 AM
Hello,
I want to use a STM32F7 to retrieve ADC measurements from an external ADC over SPI (16-bit read operation to retrieve the measurement).
In theory, it should be possible.
My question is: how can I retrieve the measurements minimizing the host processor load ?
My idea is to ;
The problem is that my interrupt will fire each 2us ... I don't think this is reasonable on a microcontroller.
Is there a smarter way to do that on a MCU ?
Or should I choose another solution like FPGA or DSP ?
Thanks !
Solved! Go to Solution.
2021-10-07 06:20 AM
It's still possible, a little complicated.
Use a master timer to trigger the ADC.
Use a slave timer in gated mode (off of master timer) to generate the 16 SCK clocks.
Use SPI slave in receive mode to get data.
2021-10-07 05:49 AM
Adjust your SPI clock such that it reads 16 bits every 2us and have it continuously read, then use DMA to transfer many values at once. You can use half- and full-complete callbacks to process the data.
2021-10-07 06:02 AM
Thank you TDK.
This is a great idea, but my ADC is a bit particular.. I need to trigger the ADC measurement by a GPIO rising edge. I need to see if I can continuously "poll" the SPI bus,
2021-10-07 06:20 AM
It's still possible, a little complicated.
Use a master timer to trigger the ADC.
Use a slave timer in gated mode (off of master timer) to generate the 16 SCK clocks.
Use SPI slave in receive mode to get data.
2021-10-07 06:41 AM
Thank you !
If I understand correctly, the slave timer allows to generate a kind of "delayed" interrupt, and is this interrupt I can read data through SPI ?
2021-10-07 06:45 AM
2021-10-07 07:03 AM
The only point that I don't understand is: the SPI peripheral is already generating a clock signal right ? Maybe there will be a conflict between the SPI generated clock and the one generated by the slave timer ...
2021-10-07 08:16 AM
2021-10-07 08:19 AM
Ok I did not understand that the SPI had to be configured as a slave.
I will definitely try that.
Thanks a lot.