cancel
Showing results for 
Search instead for 
Did you mean: 

Using NVIC to measure frecuency of a multiple pulse signal in StopMode2 is a good option?

Santiago_Deliotte
Associate II

I am trying to create a frequency meter in a STM32U575ZI microcontroller that works with ThreadX and low power consumption using the low power timers LPTIM3 and LPTIM4, as well as an interrupt using EXTI 14. In summary, I use LPTIM4 to count input pulses within a one-second interval (delay of the operating system task). Then, using LPTIM3 and an interrupt, I correct any deviation in the last pulse to adjust the measured frequency. The execution sequence is better explained in the document I have provided.

During implementation, I encountered an issue where the interrupt would wake up the system despite being disabled (I even tried disabling the clock of the corresponding port for EXTI). To overcome this, I found that changing the operating mode of the GPIO which uses the interrupt, from GPIO_MODE_IT_FALLING to GPIO_MODE_OUTPUT_PP prevents unwanted signals from reaching the microcontroller when I don't want it to wake up, and allows signals when I do want it to wake up, so it works. However, I'm not sure if this practice is recommended, which is why I am asking this question. I want to know if there is a better way to implement this measurement system or if I am on the right track.

0 REPLIES 0