You are here

VESC hw_60 invert PWM.

1 post / 0 new
_johnny_
Offline
Last seen: 7 months 3 days ago
Joined: 2019-09-17 12:12
Posts: 3
VESC hw_60 invert PWM.

Hi, i building my custom VESC and i used inverting optocoupler to driving mosfets, so i try to modifiy init timers code in mcpwm.c as follow:



    // Channel 1, 2 and 3 Configuration in PWM mode

    TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;

    TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;

    TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable;

    TIM_OCInitStructure.TIM_Pulse = TIM1->ARR / 2;

    TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low;

    TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_Low;

    TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;

    TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCNIdleState_Set;

but mosfets in idle state are enabled.

How do i make this properly?