cancel
Showing results for 
Search instead for 
Did you mean: 

Timer slave mode : Reset mode

Thomas_Socomec
Associate II
Posted on February 09, 2012 at 11:51

Hello,

I would like to use a timer on Reset mode, but I have some problem : My goal is to

never

call the timerinterrupt

until the trigger input is switching

. I want to enter in the timer interrupt only if nothing happend on the input during a defined time (a kind of timeout on the logical input activity). My source code is below :

TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; 
GPIO_InitTypeDef GPIO_InitStructure; 
TIM_ICInitTypeDef TIM_ICInitStruct; 
/* TIM3 clock enable */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); 
/* GPIOA clock enable */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE); 
/* TIM3 channel 1 pin (PA.6) configuration */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; 
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; 
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; 
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; 
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; 
GPIO_Init(GPIOA, &GPIO_InitStructure); 
/* Connect TIM14 pins to AF */
GPIO_PinAFConfig(GPIOA, GPIO_PinSource6, GPIO_AF_TIM3); 
/* Time base configuration */
TIM_TimeBaseStructure.TIM_Period = 65535; 
TIM_TimeBaseStructure.TIM_Prescaler = 0; 
TIM_TimeBaseStructure.TIM_ClockDivision = 0; 
TIM_TimeBaseStructure.TIM_RepetitionCounter = 0; 
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; 
TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); 
/* Fill the TIM_ICInitStruct with the desired parameters */
TIM_ICInitStruct.TIM_Channel = TIM_Channel_1; 
TIM_ICInitStruct.TIM_ICPolarity = TIM_ICPolarity_Rising; 
TIM_ICInitStruct.TIM_ICSelection = TIM_ICSelection_DirectTI; 
TIM_ICInitStruct.TIM_ICPrescaler = TIM_ICPSC_DIV1; 
TIM_ICInitStruct.TIM_ICFilter = 0; 
TIM_ICInit(TIM3, &TIM_ICInitStruct); 
/* TIM1 Input trigger configuration: External Trigger connected to TI1 */
TIM_SelectInputTrigger(TIM3, TIM_TS_TI1FP1); 
TIM_SelectSlaveMode(TIM3, TIM_SlaveMode_Reset); 
TIM_SelectMasterSlaveMode(TIM3, TIM_MasterSlaveMode_Enable); 
/* TIM3 IT enable */
TIM_ITConfig(TIM3, TIM_IT_CC1, ENABLE); 
/* TIM3 enable counter */
TIM_Cmd(TIM3, ENABLE);

If anyone can help me ... Thomas #timer-slave-mode-reset
1 REPLY 1
Thomas_Socomec
Associate II
Posted on February 09, 2012 at 11:56

At this time, the timer interrupt is called each time the input state changes (on>off and off> on).