cancel
Showing results for 
Search instead for 
Did you mean: 

Timer and SPI clock synchronization on STM32F407

Yves_P
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Sarra.S
ST Employee

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.

View solution in original post

3 REPLIES 3
Sarra.S
ST Employee

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.

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 

 

Sarra.S
ST Employee

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.