2024-02-07 08:20 AM
Hello, I have a problem currently, I am a beginner on stm32 and I would like to create a pulse counter but I cannot get the interrupts from my timer 3 to increment my variable. I don't understand then that the function is indeed carried out but it is not called.
And my second problem is i want to count with a TIM to 90kHz and i don't now if it's possible to realise with a stm32f103c8t6.
thanks, have a good day
2024-02-07 08:30 AM - edited 2024-02-07 08:30 AM
> __HAL_TIM_GET_COUNTER(&htim3) == 10000
This is never going to be true inside the period elapsed callback. I don't know why you're checking this.
> And my second problem is i want to count with a TIM to 90kHz and i don't now if it's possible to realise with a stm32f103c8t6.
Load the chip in CubeMX and look at the clock configuration tab to see what's possible. Max system clock is 72 MHz. That is also the maximum timer clock possible. 90 kHz is well under 72 MHz, so yes this is possible.
2024-02-07 12:29 PM
I have to count the number of pulses on an input (P2_pin) the period lasts about 1.3 seconds but my counter stops at 10000 pulses when it should go to 65536 already I don't understand this, and I used a low frequency generator to see how many Hz my pin could increment my counter is the maximum is 100Hz my counter doesn't go any faster. I would like to count my total number of pulses on the P2_pin as quickly as possible and display it on my lcd screen, but I can't manage to do it. Could you help me? I would need my tim3 to count up to 65536 pulses and if my number of pulses exceeds that I would increment it during the acquisition of my period because I would like to know the phase shift of my motor between my FCEMs and my hall cells. thank you