cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Timer 2 / 5 using 32bit

kruszi
Associate II
Posted on March 08, 2016 at 15:15

Hi,

according to the reference manual the STM32F4(07) Timer 2 and Timer 5 are capable of counting 32bit. I want to use upcounting and overflow event. As far as I understand these timers, the timer counts from 0 to ARR (auto reload value), creates an overflow event and starts from 0 again.

Using STD Peripherals library you can see in stm32f4xx_tim.h

 

 

uint32_t TIM_Period;           

/*!< Specifies the period value to be loaded into the active                        Auto-Reload Register at the next update event. This parameter must be a number between 0x0000 and 0xFFFF.  */

Is loaded into ARR.

So my problem is, that I want to use 32bits of the timer and a ARR that is bigger than 16bit.

Any ideas why only 16bit auto reload values are allowed ?
2 REPLIES 2
Posted on March 08, 2016 at 17:26

Any ideas why only 16bit auto reload values are allowed ?

The comment comes from the older F1 library, the value can be 0x00000000..0xFFFFFFFF

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Walid FTITI_O
Senior II
Posted on March 09, 2016 at 14:49

Hi l..michael,

That's depends on the device and which timer in that device you are using. Keep your first reference of information both reference manual and datasheet of that device.

In your case , with STM32F407, it is mentioned in the reference manual, in TIM2 to TIM5 main features part page 582  the following: “16-bit (TIM3 and TIM4) or 32-bit (TIM2 and TIM5) up, down, up/down auto-reload counter.â€�

For the driver/ headers are developed to support all kinds of integrated Timers and give the safe conditions to avoid inconvenience.

So TIM2 and TIM5 contains 32-bit auto-reload counters and you can work with safely.

-Hannibal-