2012-06-21 07:58 AM
2012-06-21 08:23 AM
Don't know about the general viability of this
But you'll need to fix the Channel# here TIM_OC3Init(TIM4, &TIM_OCInitStructure); // Initializes the TIM Channel 3 according to the parameters specified in the TIM_OCInitStruct2012-06-21 11:01 AM
THANKS!!! clive1,,,
%%%%% BELOW THE SOLUTION%%%%%%%%void TIM_Configuration(void)
{ /* Time base configuration */ TIM_TimeBaseStructure.TIM_Period = 0xFFF; TIM_TimeBaseStructure.TIM_Prescaler = 3000; TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseStructure.TIM_RepetitionCounter = 1; TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure); /* PWM1 Mode configuration: Channel1 */ TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; TIM_OCInitStructure.TIM_Pulse = 50; TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; TIM_OC3Init(TIM4, &TIM_OCInitStructure); TIM_ARRPreloadConfig(TIM4, ENABLE); // ''connecting'' DMA and TIM3 TIM_DMACmd(TIM4, TIM_DMA_Update, ENABLE);/* TIM3 enable counter */
TIM_Cmd(TIM4, ENABLE);// turning on TIM3 and PWM outputs
TIM_CtrlPWMOutputs(TIM4, ENABLE); }