2013-06-14 05:52 AM
I have used APB1 = 30Mhz with 60Mhz to timer. I made following coed for TIM3. I have initialized the TIM3 interrupt.
void TIM3_IRQHandler(void){ TIM3->SR = 0x0000; /* clear update flag */ GPIOA->ODR ^= GPIO_Pin_7;}void config_TIM3(){ TIM3->CR1 = 0x0084; /* No clock divder , ARR is buffered , update Event enabled */ TIM3->SR = 0x0000; /* clear interrupt flag */ TIM3->EGR = 0x0000; /* clear interrupt generation bit */ TIM3->DIER = 0x0001; /* enable interrupt flag */ TIM3->PSC = 0x0000; /* no prescaler */ TIM3->CNT = 0x00000000; /* */ TIM3->ARR = 0xffff; TIM3->CR1 |= 0x0001; /* enable counter */ }Problem is there is timing mismatchI think I had not configured timer properly.I am using formula delay_time = ( ARR * (PSC+1) )/PCLK = (65535 * 1 ) / 60000000 = 1.09225 msI am getting 1.164ms. For system_init() I have used ST clock config utility(excel sheet).