This part is for members
Membership opens soon. Leave your email and we'll tell you the day it does. Founding members get the launch price.
Keep watching the free partsThe current loop 6: dead time
The last stop of the current-loop pipeline: dead-time compensation after SVPWM. Y01's TIM1 dead time is 25 counts (104 ns at 240 MHz) in a 12000-count period, so each phase loses 48 × 25 / 12000 = 0.10 V on average on 48 V, always against the current (the clock cancels out). The SIL's virtual motor has no inverter, so this episode adds a labelled dead-time model. Running example: speed mode at 300 rpm, a light 0.28 A. With comp_du_V at 0 (Y01) the q integrator quietly carries 0.126 V more (4/π × 0.10 = 0.127 by hand), leaving 5th and 7th harmonics of 16.6 mA: six small bumps per electrical turn. The compensation function current_ctl_loop_task_deadband_comp_ua line by line: a ramp within ±2·i_noise, the full comp_du outside it, added to u_tar; comp_du_V has four writers (MotorCtlSmInit's 0.35, the header's 0, flash, MAVLink). With 0.10 the integrator comes back but the light-load harmonics stay (the ramp covers 26 % of the time); at 1 A they drop to 2.7 mA. With 0.35 it is worse than none, and at light load the loop oscillates on its own at 400–500 Hz, set only by the net overcompensation. Another bus needs another value: comp_du_V = bus × dead-time counts / period counts. The trap (a real run): i_noise 0 switches the voltage off, not the compensation: 0 V on all phases for 5 s, the load drives the rotor to −10 rpm, no error. The fix is on the fork's branch fix/i-noise-zero-output. Your turn: the right value on 36 V.