Quote:
Originally Posted by Gdeaver
I don't Know if this affects the discussion, but I believe a high side FET is left on durring the PWM off period.
|
Uh, no. The low side MOSFET is turned on and the opposite high side MOSFET is turned on and off in proportion to the desired output. This is all done in hbridge.c. For example, the code to make M+ positive and M- GND is..
//
// Update the generator registers with the required drive pattern.
//
HWREG(PWM_BASE + M_MINUS_CTRL_GEN) = LO;
HWREG(PWM_BASE + M_MINUS_PWM_GEN) = ON;
HWREG(PWM_BASE + M_PLUS_CTRL_GEN) = HI;
HWREG(PWM_BASE + M_PLUS_PWM_GEN) = PULSE;
..where HWREG() is a macro that dereferences the unsigned long value pointed to by the BASE+OFFSET, in this case registers within the PWM[*] unit. The defines ON, LO, HI, and PULSE are predefined values for the PWM's[*] GeneratorA/B registers.
What the code above says is to set the control input of the M- gate driver to 0 and set the enable to be 1, making the output turn on the low side MOSFET of M-. The next two lines turn on the control input of the M+ gate driver,
BUT to PWM the enable. This pulses the high side MOSFET of M+.
The reverse direction is similar, but reversed.
-Scott
[*] It is important to remember that there are (unfortunately) two things referred to as PWM: the 3-wire hobby servo signal, and the functional unit in the MCU that controls the HBridge. For this note's purposes I strictly refer to the latter. The pulse-width modulating of the HBridge.