I'm trying to create a millisecond timer but it is not working. Perhaps my understanding of how the timer works is not solid so I would like to ask for some help.
I'm using the following parameters to create my mS timer: assuming /* PCLK2 = HCLK */ RCC_PCLK2Config(RCC_HCLK_Div1); // 72Mhz /* PCLK1 = HCLK/2 */ RCC_PCLK1Config(RCC_HCLK_Div2); // 36Mhz then I created the following: TelTimersSetConfiguration TIM7, TIM7_IRQChannel, 13, // priority 32, // prescaler 22500, // period TIM_CounterMode_Up, // counter mode TIM_CKD_DIV1, 0) // repetition My formula to calculate these numbers is: Period=72000000/(100*32) however my interrupts are occuring every 100us. What do you think is wrong? Thanks very much. [ This message was edited by: gilmotta on 24-09-2009 19:45 ]
What's inside the function? Is it yours or from some library?
Btw. with the parameters set, I'd expect 10 ms interrupts, not 100 us. If you enter such parameters, 72 MHz/(32*22500)=100 Hz. Did you check with the scope (using eg. SEV instruction or GPIO toggling in interrupt)? Tomas