cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32F100B

Alex T
Associate II
Posted on April 05, 2017 at 16:19

I want to know how TIM2 of STM32F100 works. Can someone help me?

TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;

uint16_t PrescalerValue = 0;

RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);

TIM_TimeBaseStructure.TIM_ClockDivision = 0;

TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;

TIM_TimeBaseStructure.TIM_Prescaler = (uint16_t) (SystemCoreClock / 1000) - 1;

TIM_TimeBaseStructure.TIM_Period = 999;

I don't understand why TIM_Period is 999.

10 REPLIES 10
Posted on April 06, 2017 at 11:42

I'm sorry to disturbed you but i don't  get it. So i have this library 'STM32F10x_StdPeriph_Lib_V3.5.0' where is this folder Project -> STM32F10x_StdPeriph_Examples -> TIM -> TimeBase ->main.   In this main i have done the modification on TIM2 how you said it. But dosen't work. TIMCLK=24MHz and P=500ms. The led is off always one second. How can i make it to stay for  0.5 second?