There seems to be a way to hang the control code and I'd like to find out if my approach is causing it.
To get this hang, I first clear gMotorVars.Flag_Run_Identify while the motor is spinning. My inertia and the coast mode means the motor spins down over a few seconds. If I set gMotorVars.Flag_Run_Identify with a target speed lower than the current speed, the system usually becomes unresponsive. I have not seen this behavior when the target speed (gMotorVars.SpeedRef_krpm) is set to a value higher than the current coasting value.
In this hang, both gMotorVars.Flag_enableSys and gMotorVars.Flag_Run_Identify are still set and there is no UserErrorCode or VelCtlErrorID. This problem happens on debug and flash runs and a restart is enough to bring the system back.
Note, I set gMotorVars.Flag_enableSys = true by default and the user flips a switch that sets gMotorVars.Flag_Run_Identify to start the system. Not sure if this is relevant or the best intended customer interface.