STM32F103 input timer interrupts...
I have a test project that sets up TIM3.3 to count microseconds between falling edges of the timer input. The timer is started with a call to HAL_TIM_IC_Start_IT(&htim3, TIM_CHANNEL_3); to start timing the input. Inside HAL_TIM_IC_CaptureCallback(*htim), I call pulseDurations[pulseIdx++]= HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_3);
followed by __HAL_TIM_SET_COUNTER(htim, 0); to save and reset the TIM3.3 counter. This gives me the number of microseconds between falling edges of the timer input. This works perfectly until the frequency on the input exceeds 10KHz where incoming pulses appear to be lost and are not counted.
In an attempt to improve the high frequency abilities, I created a second test project to use HAL_TIM_IC_Start_DMA(&htim3, TIM_CHANNEL_3, fallData, numData); to populate an array with the timer counter values every time TIM3.3 receives a falling edge. The array gets populated correctly, albeit the 16 bit timer value overflows but, otherwise it is working correctly.
Is there a way to duplicate the ability to reset the timer counter shown in the first project after logging it in the DMA array of the second project?
I am using the HAL_ library. Would things speed up by using the LL_ library? I need to get to 150KHz.
Source code available. I didn't know how much to include. It's mostly examples from various sources.
Thanks,
Dan
