stspin32g4: Add bootstrap capacitor charge mode on enable to avoid high side UVLO error on enable#72
stspin32g4: Add bootstrap capacitor charge mode on enable to avoid high side UVLO error on enable#72Moddingear wants to merge 1 commit intosimplefoc:devfrom
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.
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.
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.