cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 Timers - Help with TIM_Period

ee06091
Associate III
Posted on August 28, 2013 at 12:14

Hi,

I'm studying the timers on STM32F100 using a STM32VLDISCOVERY board.

Per example: 

TIM_TimeBaseStructure.

TIM_Prescaler

= SystemCoreClock/

1000

-

1

;

TIM_TimeBaseStructure.

TIM_Period

=

1

;

Will set the count frequency to 500Hz.If I configure an OC like this:

//configure channel TIM2 CH2

TIM_OCStructInit(&TIM_OCInitStructure);

TIM_OCInitStructure.

TIM_OCMode

=

TIM_OCMode_Toggle

;

TIM_OCInitStructure.

TIM_OutputState

=

TIM_OutputState_Enable

;

TIM_OC2Init(

TIM2

, &TIM_OCInitStructure);It will create an output clock at 250Hz on TIM2CH2. Now what I don't understand.Why can't be the TIM_Period = 0?
3 REPLIES 3
Posted on August 28, 2013 at 13:25

TIM_Period = 0 turns OFF the timer.

For practical applications of the timer it is generally most effective to put the smaller of the values in TIM_Prescaler, the larger in TIM_Period.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ee06091
Associate III
Posted on August 30, 2013 at 02:15

Set the TIM_Period is the same as set the ARR value?

Which documentation should I read to understand the stm32 firmware library?

Thanks :) 

Posted on August 30, 2013 at 02:36

The F1 firmware library should have a .CHM help file describing the library, this will augment the source and examples.

To understand the part you will want to look at the

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00251732.pdf

and

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/reference_manual/CD00246267.pdf

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