cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f303 timer1 motor control

omid hamdi
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

3 REPLIES 3

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
Senior

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

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