Calculate ARR value for Timer TIM2, TIM3 in STM32F407
Hi
Can you tell me how I can calculate a value for ARR for timer 2(32bit timer) and timer3(16bit timer)
I am using STM32F407 APB1 timer clock is 12MHz prescaler is 6
Hi
Can you tell me how I can calculate a value for ARR for timer 2(32bit timer) and timer3(16bit timer)
I am using STM32F407 APB1 timer clock is 12MHz prescaler is 6
Read The Fine Document - the Reference Manual, GPIO section. The only register needed for simple output setup is MODER; you don't need to touch the others.
Regarding the timer setup: why should you calculate the values? Leave it to the compiler. For simple timebase setup:
#define TIMCLK_FREQ 84000000u
#define TIM_PERIOD_us 1000u
TIMx->PSC = TIMCLK_FREQ / 1000000u - 1;
TIMx->ARR = TIM_PERIOD_us - 1;
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.