The main loop stood still for half a second
What ArduPilot says:
- Internal errors 0x8000 (main_loop_stuck)
The main loop reads the sensors and drives the motors hundreds of times a second. A separate monitor looks every 100 ms whether it is still running. After 200 ms without it, the monitor starts writing what the loop was doing into the log (MON messages); after 500 ms, unless ArduPilot expected the delay (erasing flash, a calibration), it records main_loop_stuck. The l: number is then the source line where the main loop was waiting for a lock. If the loop stays stuck, the watchdog restarts the board.
What to do, most likely first
Lua scripts run at a raised priority and keep the processor from the main loop.
Check
SCR_THD_PRIORITYis not 0. Stop the scripts and see whether the error still comes.FixSet
SCR_THD_PRIORITYback to 0 (Normal) and reboot.Two parts of the firmware wait for each other (a deadlock): a bug, more likely in a beta or custom build.
Check“CRITICAL Deadlock …” may appear with it. Note the l: number and what you were doing: a parameter download, a log download, a calibration.
FixUse the stable release and report the line, the log and the steps to the ArduPilot developers.
A sensor or storage device answers so slowly that the loop waits on it.
Checkspi_fail or i2c_isr is in the same mask, or the error stops when a device is unplugged.
FixReplace that device or its cable.
Half a second without control is enough to lose a copter. Do not fly until you can run a whole battery on the bench, props off, without it.
Parameters to look at
| Parameter | What it is |
|---|---|
SCR_THD_PRIORITY | Scripting thread priority |
BRD_OPTIONS | Board options |
Where to do it:Setup & Tuning GuideLua Applet Catalog