Skip to main content
omid hamdi
Associate III
May 28, 2020
Solved

stm32f303 timer1 motor control

  • May 28, 2020
  • 3 replies
  • 1807 views

when used timer1 for motor control some time need active low side signal in program with hand not follow pwm out put how to do this

  1. disable all output timer
  2. wait for turn off time
  3. set io bit to active mode (reset or set )
  4. change pinout timer to out put gpio

any one know faster easy way

This topic has been closed for replies.
Best answer by waclawek.jan

You don't need to stop the timer before changing the pin mode to output in GPIOx_MODER.

You can also use some of the FORCED output compare mode, see description of TIM_CCMRx register - but this will maintain the complementary channel in opposite state.

JW

3 replies

waclawek.jan
Super User
May 28, 2020

You don't need to stop the timer before changing the pin mode to output in GPIOx_MODER.

You can also use some of the FORCED output compare mode, see description of TIM_CCMRx register - but this will maintain the complementary channel in opposite state.

JW

omid hamdi
Associate III
May 31, 2020

HI

THANKS YOUR MEANS THIS WAY

 

LL_TIM_ClearFlag_UPDATE( PWMTIMER );

 while ( LL_TIM_IsActiveFlag_UPDATE( PWMTIMER ) == RESET ) ;

LL_TIM_OC_SetMode( PWMTIMER, LL_TIM_CHANNEL_CH1 ,LL_TIM_OCMODE_FORCED_INACTIVE);

LL_TIM_OC_SetMode( PWMTIMER, LL_TIM_CHANNEL_CH2 ,LL_TIM_OCMODE_FORCED_INACTIVE);

LL_TIM_OC_SetMode( PWMTIMER, LL_TIM_CHANNEL_CH3 ,LL_TIM_OCMODE_FORCED_INACTIVE);

FOR ACTIVE LOW SIDE AND AGAIN RETURN MODE PWM

waclawek.jan
Super User
May 31, 2020

If I understand correctly (I don't use Cube/LL), yes, but as I've said, this maintains the complementary channel (CHxN) in opposite state. You may or may not want that, that's upon you.

JW