系统频率 SYSCLK = 24MHz
AHB 频率 HCLK = SYSCLK / 16 = 1.5MHz
APB1频率 PCLK1 = HCKL / 16 = 93750Hz
APB2 频率 PCLK2 = HCKL / 1 = 1.5MHz
Timer1时钟源是APB2,不再分频。设置向上计数,溢出中断。根据代码中的配置,应该是10ms中断一次,但Timer1的中断间隔达600多ms。这是为什么呢?
TIM_Cmd(TIM16, DISABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM16, ENABLE);
TIM_UpdateRequestConfig(TIM16,TIM_UpdateSource_Regular);
TIM_TimeBaseStructure.TIM_Period = 15000;
TIM_TimeBaseStructure.TIM_Prescaler = 0;
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInit(TIM16, &TIM_TimeBaseStructure);
TIM_ITConfig(TIM16, TIM_IT_Update, ENABLE);
TIM_Cmd(TIM16, ENABLE); |