AnsweredAssumed Answered

STM32F103RBT6 TIM2 PWM notwork

Question asked by mahdi zamani on Mar 30, 2018
Latest reply on Mar 30, 2018 by mahdi zamani

hi 

i write this code for TIM2 CH3 PWM generation GPIOB.10

but it not works 

can help too me ....

BEST regards 

 

// RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
//
// GPIO_StructInit(&port);
// port.GPIO_Mode = GPIO_Mode_AF_PP;
// port.GPIO_Pin = GPIO_Pin_10;
// port.GPIO_Speed = GPIO_Speed_10MHz;
// GPIO_Init(GPIOB, &port);
//
// TIM_TimeBaseStructInit(&timer);
// timer.TIM_Prescaler = 720;
// timer.TIM_Period = 1000;
// timer.TIM_ClockDivision = 2;
// timer.TIM_CounterMode = TIM_CounterMode_Up;
// TIM_TimeBaseInit(TIM2, &timer);
//
// TIM_OCStructInit(&timerPWM);
// timerPWM.TIM_Pulse = 15;
// timerPWM.TIM_OCMode = TIM_OCMode_PWM1;
// timerPWM.TIM_OutputState = TIM_OutputState_Enable;
// timerPWM.TIM_OCPolarity = TIM_OCPolarity_High;
// TIM_OC3Init(TIM2, &timerPWM);
//
// TIM_Cmd(TIM2, ENABLE);

Outcomes