In this lesson, you will learn how to protect your H-bridge circuitry from catastrophic short-circuits by configuring hardware dead-time generators.
The Shoot-Through Problem
When driving a half-bridge (a pair of high-side and low-side transistors), the goal is to alternate between turning the top switch on and the bottom switch on. However, physical transistors do not switch instantly. If you turn off the high-side switch and immediately turn on the low-side switch, there is a tiny window of time where both are conducting simultaneously. This creates a low-resistance path directly from your power supply to ground, known as a shoot-through current. This "crowbar" effect will likely destroy your MOSFETs and damage your power supply.
Hardware Dead-Time Insertion
To prevent this, we insert a "dead time"—a mandatory delay where both switches are kept in the off-state. While you could implement this in software by adding delays between switching instructions, that is risky; if your code hangs or an interrupt preempts the sequence, the switches might remain in an unsafe state.
Modern microcontrollers handle this at the hardware level using a Dead-Time Generator (DTG) integrated into the PWM peripheral. When the DTG is active, the hardware monitors the transition of your PWM signals. If a signal is commanded to go "high," the hardware automatically delays the rising edge by a pre-calculated number of timer clock cycles.
Implementation Concept
If your PWM timer is running at 100 MHz, each clock tick is 10 nanoseconds. If your MOSFET datasheet specifies a maximum turn-off time of 500 nanoseconds, you must configure the DTG register to delay the signal by at least 50 clock cycles:
// Example: Setting a 50-cycle dead-time buffer
// Ensure the DTG value exceeds the MOSFET switching delay
PWM_Module->DEADTIME_REG = 50;
PWM_Module->DTG_ENABLE = 1;
By offloading this safety-critical timing to the hardware, you ensure that even if the CPU experiences a glitch or a task delay, the hardware logic guarantees that the high-side and low-side transistors can never conduct at the same time.
Key Takeaway: Hardware dead-time insertion is a mandatory safety mechanism that forces a brief, guaranteed off-state for both transistors during switching, effectively preventing destructive shoot-through currents in H-bridge configurations.