2025-01-23 04:30 AM
Dear All,
I would like to interface an ADC (ADS131M08) with a STM32F407. The ADC datasheet mentions that for better performance, the ADC clock should be synchronized with the SPI clock. Is there any way to achieve such synchronization with the STM? I was thinking about a timer that can give the clock to the ADC and get this timer sync with the SPI, but I don't really see if it's possible and how to implement it.
Thanks for your help
Best regards
Solved! Go to Solution.
2025-01-24 02:04 AM
Hello again,
For synchronization, you can use interrupt or polling to detect the rising edge of the PWM signal.
You can also use the input capture feature of another timer to detect the edge and trigger SPI communication
Either way, there are several examples using timers in the STM32F4CubeFW
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-01-23 08:39 AM
Hello @Yves_P,
You can use one of the timers to generate the ADC clock signal; configure the timer to generate a PWM signal at the desired ADC clock frequency. Then, set the SPI peripheral to operate at a frequency that is a multiple or sub-multiple of the ADC clock frequency
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-01-24 01:42 AM
Hello @Sarra.S,
Thanks for this prompt answer. As I understand it, since both clocks derive from the main STM clock, as long as the PWM timer and SPI clock are multiple or sub multiple from each other, they must be somehow synchronized. Am I correct?
Is there any way to specify or force the first SPI clock rising edge to be in phase with a PWM timer rising edge ?
Thanks for your help
Best regards
2025-01-24 02:04 AM
Hello again,
For synchronization, you can use interrupt or polling to detect the rising edge of the PWM signal.
You can also use the input capture feature of another timer to detect the edge and trigger SPI communication
Either way, there are several examples using timers in the STM32F4CubeFW
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.