Question
Changing Pulse makes the frequency half of the original one
Hi,
I have this function to simulate a quadrature output
void TIM3_Configuration_positive_quadrature(void)
{
TIM_OCInitTypeDef TIM_OCInitStructure;
int Period;
Period = 1000 / 1; // 1 Hz - 1 second on, 1 second off duty
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Toggle;
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
TIM_OCInitStructure.TIM_Pulse = (Period * 1) / 4; // CH3 at 25%
TIM_OC3Init(TIM3, &TIM_OCInitStructure);
TIM_OCInitStructure.TIM_Pulse = (Period * 3) / 4; // CH4 at 75%, ie half cycle later
TIM_OC4Init(TIM3, &TIM_OCInitStructure);
}
When I set 1000 Hz as frequency (controlled by oscilloscope that is correctly set) after calling the quadrature function above the frequency becomes half.
Any idea on why of this behaviour?
