-
Notifications
You must be signed in to change notification settings - Fork 93
stspin32g4: Add bootstrap capacitor charge mode on enable to avoid high side UVLO error on enable #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
…gh side UVLO error on enable
|
Memory usage change @ 28242ce
Click for full report table
Click for full report CSV |
|
Thank you for contributing this. I remember the discussion on Discord. I'd like to understand the rationale a little better:
so it seems pre-charging the bootstrap capacitors is a valid strategy for some use-cases.
|
| for (size_t i = 0; i < num_phases; i++) | ||
| { | ||
| phase_state[i] = phase_state_before[i]; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we should add another setPwm here to actually apply the restored phase state.
But I'm also wondering about the purpose of remembering and restoring at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, a SetPWM should probably be called, I figured it wouldn't hurt to leave it in the charge state...
As for remembering and restoring, the logic was that this code would leave the driver in the same state as it found it, and would skip charging if it was already activated...
This overrides the enable sequence on the stspin32g4:
The capacitors for the high side FETs need to be charged to drive the outputs high. Capacitors are charged by driving the low side mosfets ON.
If the voltage on the bootstrap capacitor goes below 5V while asking for the high side mosfet to be ON, this causes an undervoltage lockout on the high side FET, making them not conduct.
The high side UVLO isn't communicated back to the driver, as it's floating circuitry. But the Vds protection kick in, causing an error and disabling everything.
This adds a time when enabling where all the low side FETs are enabled, allowing for the caps to charge.