adafruit / circuitpython

CircuitPython - a Python implementation for teaching coding with microcontrollers
https://circuitpython.org
Other
4.11k stars 1.22k forks source link

Enabling both CDCs on ESP32S2 boot loops and prevents safe mode #4986

Closed todbot closed 3 years ago

todbot commented 3 years ago

CircuitPython version

Adafruit CircuitPython 7.0.0-alpha.4-15-g22e8a5058 on 2021-07-11; Adafruit FunHouse with ESP32S2

Code/REPL

# boot.py
import usb_midi
usb_midi.disable() 
print("disable MIDI")
import usb_hid
usb_hid.disable()
print("disable HID")
import usb_cdc
usb_cdc.enable(console=True, data=True)
print("enable CDC console & data")

Behavior

On reset or power up, board goes into boot loop. No way to escape it, without esptool.py --erase_flash. On FunHouse, the dotstar LEDs briefly flash purple and the display briefly starts to show boot_out.txt contents, as seen in this video: https://user-images.githubusercontent.com/274093/125208434-1eaad680-e247-11eb-96fd-d37b1286403d.mp4

Description

FunHouse CircuitPython installation was performed as described here. Entire process to recreate bug:

  1. Install TinyUSB UF2 bootloader: esptool.py --port /dev/tty.usbmodem01 write_flash 0x0 funhouse_tinyuf2_combo.bin (from here)
  2. Double-click to UF2 bootloader, copy over latest FunHouse CP7 alpha UF2 from S3
  3. Create boot.py with above script
  4. Reset board, observe boot loop
  5. Can double-tap to get back to UF2 bootloader, but reinstalling CP still results in boot loop
  6. Only recourse is: esptool.py --port /dev/tty.usbmodem01 erase_flash and repeat from step (1)

Submitted as new bug from https://github.com/adafruit/circuitpython/issues/4746#issuecomment-874359232

Additional information

No response

dhalbert commented 3 years ago

ESP32-S2 now properly goes into safe mode. This must have been fixed with one of @microDev1's ESP32-S2 mode fix PR's.

After pressing reset:

Adafruit CircuitPython 7.0.0-alpha.6-73-g064e08657 on 2021-08-17; Adafruit Metro ESP32S2 with ESP32S2
>>> 
soft reboot

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

You are in safe mode because:
USB devices need more endpoints than are available.