Skip to main content
NewEpisode 8a is out: Two state machines 1: rising edgeWatch →

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 parts
Foundations · 5b

BSP 2: after the PWM switches off

Episode 2's trip followed to the end: a 0.5 N·m load beats the 0.325 N·m the motor can make, at 837 ms it spins backwards at −7225 rpm, and the over-speed check in the 1 ms task sets 0x0040. Then down the call chain, no lines skipped: AppStatusScanSlow → set_app_Controlword(0) → motor_enable → the state machine goes to DISABLE with 0 V on all phases → motor_ctl_loop.c line 237 bsp_set_pwm_state(). The board clears MOE and opens all six switches; the SIL just returns and keeps handing 0 V to its motor, a short circuit: 52.6 A in U, an extra over-current bit for 0x4040, a brake to −618 rpm. The board, worked out from the code: a 43.7 V line peak below the bus, no current, only 0x0040. Then PWM-ready is always true on Y01, and the temperatures, errors, brake and timing the SIL fakes.

Up next5c · BSP 3: when the bus voltage falls→