2012-09-27 01:41 AM
Hi Folks,
I like to disable PWM, on an external event - i want to use BKIN.
i set the break mechanism up like this
------
......
GPIO_PinAFConfig(GPIOB, GPIO_PinSource12, GPIO_AF_TIM1);
/* Automatic Output enable, Break, dead time and lock configuration*/
TIM_BDTRInitStructure.TIM_OSSRState = TIM_OSSRState_Enable;
TIM_BDTRInitStructure.TIM_OSSIState = TIM_OSSRState_Enable;
TIM_BDTRInitStructure.TIM_LOCKLevel = TIM_LOCKLevel_1;
TIM_BDTRInitStructure.TIM_DeadTime = 30;
TIM_BDTRInitStructure.TIM_Break = TIM_Break_Enable;
TIM_BDTRInitStructure.TIM_BreakPolarity = TIM_BreakPolarity_High;
TIM_BDTRInitStructure.TIM_AutomaticOutput = TIM_AutomaticOutput_Enable;
TIM_BDTRConfig(TIM1, &TIM_BDTRInitStructure);
....
PWM works, but when i activate PB.12, nothing happens... i expect PWM to stop ... .any hints ??/Finn #gpio-bkin2012-09-27 07:15 AM
Did you configure the BKIN as an alternate function pin? Here's how I set it up:
GPIO_PinAFConfig(GPIOE, GPIO_PinSource15, GPIO_AF_TIM1); // BKIN GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; // input w/pullup GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; // slow inputs GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; // winding fault (BKIN) GPIO_Init(GPIOE, &GPIO_InitStructure);
Jack Peacock2012-09-27 07:19 AM
TIM_BDTRInitStructure.TIM_OSSIState = TIM_OSSIState_Enable;
2012-09-27 09:40 AM
Hi all,
problem solved by setting BKIN to GPIO_Mode_AF....Thanks for your time....