cancel
Showing results for 
Search instead for 
Did you mean: 

NEED CLARIFICATION TIMER INTERRUPT FORMULA

WM_IR
Senior

I have read a book on stm32, and inside the timer topic, it is stated that a formula to determine the values to be loaded to generate interrupt at specified times which as below:

0693W00000QKKUtQAP.jpgMy question is does this formula applicable for all stm32 timers? and another question is, I could not find this formula in reference manual for model stm32L476RG. Could someone show me where to get this formula from official ST documentation?

1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Principal III

The official source is the reference manual, in your case RM0351 "STM32L47xxx, STM32L48xxx, STM32L49xxx and STM32L4Axxx advanced Arm®-based 32-bit MCUs". The formula may not be stated explictely, but can be dervived from the texts, like

33.4.7 ... "The counter clock frequency CK_CNT is equal to f_CK_PSC / (PSC[15:0] + 1)."

33.3.2 Counting mode, see the diagrams.

hth

KnarfB

View solution in original post

2 REPLIES 2

The TIM use N-1 values for the Prescaler and Period counters as these are the simplest to implement. ie simple comparator of last value so next clock rolls into Update​ / Zero load.

i​e Period = 9, has 10 states, 0 .. 9, repeating

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
KnarfB
Principal III

The official source is the reference manual, in your case RM0351 "STM32L47xxx, STM32L48xxx, STM32L49xxx and STM32L4Axxx advanced Arm®-based 32-bit MCUs". The formula may not be stated explictely, but can be dervived from the texts, like

33.4.7 ... "The counter clock frequency CK_CNT is equal to f_CK_PSC / (PSC[15:0] + 1)."

33.3.2 Counting mode, see the diagrams.

hth

KnarfB