What the stock flight layer does with PSOC board error 8 and 9
Static read, one agent, 2026-10-04. Status of this file: Agent-cited, with two routines re-read by the session that commissioned it: the helper at
0x444800(returns 1 for errno 2 to 5, computed as(errno-2) <= 3unsigned) and0x45aab0(returns 0 when that helper says 1, otherwise(status-3) <= 1). Those two are what separate errors 8 and 9 from errors 2 to 5 for the “motors spinning” word, and they match the report exactly. Every other row, including the Emergency wiring and the takeoff path, was not re-derived. Nothing here touched the aircraft.
Static analysis of firmware/extracted/bebop-2-4.7.1/rootfs/usr/bin/dragon-prog (ELF vaddr = file offset + 0x10000 in text). Disassembly from the scratchpad dp.dis, plus small Python scans over it. No hardware, no mcbebop, no git writes.
Status tags: Verified = I read the instructions in this session. Agent-cited = taken from an earlier note or agent, not re-derived. Inference = my reading that goes beyond the bytes. Open = not determined.
Summary answer (5 lines)
Section titled “Summary answer (5 lines)”- In flight, error 8 or 9 is reported and logged only: the HAL forwards {motor mask, errno} as a message, which becomes an app alert (MotorErrorStateChanged) and a blackbox record. No stop, land, emergency, or retry was found for either error while the motors are spinning (Verified for the consumers listed below, not exhaustive).
- The flight state machine reads only five HAL result words (sample+0x624, 0x628, 0x62c, 0x630, 0x634). The “motors spinning” word (0x630) is cleared only by errno 2 to 5 or a board status other than 3 or 4, so 8 and 9 leave it set; the “healthy” word (0x634, zero for any non-zero errno) has exactly one reader, which only fires a Piloted-POI-stopped notification.
- For contrast, errno 2 to 5 (including the HAL’s own synthetic errno 4 after 200 failed polls) clears 0x630, and every flying state then posts FSM event 0 with cause bit 4. Event 0 is wired to the Emergency state from every flying state, and Emergency entry writes command type 2 (stop).
- At takeoff it is different: the start path sends clear_error (0x80) first, then refuses to start if errno is still non-zero. That sets start progress to 0, and WaitMotorRamping then posts event 0 (Emergency) because the motors are not spinning. So an 8 or 9 that is present at start aborts the takeoff into Emergency; the only “retry” is the 0x80 sent before each start attempt.
- The decision logic is hard-coded (state and transition tables built in the constructor at 0x1536d4); no key in
etc/colibry/*mentions motor errors. Not enumerated: whole-struct copies of the HAL sample (loggers, API input dumps), the setters and getters ofmotorStartTryCountandtakeoffFailed, and the triggers of FSM events 46 and 47.
Evidence table
Section titled “Evidence table”A. HAL side (poll to result words)
Section titled “A. HAL side (poll to result words)”| Address | Instruction or string | What it shows | Status |
|---|---|---|---|
| 0x444bac (call at 0x45ba60) | [20][01] poll, 19-byte reply |
the poll is made once per read(); errno goes to ctx+0x2e, status to ctx+0x30, mask to ctx+0x33 |
Agent-cited (earlier note), call site Verified |
| 0x45bab0, 0x45bab4 | bl 0x45aab0 then str r0,[r5,#0x630] |
sample+0x630 is written every read | Verified |
| 0x45aab0 and 0x444800 | ldrb r4,[r0,#0x30]; helper ldrb r0,[r0,#0x2e]; sub r0,r0,#2; cmp r0,#3; result is status-3 <= 1 |
0x630 = 1 only if status is 3 or 4 AND errno is not in 2..5. Errno 8 and 9 do not clear it | Verified |
| 0x45babc, 0x45aae0, 0x45aafc | ldrb r3,[r0,#0x2e]; cmp #0; bne -> mov r0,#0; else status-6 != 0 |
0x634 = 1 only if errno == 0 and status != 6. Any non-zero errno (8 and 9 included) makes it 0 | Verified |
| 0x45bacc, 0x45afe0 | flag from status and stop-progress: status 1 gives 1; status 0 or stop-progress 2 gives 2; else 0 | 0x62c is a “stopped” word. It does not look at errno | Verified |
| 0x45bb8c, 0x45bc8c, 0x45be10 | str r0/r3/r2,[r5,#0x624] |
0x624 = start progress. Start refusal stores 0 at 0x45bc8c | Verified |
| 0x45bc68, 0x45bc7c..0x45bc8c | bl 0x45ac58; if result != 1: mov r3,#0; str r3,[r7]; strb r3,[r4,#0x57]; str r3,[r5,#0x624] |
allow-start refusal clears the pending command and reports start progress 0 | Verified |
| 0x45ac58 (0x45acb4 to 0x45ad54) | allow-start returns 1 only when errno == 0 (status 1 or 2); errno 10 or 11, status 6, and any other non-zero errno return 0, the last with the “Errno not cleared” log | errno 8 and 9 refuse a start | Verified for the branch structure, message text Agent-cited |
| 0x45b744..0x45b77c | start command (type 1): str 3,[r7,#0x628]; bl 0x444788 (clear_error 0x80); sets flag +0x57 |
clear_error is sent first on every start | Verified |
| 0x45b510 (stores 0x45b55c..0x45b600) | fills the sample from the HAL context: speeds at about 0x608, flag and PWM byte arrays at about 0x610 to 0x617, per-motor errno (errno if the mask bit is set, else 0) at about 0x618 to 0x61b, status copy at about 0x61c to 0x61f, temperature u16 at 0x638, battery float at 0x640 | the raw error byte, state byte, saturation flags and temperature are all copied into the sample. Exact lane order not re-derived (post-decrement indexing) | Verified for the stores, lane order Open |
| 0x45bcb8..0x45bcd4 | errno := 4, mask := 15, strb 4 at sample+0x618..0x61b when the failed-poll counter exceeds 199 |
synthetic comm-lost errno is in the 2..5 set, so it clears 0x630 | Verified |
0x43fc40 (tail-branches to a stored function pointer), setter 0x43fc28, only caller b 0x43fc28 at 0x70374 with r1 = 0x70348 |
HAL message hook has one registered callback | all HAL messages go to 0x70348 | Verified |
0x70348..0x70360, 0x67ec4 (mbox_push at 0x67f58) |
wrapper passes r1 = #16 and posts to the behaviour mailbox |
HAL message becomes mailbox type 16 | Verified |
0x70444 (type test at 0x704a4, id test sub r3,r3,#10; cmp #5 at 0x70500..0x70510), 0x70718 |
type 16, id 10 jumps to 0x70718: loads payload bytes [mask, errno], calls 0x5eca8, then name lookup, snprintf, estimate getters, 0x758e0 |
the id 10 handler | Verified |
| 0x5eca8 call list | ARCOMMANDS_Generator_GenerateARDrone3SettingsStateMotorErrorStateChanged (0x5ed3c), 0x623a0 send (0x5edb8), ulog only |
app alert; no control call | Verified (call list only; body not read line by line) |
| 0x758e0 call list | mutex, snprintf, access, fopen, fprintf, vfprintf, fclose, opendir |
blackbox file write; no control call | Verified (call list only) |
B. Flight layer consumers of the HAL result
Section titled “B. Flight layer consumers of the HAL result”How the sample reaches the state machine (Verified): the per-sample entry at 0x103e78 stores its sample argument into the hub object at [hub+8] (str r9,[r0,#0x8] at 0x103f1c, hub getter bl 0x103820) and copies the 64-bit time at sample+8 into hub+0x40 (0x103f2c). The HAL writes the same timestamp to sample+8 (strd r0,r1,[r8,#8] at 0x43ca2c). So bl 0x103820; ldr r3,[r0,#8]; ldr rX,[r3,#N] in the state code means “read sample field N”.
| Address | Instruction or string | What it shows | Status |
|---|---|---|---|
Scan over 0x100000..0x440000 for bl 0x103820; ldr r3,[r0,#8]; ldr rX,[r3,#imm] |
immediates seen: 0x14c once, 0x624 x2, 0x628 x1, 0x630 x23, 0x634 x1, nothing else | the state code reads only these four result words (plus 0x62c via a variant at 0x232170) | Verified (scan I ran; positive control below) |
| Positive control for that scan | the same scan finds all 23 readers of 0x630, which I then opened (0x2305b4, 0x2312b4, 0x233e08, 0x23c204 and so on) | the search can find consumers. A second scan (add rX,rY,#1536/#1552/#1568 then a load) separately finds SensorBLDCProcessing at 0x3aca98 |
Verified |
| 0x3aca84 (SensorBLDCProcessing helper, vtable 0x579c30 slot 4; duplicate at 0x3acb1c) | reads u16 at base+0x608.., bytes at base+0x614..0x617, and the int at base+0x62c; outputs floats, writing 0.0 when 0x62c > 0 | the only sensor process that takes the BLDC result; it never reads errno, status, or the per-motor errno bytes | Verified |
| 0x4177ec (BLDCMotorController, vtable 0x57a000 slot 5) | converts four input floats to u16 and stores them; no read of the HAL result | the motor controller does not consume the HAL result | Verified |
| 0x2305b4 and the 22 other 0x630 readers (states: Landing 0x2304e8, TakeoffGround 0x231298, DemoMagicCarpet 0x2319d4, Animation 0x232470, PilotedPOI helper 0x233348, FollowMe 0x233c98, ReturnHome 0x234ca0, EmergencyLanding 0x235750, LandingGps 0x23682c, TakeoffFlying 0x237880, LandingFlying 0x237f58, Flying 0x2389ec, RelativeNavigation 0x239288, LookAtMe 0x23a060, FlyingThrottle 0x23aa4c, Takeoff 0x23b1f0, GoToFix 0x23b97c, Hovering 0x23c1d8, HoveringGps 0x23c948, NavGps 0x23da18, WallLock 0x23e848, HoveringRescue 0x22f580) | all follow one template: if the value is 0, bl 0x103820; mov r3,#4; str r3,[r0,#0x7d0], then bl 0x1036a8; mov r1,r4 (= 0); bl 0x152398. Example 0x2305b4 to 0x2305d4 |
not spinning posts FSM event 0 with cause value 4 stored at hub+0x7d0 | Verified |
0x2305dc, 0x230608, and 59 similar ldrb [hub,#0x45d] |
same template: if hub+0x45d is set, str 2,[hub+0x7d0] and post event 0 |
a second, separate path to event 0 (value 2), not driven by the HAL result | Verified (reads of 0x45d); meaning of 0x45d Open |
| 0x152398 | takes the lock at r4+8 and appends the event id to a queue | event post | Verified (head of function) |
0x152c00 call list in the constructor 0x1536d4..0x15b58c (231 calls, decoded by a script that tracks ldr rX,[r4,#off], mov rX,#imm) |
from X ev 0 to Emergency for TakeoffGround (0x154a44), Takeoff (0x154bac), TakeoffFlying (0x154e04), Hovering (0x155188), Flying (0x1554d0), WaitMotorRamping (0x1557a0), WaitThrownTakeoff (0x155ee4), HoveringRescue (0x15604c), DemoMagicCarpet (0x1561b4), Landing and others; Emergency ev 1 to Landed (0x1548a0) |
event 0 leads to Emergency from every flying state. The roles of r1, r2, r3 in 0x152c00 (from, event, to) follow from it checking that both r1 and r3 are registered states (0x152c30..0x152c64) | Verified for the table; the argument roles are Inference from that membership check |
| Emergency vtable GOT slot 0x57bf88, literal load at 0x154168, stored at [mgr+0x88] | the object in the manager at +0x88 is ControlStateEmergency | identifies the target of the table above | Verified |
| 0x232080 (ControlStateEmergency vtable 0x578760, entry function) | str 3,[sample+0x62c] (0x23209c), str 3,[sample+0x628] (0x2320a8), ldr r3,[hub+0xc]; mov r2,#2; str r2,[r3] (0x2320b0..0x2320b8) |
Emergency entry forces the stop-requested words and writes command type 2 into the word at hub+0xc | Verified for the stores |
| hub+0xc = HAL motor command struct | str r10,[r0,#0xc] at 0x103f24; WaitMotorRamping entry stores 1 there (0x23e3ec) and its start-OK branch stores 3 (0x23e2ac); the HAL write path switches on type 1 (0x45b744), 2 (0x45b7b0), 3 (0x45b82c) |
the type values match the HAL’s start, stop and speed. Emergency therefore sends the 0x60 stop frame via the HAL write path | Inference (types match; I did not trace r10’s origin) |
| 0x14d970 | bl 0x152398 with r1 = 0 then str 1,[hub+0x7d0] |
user emergency command uses the same event 0, cause value 1. Supports “event 0 = Emergency” | Verified; the caller is Open |
| 0x103a6c | builds a status bitmask from hub+0x7cc and hub+0x7d0 and sends it as event id 50 | cause values 1, 2, 4 and so on are bit flags reported outward | Verified |
| 0x233348 (PilotedPOI helper), reads at 0x2333f0 (0x630) and 0x233470 (0x634) | if 0x630 == 0: cause 4, event 0. Else if 0x634 == 0: bl 0x150c2c with r1 = 34 and r2 = r3 = 0, then it falls into the same hub+0x45d check that the healthy path takes |
the only reader of the “healthy” word. Unhealthy adds one hook call (id 34) and nothing else. Id 34 maps to COLIBRY_EVENT_MSG_PILOTED_POI_STOPPED by string order | Verified for the code; the id-to-name mapping is Inference (order of the name table at 0x4a12a8) |
| 0x23e230 (WaitMotorRamping process, vtable 0x578b80 slot 4) | reads 0x624 into r5 and 0x630 into r6. r5 == 0: if r6 == 1 post event 20 else post event 0. r5 == 1: store type 3, post event 20 | start refused (progress 0) with the motors idle posts event 0, which the table sends to Emergency. Event 20 goes to TakeoffGround (0x1557dc) | Verified |
| 0x23d4bc (WaitMotorBraking), 0x23f10c (WaitThrownTakeoff), 0x22f580 (HoveringRescue) | read 0x628 or 0x624 with 0x630 | stop-progress and start-progress handling in those states; errno is not read | Verified (reads), full logic not traced |
| 0x232160 (Emergency helper), read at 0x232170 | ldr r3,[r3,#0x62c]; 0 posts event 0 (0x2321f8), 1 runs the “motors stopped” cleanup, other values return |
Emergency waits on the stopped word | Verified for branch shape |
C. Data-driven or configuration check
Section titled “C. Data-driven or configuration check”| Item | Result | Status |
|---|---|---|
grep -i 'bldc|motorStartTry|takeoffFailed|errno|motor_error' over rootfs/etc/colibry (common and milosboard) |
one hit: common/root.cfg:27, BLDCMotorController = "minimal" in the “fvt” log-level table. It sets a log level only |
Verified |
common/states.cfg, milosboard/states.cfg, common/event.cfg, milosboard/event.cfg |
no key that mentions motor errors. Closest: waitAfterBrakingFinishedDuration = 2.2, enableTakeoffGndFailureDetection = false, the cut-out filter keys |
Verified |
| Transition table and state list | built in code in the constructor at 0x1536d4 (see 0x152c00 rows above); not read from a file | Verified |
What was not enumerated
Section titled “What was not enumerated”- Any consumer that receives the whole HAL sample or result by pointer and copies or logs it as a block (the Colibry logger with
api_input = true, input dumps, the 23 template instantiations that registerhal.HAL_BLDC_resultby name). My scans cover direct immediate offsets 0x600 to 0x61f and 0x638 to 0x648 outside the HAL range, theadd rX,rY,#1536/#1552/#1568forms, and the[hub+8]pattern. A consumer that gets a pointer, adds a small offset, and then indexes would not match. - The per-motor errno bytes (about 0x618 to 0x61b), the status copy, the saturation flag bytes (about 0x610 to 0x613), temperature (0x638) and battery (0x640, 0x644): no consumer was found by those scans. That is a scan result, not a proof of absence for every access form.
- Other Colibry processes’ Input structs (ESCMotorModel, BatterySensorProcessor, estimators) beyond SensorBLDCProcessing. They were not opened individually.
- Where
motorStartTryCountandtakeoffFailedare written and read. They are names in the Colibry input registration (0x4b478c, 0x4b47bc, function 0x202fc8); I did not find their setters or getters. - The triggers of FSM events 46 (Emergency, posted at 0x14e6ac) and 47 (EmergencyLanding, posted near 0x22d1e8 with cause value 8). A quick look shows they read hub fields (for example hub+0x2c8) and not the HAL sample words, but I did not trace their upstream sources.
- The meaning of hub+0x45d (cause 2 path) and of the hook id 34 callback body.
- Other processes that could stop the motors (watchdogs, reboot paths, the app side,
flash_bldc); this was limited todragon-prog. - Board behaviour. That errors 8 and 9 do not leave the closed loop (so status stays 3 or 4 and 0x630 stays 1 while one is latched) and that 0x80 clears errno except 10 and 11 or state 6 come from HARDWARE_REVERSE_ENGINEERING.md 11m and
bldc-cyacd.mdline 77 (Agent-cited, not re-read for this report).
Open questions
Section titled “Open questions”- Does the board actually keep status at 3 or 4 while 8 or 9 is latched in flight? If a status change ever accompanied them, 0x630 would clear and the flight layer would go to Emergency for a reason that has nothing to do with the error number. Needs the board-side read of the state byte, which 11m only addresses for the loop exit condition.
- Are the three words 0x624, 0x628, 0x62c overwritten each HAL cycle after Emergency or WaitMotorRamping store 3 into them? The HAL rewrites 0x62c, 0x630, 0x634 at 0x45bab4..0x45bad0 and 0x624 and 0x628 on other paths, so the forced values look transient, but the ordering between the Colibry write and the next HAL write was not traced.
- At takeoff, does the 0x80 clear plus the next poll normally remove a latched 8 or 9 before the allow-start check? For 8 it depends on the die temperature still being in window at the next sample; for 9 on the voltage counter. This decides how often the start refusal path (and so Emergency at takeoff) is reached with 8 or 9.
- What posts event 46 and 47, and does either depend on the HAL result through a path my scans did not match (for example battery or angle only)?
- Is hub+0xc (command struct, type 2 on Emergency entry) the same object the HAL write path reads as
r7/r2inHAL_BLDC_mykonos3_write(0x45b618)? The type values agree; the pointer identity was not followed back to r10 at 0x103e78. - What does hook id 34 do on the receiving side (does it only tell the app that the Piloted POI stopped, or does it also act on the unhealthy flag)?
Method notes
Section titled “Method notes”- Scratch files:
ins.pkl(parsed instruction list),xr.pkl(string cross references and function starts),d.sh(disassembly slicer). The transition decode is a script, not hand reading; each row can be re-checked by opening the listedbl 0x152c00address. - The earlier note
dragonprog-motor-hal.mdlisted 0x630 as “spinning-ish” and 0x634 as “errno == 0 and status != 6”. Both agree with what I read. It did not give the errno-in-2..5 exclusion for 0x630 (helper 0x444800), which is what separates errors 8 and 9 from errors 2 to 5.
Comments
Spotted a mistake, or tried this on your own Bebop? Leave a note. Comments are kept on this site's own server.