How to Configure the Timer etc to specific need for GPS aligned ADC sampling
Dear ST team,
I tried to use CubeX, did not able configured as needed. I done separate two timers, the results are not accurate and lots of jitter without any other application.
Need - Using GPS receiver's PPS output to aligned the sampling of external ADC using STM32F411. I have following things, GPS pulse in each board, feed to PA0 and PA1. External ADC which is connected on SPI (16 bits) and Start of conversion pin to PWM out of STM32. The End of conversion pins of ADC to STM32F411, external INT pin. The hardware can be modified if needed, being evaluation kit.
I done like this - 1) PPS to PA0 and IC mode with Rising edge interrupt to find error of timer TIM2_CH1, to calibrate my sampling timer (TIM5). 2) STC of ADC on PA1 (TIM5_CH2) as PWM out and its period is programmed as needed by sampling rate and correction factor based on error from TIM2. The time is not stable, it has jitter. Time being I am not using any other code in MCU.
Does this right or wrong method? If Wrong, what will be best.
Being old user of 8051, the Gated Mode Timer on TIM2-CH2, to calculate error and Drive the PWM Out on PA1 must be more accurate, but it is not possible to configure in CubeX.
The final aim - Align the ADC sampling with Rising edge of PPS, Timer calibration timer counter start and Start of conversion, these three event must be start on Rising edge of PPS. That means they get aligned at every second.
There is one more question, asked about Gated or IC mode of timer eariler.
Thanks in advance
