Slave timer configuration procudes an interrupt STM32f10x
int Pulse(void)
{
TIM_TimeBaseInitTypeDef TimeStruct;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2,ENABLE);
TIM_SelectInputTrigger(TIM2,TIM_TS_ITR3);//
TIM_SelectSlaveMode(TIM2,TIM_SlaveMode_External1);
TimeStruct.TIM_Prescaler=0;
TimeStruct.TIM_CounterMode=TIM_CounterMode_Up;
TimeStruct.TIM_Period=29;
TimeStruct.TIM_ClockDivision=TIM_CKD_DIV1;
TimeStruct.TIM_RepetitionCounter=0;
TIM_TimeBaseInit(TIM2, &TimeStruct);
TIM_ITConfig(TIM2,TIM_IT_Update,ENABLE);
///Master Configuration code
...
}
void TIM2_IRQHandler(){
if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET)
{
x=x+1;
TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
}
}I am going to config a master and slave configuration under STM32f10x. I connected them correctly but at the first step it generates an interrupt before enabling the master timer or enable the slave timer. Here is my code:
after calling the Pulse function, it generates TIM2 interrupt(x=1), I need to know why it generates an interrupt when its trigger source is not configured/enabled.
