AnsweredAssumed Answered

TIM3 on STM32F100RCT only CH1 giving PWM

Question asked by buslik on Jun 24, 2014
Latest reply on Jun 26, 2014 by buslik
Does anyone have such issue?

/* TIM3 clock enable */
 RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
 
 /* AFIO enable */
 RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB, ENABLE);
 
    /*Configure GPIO pin */
 setOPin(GPIOC, GPIO_Pin_9 | GPIO_Pin_8| GPIO_Pin_7| GPIO_Pin_6, GPIO_Mode_AF_PP, GPIO_Speed_50MHz);
 
 GPIO_PinRemapConfig(GPIO_FullRemap_TIM3, ENABLE);
 
 TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
 TIM_OCInitTypeDef TIM_OCInitStructure;
 uint16_t PrescalerValue = 0;
 
 /* Compute the prescaler value */
 PrescalerValue = (uint16_t)(SystemCoreClock / 24000000) - 1;
 /* Time base configuration */
 TIM_TimeBaseStructure.TIM_Period = 11999;
 TIM_TimeBaseStructure.TIM_Prescaler = PrescalerValue;
 TIM_TimeBaseStructure.TIM_ClockDivision = 0;
 TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
 
 TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);
 
 /* PWM1 Mode configuration: Channel1 */
 TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
 TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
 TIM_OCInitStructure.TIM_Pulse = 12000;
 TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
 
 TIM_OC1Init(TIM3, &TIM_OCInitStructure);
 
 TIM_OC1PreloadConfig(TIM3, TIM_OCPreload_Enable);
 
 TIM_ARRPreloadConfig(TIM3, ENABLE);
 
 /* TIM3 enable counter */
 TIM_Cmd(TIM3, ENABLE);
 
 TIM3->CCR4 = 4000;
 TIM3->CCR3 = 4000;
 TIM3->CCR2 = 4000;
 TIM3->CCR1 = 4000;
 
 while (1) {
 }

I have output only on PC6. Where is the error?

Outcomes