2023-03-21 03:23 AM
Hello everyone
In my Motor Control application I use low side active low gate driver L6398. Because of the shortage of this component, we need to use L6399 in which low side gate driver is active High.
We developed application using Motor Control Suite (5.4.1), and we use STM32F303 uC.
I've tried to change polarity of the CHxN in MX_TIM1_Init() but it doesn't work: every time a start the motor I get Over current error. The changes I made are in bold
Before (L6398 Gate Driver)
sConfigOC.OCNPolarity = TIM_OCNPOLARITY_LOW;
After (L6399 Gate Driver)
sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH;
Obviously I change polarity for all 3 channel.
I've tried to change Idle state too from
sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_SET;
to
sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET;
but never changes.
Do I have to change something else? Do I have forgot some other changes to do?
Many thanks
Roberto
2023-03-21 06:13 AM
Hello everybody
There was an hardware error that caused the issued. Now it works if I change polarity. There's only one more question: when I stop the motor, OverCurrent happens. I think it depends on how to configure Stop PWM state.
Roberto
2023-03-23 05:12 AM
Hello everyone
I found the problem: in TIM1 init there was this code lines
sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET;
sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET;
sBreakDeadTimeConfig.OffStateIDLEMode = TIM_OSSI_ENABLE;
So if we set MOE bit to 0, I expect that CHx and CHxN channels would be Reset (low). This doesn't happen because in R3_2_SwitchOffPWM() function, there's this line of code
TIMx->BDTR &= ~( ( uint32_t )( LL_TIM_OSSI_ENABLE ) );
that Disable TIM_OSSI bit.
So I've searched for snippet in which TIM1 GPIO were setted because I had suspect that there was some pullups, and I find it in HAL_TIM_MspPostInit().
I changed
GPIO_InitStruct.Pull = GPIO_PULLUP;
to
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
and the trick was done.
Hope it can be helpfull
Roberto