cancel
Showing results for 
Search instead for 
Did you mean: 

Timer3 generating 5Hz pulse ?

antonius
Senior

Dear Member,

How can I generate 5Hz pulse on OC using TIM3 ?

Here is my setting on STM32CubeMx0690X0000089KbvQAE.jpg

Thanks

11 REPLIES 11

with this setting :

htim3.Init.Prescaler = 5;

 htim3.Init.CounterMode = TIM_COUNTERMODE_UP;

 htim3.Init.Period = 5;

What frequency do I get ?

What's the formula ?

 htim3.Init.Prescaler = (SystemCoreClock/1000000)-1; //(2.097Mhz/1000000)-1

 htim3.Init.CounterMode = TIM_COUNTERMODE_UP;

 htim3.Init.Period = 1000000/1000; //1Khz

 htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;

Is my calculation right ?