2023-12-20 01:48 AM
Hi!
I am working on an application, where I need a running clock to subdivide the time between PPS pulses. I am using an STM32F412, complete custom PCB but the code is mostly relying on HAL and FreeRTOS.
In this application I need to time-stamp some measurements the MCU takes really accurately. I have a PPS signal available at TIM8's ETR1 pin (A0 in my LQFP100 package). I intend to use this PPS pulse to restart the timer at each rising edge. Then as the timer ticks away, when I have a measurement taken, I save the timer count from the CNT register.
The problem is I am not sure about the correct setup of the timer.
I am thinking:
sSlaveConfig.SlaveMode = TIM_SLAVEMODE_RESET;
sSlaveConfig.InputTrigger = TIM_TS_ETRF;
sSlaveConfig.TriggerPolarity = TIM_TRIGGERPOLARITY_NONINVERTED;
sSlaveConfig.TriggerPrescaler = TIM_TRIGGERPRESCALER_DIV1;
sSlaveConfig.TriggerFilter = 0;
Is there a better way to do this?
Thanks!