AnsweredAssumed Answered

stm32 timer config at 1us bug

Question asked by amin mokhtari on Aug 3, 2017
Latest reply on Aug 4, 2017 by KIC8462852 EPIC204278916

hey all

i configed timer for 1us timer interrupt but how can i be sure my timer interrupt is 1us ?

my microcontroller is stm32f103c8t6 her RCC configed with pll on 72Mhz 

external crystal 8Mhz


my timer function 

void TIMER_Config(TIM_TypeDef* timer, uint16_t Period, uint16_t Prescaler, uint16_t ClockDivision, uint16_t CounterMode, FunctionalState status){

TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;

TIM_TimeBaseStructure.TIM_Period = Period;
TIM_TimeBaseStructure.TIM_Prescaler = Prescaler;
TIM_TimeBaseStructure.TIM_ClockDivision = ClockDivision;
TIM_TimeBaseStructure.TIM_CounterMode = CounterMode;
TIM_TimeBaseInit(timer, &TIM_TimeBaseStructure);
TIM_ARRPreloadConfig(timer, status);//TIM4 Config for 1ms interrupt

TIM_ClearITPendingBit(timer, TIM_IT_Update);
TIM_ITConfig(timer, TIM_IT_Update, status);
TIM_SetCounter(timer, 0);
TIM_Cmd(timer, status);

my nvic function


void NVIC_Config(uint8_t IRQChannel, uint8_t PreemptionPriority, uint8_t SubPriority , FunctionalState status){
NVIC_InitTypeDef NVIC_InitStructure;

NVIC_InitStructure.NVIC_IRQChannel = IRQChannel;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = PreemptionPriority;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = SubPriority;
NVIC_InitStructure.NVIC_IRQChannelCmd = status; /*TIM4 Interrupt configuration*/


and my timer configuration is


// TIM3 Configuration
NVIC_Config(TIM3_IRQn, 0, 1 , ENABLE);
TIMER_Config(TIM3,360, 1, 0, TIM_CounterMode_Up,ENABLE);


please help