Closed
Description
The actual example is significantly longer, but I narrowed it down to the following 10 lines of code to reproduce it. Tested on two different NeoKey Trinkeys running the same firmware.
Limor reported that the original example worked fine a few weeks ago. (If I change the setup order, it works now.)
Firmware
Adafruit CircuitPython 7.0.0-alpha.2-610-g7511e1c78 on 2021-05-20; Adafruit NeoKey Trinkey M0 with samd21e18
Code/REPL
import board
import neopixel
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
keyboard = Keyboard(usb_hid.devices)
keyboard_layout = KeyboardLayoutUS(keyboard)
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.1)
Behavior
Save the above example as code.py on a NeoKey Trinkey, and it will enter safe mode with the following info.
Auto-reload is off.
Running in safe mode! Not running saved code.
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
If you setup the NeoPixel before the keyboard, it does not crash into the hardfault handler.