Adding Timer 2nd PWM channel breaks execution
Posted: Fri May 13, 2022 3:31 pm
Hi everyone, I'm struggling with the use of a 2nd or 3rd PWM channel on one timer.
CORE STM32 official, stm34f411ce6 (blackpill)
For example, the following code works:
but if I add " htim3->setPWM(3, PB0, 50000, 25);" , the execution stops at that line. Example code:
I really need that channel! IT works fine on STM32CubeIDE, I'm using the same pins. What can I do?
CORE STM32 official, stm34f411ce6 (blackpill)
For example, the following code works:
Code: Select all
HardwareTimer *htim2 = new HardwareTimer(TIM2);
HardwareTimer *htim3 = new HardwareTimer(TIM3);
void setup()
{
htim2->setPWM(1, PA5, 272.25, 50);
htim3->setPWM(1, PA6, 50000, 25);
}
void loop() {
htim2->setOverflow(227272, TICK_FORMAT);
delay(2000);
htim2->setOverflow(427272, TICK_FORMAT);
delay(2000);
}
Code: Select all
HardwareTimer *htim2 = new HardwareTimer(TIM2);
HardwareTimer *htim3 = new HardwareTimer(TIM3);
void setup()
{
htim2->setPWM(1, PA5, 272.25, 50);
htim3->setPWM(1, PA6, 50000, 25);
htim3->setPWM(3, PB0, 50000, 25);
}
void loop() {
htim2->setOverflow(227272, TICK_FORMAT);
delay(2000);
htim2->setOverflow(427272, TICK_FORMAT);
delay(2000);
}