Skip to content

BLE on the ESP32-S3 causes CircuitPython to hard fault under certain conditions #9708

Open
@gingershaped

Description

@gingershaped

CircuitPython version

Adafruit CircuitPython 9.2.0-beta.0-33-g52602caae4-dirty on 2024-10-10; Adafruit Camera with ESP32S3

Code/REPL

# See https://gist.github.com/gingershaped/d0336649c3da9f89775b22fcb78ea451

Behavior

Under specific conditions, connecting to the Memento board over Bluetooth Low Energy causes CircuitPython to hard fault and enter safe mode. Usually it happens after doing some variation on these steps:

  1. put this code in ctstest.py
  2. put import supervisor; supervisor.runtime.ble_workflow = False in boot.py
  3. reset the board
  4. enter the REPL
  5. import ctstest
  6. attempted to connect with my phone; Android's pairing dialog appeared but the program produced this error:
advertising
connected
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "ctstest.py", line 37, in <module>
  File "adafruit_ble/__init__.py", line 143, in pair
_bleio.BluetoothError: Unknown system firmware error: 2

nonetheless, my phone paired to it
7. import ctstest again; my phone automatically connects to it, even though I passed bond=False to pair(), and it produces a different error:

advertising
connected
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "ctstest.py", line 37, in <module>
  File "adafruit_ble/__init__.py", line 143, in pair
ConnectionError: Connection has been disconnected and can no longer be used. Create a new connection.
  1. import ctstest again; this causes a hard fault

If my phone is able to pair, the board will occasionally show BLE:Reconnecting in the top status bar when it enters safe mode after faulting; when this happens, resetting the board will continue to show BLE:Reconnecting (instead of BLE:Off as would be expected) and running ctftest again causes it to stall on the call to pair when attempting to connect to it with my phone, and calling _bleio.adapter.erase_bonding() makes pair work again even though ctftest explicitly passes bond=False to pair.

Description

No response

Additional information

The phone I have is a Google Pixel 6a. The vanilla CircuitPython build for the Memento does not have _bleio enabled, I'm using a modified version which includes it.

Metadata

Metadata

Assignees

Labels

blebugespressifapplies to multiple Espressif chips

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions