Skip to content

ESP32-S3 hard fault instantiating UART object after I2C object #8529

@DonutCatDev

Description

@DonutCatDev

CircuitPython version

Adafruit CircuitPython 8.2.7 on 2023-10-19; VCC-GND YD-ESP32-S3 (N16R8) with ESP32S3

Code/REPL

from busio import I2C, UART
import board
i2c = I2C(board.GPIO41, board.GPIO42)
uart = UART(board.GPIO1, board.GPIO2, baudrate=9600)

Behavior

Board disconnects from the computer, power cycles, then flashes triple yellow lights on loop.
On plugging it in and connecting via serial, this is the readout

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.

Description

Initially discovered that instantiating an I2C 1602 display and a UART audio card in the same imported file would cause a crash into safe mode.

Running the following by going into the REPL while it's in safe mode:

supervisor.runtime.safe_mode_reason

Returns SafeModeReason.Hard_Fault

Additional information

Workarounds found:

  • Having no UART instantiation in the file no longer crashes on importing the file.
  • Moving the UART instantiation to before the I2C instantiation also gives no crash
  • Instatiating the I2C object at a lower speed such as frequency=20000 does not crash

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions