Skip to content

dronecan: log cumulative bus-off count to blackbox slow frame - #11729

Draft
daijoubu wants to merge 1 commit into
iNavFlight:maintenance-10.xfrom
daijoubu:feature/canbus-errors-blackbox
Draft

dronecan: log cumulative bus-off count to blackbox slow frame#11729
daijoubu wants to merge 1 commit into
iNavFlight:maintenance-10.xfrom
daijoubu:feature/canbus-errors-blackbox

Conversation

@daijoubu

@daijoubu daijoubu commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds droneCANBusOffCount to the blackbox slow (S) frame, sourced from the existing dronecanGetBusOffCount() counter, so intermittent CAN bus faults are diagnosable from flight logs instead of requiring a live dronecan CLI session.

Changes

  • New droneCANBusOffCount field in the blackbox S-frame (UNSIGNED_VB, PREDICT(0)), gated behind USE_DRONECAN
  • Follows the same pattern as the existing escRPM/escTemperature fields (field table row, struct member, write, load)

Testing

  • Built KAKUTEH7WING (H7), SPEEDYBEEF405WING (F4), MATEKF765SE (F7), IFLIGHT_BLITZ_ATF435 (AT32), and SITL
  • Flashed to KAKUTEH7WING hardware and recorded a blackbox log during a bench test session
  • Decoded the log with blackbox_decode --debug: the new S-frame field decodes correctly and at the expected byte length across all 214 slow frames in the log
  • Confirmed the counter tracked real CAN bus-off events during the session, incrementing 0 → 1 → 2 monotonically in step with actual bus faults

Code Review

Reviewed with inav-code-review agent — no CRITICAL or IMPORTANT issues found.

Dependency

This branch is stacked on #11607 (DroneCAN: Fix H7 FDCAN and F7 bxCAN driver configuration), which is still open. Only the most recent commit (dronecan: log cumulative bus-off count to blackbox slow frame) is new here — the diff currently includes #11607's commits too, until that PR merges and this one rebases onto maintenance-10.x directly.

Do not merge before #11607.

@sensei-hacker

Copy link
Copy Markdown
Member

Just an FYI for contributors: The tentative schedule for INAV 10 is to have a full release in mid December. That means RC2 needs to be in early to mid November, which places INAV 10.0RC1 at September 1. Please plan to have any new features for INAV 10.0 ready for RC1 no later than September 1. After that, 10.1 will follow about six to seven months later.

@daijoubu
daijoubu force-pushed the feature/canbus-errors-blackbox branch from 17d2370 to 5fa94cb Compare August 18, 2026 03:12
Adds droneCANBusOffCount to the blackbox S-frame, sourced from the
existing dronecanGetBusOffCount() counter, so intermittent CAN bus
faults are diagnosable from flight logs instead of requiring a live
`dronecan` CLI session. TEC/REC/LEC/state and RX-drop-count were
considered and dropped/deferred (see PLAN.md) as poor fits for the
slow frame's throttled, change-triggered sampling model.
@daijoubu
daijoubu force-pushed the feature/canbus-errors-blackbox branch from 5fa94cb to ece7fb2 Compare August 23, 2026 05:13
@github-actions

Copy link
Copy Markdown

RAM / Flash usage vs. base branch — commit ece7fb2

Target Flash Δ RAM Δ
MATEKF405 ±0 B (±0.00%) ±0 B (±0.00%)
MATEKF722 ±0 B (±0.00%) ±0 B (±0.00%)
MATEKF765 ±0 B (±0.00%) ±0 B (±0.00%)
MATEKH743 +24 B (+0.00%) ±0 B (±0.00%)

See RAM/flash optimization guide for techniques to reduce usage.

@github-actions

Copy link
Copy Markdown

Test firmware build ready — commit ece7fb2

Download firmware for PR #11729

245 targets built. Find your board's .hex file by name on that page (e.g. MATEKF405SE.hex). Files are individually downloadable — no GitHub login required.

Development build for testing only. Use Full Chip Erase when flashing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants