Skip to content

espflash hangs on panic on USB interface #930

@theembeddedrustacean

Description

@theembeddedrustacean

I can't pinpoint the exact version, but in one of the recent updates, when I flash code and it panics, the programmed device enters a weird state.

What happens is that after a panic, I typically exit by pressing Ctrl+C. However, when I try to reflash, espflash gets stuck in a "Connecting" state indefinitely. Disconnecting the USB power and reconnecting it doesn't do anything either. Resetting the device using espflash while giving confirmation that the device is reset doesn't resolve the issue either.

I manage to recover the device eventually, only by entering and exiting bootloader mode. Alternatively, for dev-boards that have a second UART-USB header, flashing over the second interface works and fixes the stuck issue on the USB interface header.

This happens with both ESP32-S3 and the ESP32. I haven't tested other devices yet. I also use esp-backtrace as the panic handler.

To confirm behaviour, I created, built, and flashed a template project using esp-generate. I then inserted a panic!() in the code and flashed again, exiting with Ctrl-C afterward. Upon reverting to the non-panic!() code and trying to flash again, the issue surfaces.

System info:
OS is macOS Sequoia 15.5
espflash version is 4.0.1 (although the same issue occurred in earlier versions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions