circuitpython: Crash into the HardFault_Handler.
CircuitPython version
Adafruit CircuitPython 7.2.0 on 2022-02-24; FeatherS2 with ESP32S2
Board ID:unexpectedmaker_feathers2
Code/REPL
[13:52:08.944] Disconnected
[13:52:09.951] Warning: Could not open tty device (No such file or directory)
[13:52:09.951] Waiting for tty device..
[13:52:11.976] Connected
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Crash into the HardFault_Handler.
Please file an issue with the contents of your CIRCUITPY drive at
https://github.com/adafruit/circuitpython/issues
Press any key to enter the REPL. Use CTRL-D to reload.
Behavior
This code runs fine most of the time, successfully reading from sensors, reporting values to HomeAssistant via MQTT and activating the SERVO however it has been crashing at what seems to be random intervals, so to find out what was going on I left it plugged in to my computer for a couple of days with the REPL running (via TIO) and it finally crashed again with the error CircuitPython core code crashed hard. Whoops!
and asked me to share the contents of my CIRCUITPY drive here (attached below with credentials removed from secrets.py).
I don’t believe it to be a memory issue as I have actually been logging the free memory via gc.mem_free()
to HomeAssistant along with the sensor values (seemed like a good way to rule out that as a problem) and memory usage has been relatively consistent over its last run (aside from the big dip overnight, I don’t know why that is!)
It wouldn’t surprise me if it’s something wrong with my code because I’m not an engineer and mostly bodge together other code from tutorials around the internet etc.
Description
No response
Additional information
My circuitpython drive contents with secrets removed: CIRCUITPY.zip
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (2 by maintainers)
Just realised I’m running an older version of CircuitPython… would it make sense to start by upgrading the version and libraries to latest?
#7490 is open for better crash data capture and would help here it seems.
Helping beta test this one on the UM FeatherS2 with AndyWarburton.
Closest I can come is AdafruitIO with a DPS310 temp sensor. Your motor driver, other specific sensors, and home assistant broker I can’t replicate on my setup.
I had the same issue with the UM FeatherS3 (which that issue is now closed), It was specific to the S2 & S3 chips running Circuit Python. Happened with both Adafruit & UM boards in 7.3 and 8.x beta. Had something to do with Wifi triggering soft reboot and crashing after an unspecified and random period of time. Without Wifi it would work fine.
The hard fault handler issue has been resolved to my knowledge on the S2 since 8.0.4 beta and on the S3 since 8.0.5 stable. This will be my first attempt at running a UM board again since the 8.0.1 beta. So far it’s behaving very well with Wifi and running as expected.
If you are running anything prior to 8.0.5 stable release yes you would absolutely have experienced hard faults. Since it’s been resolved on the Adafruit S3 I have high hopes the UM boards will now be usable on Wifi going forward after 8.0.5 stable release.
One of the downsides (if you can call it that) is the massive amount of RAM. If there is a RAM leak with a slowly updating script it could take days/weeks for it to crash. I don’t expect that to happen but it’s something to keep in the back of your mind.
CIRCUITPY.zip Including my script loosely based on yours. It’s the closest I can get as you have a very specific setup. Will run this in the background with you for a couple days. Updating every 10 seconds to AdafruitIO so if there is an issue it will crop up faster.
Yes, please do.