Skip to content

Conversation

@tpwrules
Copy link
Contributor

@tpwrules tpwrules commented Nov 29, 2025

Incorporates ArduPilot/ChibiOS#99 , ArduPilot/ChibiOS#100 , and ArduPilot/ChibiOS#101 to fix issues in the SD card drivers which can cause the flight controller to hang (and subsequently watchdog) or the logging thread to fall asleep forever and be unable to recover.

Both results can happen during flight. The former result happens on F4 and F7 only, the latter happens on H7 too. The issues are mostly triggered by an SD card that is rapidly connected and disconnected, such as vibrating in its socket, though random card communication failures could trigger them too. They have existed for a very long time.

Testing was performed on Cube Black (F4), Pixhawk 4 Mini (F7), and Cube Orange (H7). The issues were reproduced using an SD card extender, then deliberately unlocking and carefully wiggling the flat flex cable. After these patches, this can be done apparently indefinitely and the logging thread always comes back and logging restarts after the SD card is securely attached again.

Note that some boards are evidently vulnerable to this wiggling shorting out the SD power rail and resetting the CPU too. Software can't fix that, so vehicles with poor SD card connections need to be fixed properly!

I have not done any sort of "soak" testing, just checked that logging seems to work for a few minutes still. This probably needs a bit of time to bake in master.

Closes #31108 . This PR is ready once the ChibiOS PRs have been merged and the committed hash fixed.

@tpwrules
Copy link
Contributor Author

tpwrules commented Nov 29, 2025

For posterity I used these. The wiggling (and insertion/removal) mangles the flat flex cable's contacts pretty quickly, so it turned out to be a good thing they came in a pack of four!

@tpwrules tpwrules marked this pull request as draft November 29, 2025 23:46
@peterbarker
Copy link
Contributor

For posterity I used these. The wiggling (and insertion/removal) mangles the flat flex cable's contacts pretty quickly, so it turned out to be a good thing they came in a pack of four!

For posterity I paste an iamge of what I got then following your link:
image

I mean, yeah, those do often travel in packs... I assume you were using their tails? Did you tape the flex or use rip-ties? Enquiring minds must know.

@tpwrules
Copy link
Contributor Author

Fixed, oops...

image

@rmackay9
Copy link
Contributor

rmackay9 commented Dec 1, 2025

This is so great to see, thanks @tpwrules!

@tridge
Copy link
Contributor

tridge commented Dec 1, 2025

@tpwrules thanks for this! I'm happy to bring this in for 4.7 before it gets into upstream ChibiOS
I've merged ChibiOS 100 and 101, 99 is pending a squash

Incorporates ArduPilot ChibiOS pulls ArduPilot#99 , ArduPilot#100, and ArduPilot#101 to fix issues
in the SD card drivers which can cause the flight controller to hang
(and subsequently watchdog) or the logging thread to fall asleep forever
and be unable to recover.

Both results can happen during flight. The former result happens on F4
and F7 only, the latter happens on H7 too. The issues are mostly
triggered by an SD card that is rapidly connected and disconnected, such
as vibrating in its socket, though random card communication failures
could trigger them too. They have existed for a very long time.

Testing was performed on Cube Black (F4), Pixhawk 4 Mini (F7), and Cube
Orange (H7). The issues were reproduced using an SD card extender, then
deliberately unlocking and carefully wiggling the flat flex cable. After
these patches, this can be done apparently indefinitely and the logging
thread always comes back and logging restarts after the SD card is
securely attached again.

Note that some boards are evidently vulnerable to this wiggling shorting
out the SD power rail and resetting the CPU too. Software can't fix
that, so vehicles with poor SD card connections need to be fixed
properly!
@tpwrules tpwrules marked this pull request as ready for review December 1, 2025 03:04
@tpwrules
Copy link
Contributor Author

tpwrules commented Dec 1, 2025

ChibiOS PRs merged, this one is ready now.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Watchdog Reset Caused by Slow SD Card or Removal (Possibly Intermittent connection) During Flight

4 participants