Question
Not desidered auto-reload TIM2
Posted on June 06, 2013 at 00:02
Hi,
i'm angry with this simple code.I need that the timer2 goes from TIM2_ARR to zero and stay zero until a Update EVent is manually generated (with UG from TIM2_EGR of course).But unfortunately TIM2 seems to reset at every underflow also if UDIS of TIM2_CR1 it's set!I hope someone can hel me with this simple problem%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&sharpinclude <stm32f4xx_rcc.h>&sharpinclude <stm32f4xx_tim.h>&sharpinclude <stm32f4xx.h>int state = 0;int main(void){ // // Initialize the peripheral clock. // RCC->APB1ENR |= RCC_APB1Periph_TIM2; // // Configure TIM2 // TIM2->PSC = 0xffff; TIM2->ARR = 2500; TIM2->CR1 |= 0b10 << 8; // CKD TIM2->CR1 |= 0b1 << 7; // ARPE TIM2->CR1 |= 0b1 << 4; // DIR TIM2->CR1 |= 0b1 << 1; //UDIS TIM2->CR1 |= 0b1; //CEN TIM2->CCR1 = 0xffffffff; TIM2->CCR2 = 0xffffffff; TIM2->CCR3 = 0xffffffff; TIM2->CCR4 = 0xffffffff; TIM2->SR &= 0xfffe; TIM2->EGR = 0b0; while(1) { state = TIM2->CNT; }} #update-disable"-"auto-reload" #reload-timer #anyone?"