Skip to content

Consistent HardFault from missing import on Feather S2 w/ BME280 #6948

@FoamyGuy

Description

@FoamyGuy

CircuitPython version

Adafruit CircuitPython 8.0.0-beta.0 on 2022-08-18; Adafruit Feather ESP32S2 with ESP32S2
Board ID:adafruit_feather_esp32s2

Code/REPL

https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/main/examples/bme280_simpletest.py

import time
import board
from adafruit_bme280 import basic as adafruit_bme280

# Create sensor object, using the board's default I2C bus.
i2c = board.I2C()  # uses board.SCL and board.SDA
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)

# change this to match the location's pressure (hPa) at sea level
bme280.sea_level_pressure = 1013.25

while True:
    print("\nTemperature: %0.1f C" % bme280.temperature)
    print("Humidity: %0.1f %%" % bme280.relative_humidity)
    print("Pressure: %0.1f hPa" % bme280.pressure)
    print("Altitude = %0.2f meters" % bme280.altitude)
    print("loop")
    time.sleep(2)

Behavior

With version 8.0.0 beta.0 I consistently crash into HardFault from this line:

from adafruit_bme280 import basic as adafruit_bme280

If I comment out this import and the things that depend on it, then the file will run consistently without crashing. (albeit, not much left actually happening in code.py with the import and things removed).

On Version 7.3.3 with same device I don't get the same crash, instead see the normal ImportError for missing module.

The HardFault seems to be tied specifically to starting the code.py with ctrl-D in the REPL (or perhaps just tied to a "cold" boot?). If the script runs due to code.py file being changed / saved then it doesn't HardFault and instead gives the normal ImportError. Then with same exact code.py file loaded unplug/replug connect REPL. I know it has already crashed because the main loop prints do not occur. I'm unable to connect serial quick enough to know what the initial crash is though. Pressing Ctrl-C then Ctrl-D at this point will restart the code and is consistently leading to the HardFault.

If I install adafruit_bme280 library then it doesn't HardFault or crash, and everything runs successfully.

Description

No response

Additional information

If there is any further testing or diagnostics that may be helpful I'm happy to try things and report back. I seem to be able to reliably re-create the HardFaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions