set timer to interrupt every 500ns(2MHZ)
I am using stm32F103RE with 72mhz timer clock for using timer 1. I set prescalor to 0 and ARR to 35 to make 2MHZ timer interrupt.(72/36=2) to check it I use a variable and add it every 2,000,000 like the code below...I expect it to be added every 1s but it is slower !! and setting it to 2MHZ maked systick timer stops working unless changing the interrupt priority to 15!!
can anybody help me?
here in the code in IRQ_TIM1:
void TIM1_UP_IRQHandler(void)
{
HAL_TIM_IRQHandler(&htim1);
/* making 1s to check interrupt routine */
t1++;
if(t1 == 2000000 )
{
t1=0;
timer_1s++;
}
/* USER CODE END TIM1_UP_IRQn 1 */
}
