Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard fault: memory access or instruction error #9576

Open
Hobbes4Pres opened this issue Aug 29, 2024 · 1 comment
Open

Hard fault: memory access or instruction error #9576

Hobbes4Pres opened this issue Aug 29, 2024 · 1 comment
Labels
bug needs retest network rp2 Both RP2 microcontrollers
Milestone

Comments

@Hobbes4Pres
Copy link

Hobbes4Pres commented Aug 29, 2024

CircuitPython version

Adafruit CircuitPython 9.1.2 on 2024-08-22; Raspberry Pi Pico W with rp2040

Code/REPL

Sourcecode for Python is in my public repository at 

https://github.com/watermark-woods/GateController/blob/main/code.py

It relies on a Google Apps helper script to pull and format a Google calendar for schedule.
https://github.com/watermark-woods/GateController/blob/main/googlecloudcode.js

Behavior

Auto-reload is off.
Running in safe mode! Not running saved code.

You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Hard fault: memory access or instruction error.
Please file an issue with your program at github.com/adafruit/circuitpython/issues.
Press reset to exit safe mode.

Press any key to enter the REPL. Use CTRL-D to reload.

Description

My Python program is a scheduler to activate relays connected to the Pico which in turn can force a driveway gate to open during periods in the day based upon a private Google calendar.

The program runs fine. In earlier builds of CircuitPython there were memory issues with the HTTP requests over time so I forced a nightly reboot. I've had that in place since. I recently upgraded the version of CircuitPython along with the libraries. That required a new dependency to adafruit_connection_manager.mpy from adafruit_requests.mpy. I added the new dependent library, but did not see any code changes required due to this new dependency.

I have a separate Pico I use to do long-term tests after CircuitPython updates and it sits on my desktop. It has been running fine without issue for the last four days, but this morning it was frozen. When I connected into Putty I received the above "Running in safe mode!" error stating the CircuitPython core code crashed. The error asked me to post the issue which I'm doing here. If I have a memory access error within Python, which I've done on multiple occasions, Python just crashes and gives me a line number. This is very different.

Additional information

If I try to follow the instructions and press CTRL-D, it comes back with "soft reboot" but then immediately crashes with the same original message. The one difference is when I first looked at the board the green light on the board was not blinking. It normally blinks when it isn't running a program. When I am running a program and since I'm using WiFi, the light goes off and stays off. After the soft reset/crash the green light at least started blinking so that is a slight change post reboot.

Powering off the chip then back on for a hard reboot puts it back into play and it is running for now. Unknown why it hard crashed though.

You can watch the test harness after power on at https://youtube.com/shorts/nXUUagNr-7k. The test harness has the same relay I use on the driveway gate (Liftmaster). The LEDs to the right right are wired for blue to relay NC and green for NO. The 8th relay is set for the gate, and during this test is scheduled in the Google calendar to be open which is why the relay fires after Internet calendar check and closes the power for the green node.

@tannewt tannewt added rp2 Both RP2 microcontrollers network labels Aug 29, 2024
@tannewt tannewt added this to the 9.x.x milestone Aug 29, 2024
@eightycc
Copy link
Collaborator

@Hobbes4Pres Please re-test with CircuitPython 9.2.5. This release includes an update (#10027) that improves lwip (the IP stack used by CircuitPython) memory management.

@dhalbert dhalbert modified the milestones: 9.x.x, 10.x.x Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs retest network rp2 Both RP2 microcontrollers
Projects
None yet
Development

No branches or pull requests

4 participants