stm32f303 counter doesn't count
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2013-02-20 10:36 PM
Posted on February 21, 2013 at 07:36
Hello all,
I have been on other forums and no-one has been able to help me so far. I am implementing a timer in a stm32f303 microcontroller. Below is the code that I am using to start it. Can anyone give a suggestion on why the CNT register doesn't count?TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
int main ( void )
{ //Enable SYSCFG clock RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);//Timer clock
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE); //Time base configuration TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); TIM_TimeBaseStructure.TIM_Period = 9999; TIM_TimeBaseStructure.TIM_Prescaler = 99; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure);//TIM Interrupts enable
TIM_ITConfig(TIM4, TIM_IT_Update, ENABLE); TIM_Cmd(TIM4, ENABLE); while(1); #stm32f303
Labels:
- Labels:
-
STM32F3 Series
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2013-02-21 3:53 AM
Posted on February 21, 2013 at 12:53
Where are you observing it not counting?
Make sure not to use a simulator, ie run on actual device, check debug target tab Can you set up one of the channels to output via a pin, or toggle a pin in the interrupt? Are you enabling the NVIC and handling the interrupt?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
