AnsweredAssumed Answered

MOE behaviour on TIM1/8/20

Question asked by Martin Izaak on May 9, 2018
Latest reply on May 24, 2018 by Martin Izaak

Hello forum,

I am new to STM32 but familiar with programming DSPs/MCUs.

I just bought a NUCLEO-F303ZE board and I am struggling with the PWM-Timer block. I have set up a CubeMX project and I achieved a project with a PWM on TIM1 from scratch. First it was very surprised that I have to write two HAL-commands to start the PWM and PWMN (HAL_TIM_PWM_Start and HAL_TIM_PWMN_Start).

No I am playing with the MOE. I noticed that this command is executed immediately and not at CNT=0.

So my question is if there is a way to start all TIM-PWMs synchronised at CNT=0 (very important for our motor control). The TIM update event also starts my ISR for controlling the motor so an On/Off of the TIM is not a good idea.

My next question will be if there is a way to switch of the PWM output at a given CNT value. For example on an up counting configuration I want to set the PWM-pin at CNT=2 and reset the PWM pin at CNT=5. I found one way to use a separate TIM module for each phase. But that is not my favourite solution.

Thank you for your support,

Martin

Outcomes