8000 microcontroller.reset() to bootloader on esp32-s2 · Issue #3884 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

microcontroller.reset() to bootloader on esp32-s2 #3884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
FoamyGuy opened this issue Dec 27, 2020 · 8 comments · Fixed by #4925
Closed

microcontroller.reset() to bootloader on esp32-s2 #3884

FoamyGuy opened this issue Dec 27, 2020 · 8 comments · Fixed by #4925
Assignees
Labels
bug espressif applies to multiple Espressif chips
Milestone

Comments

@FoamyGuy
Copy link
Collaborator
FoamyGuy commented Dec 27, 2020

Running these commands in REPL my device is rebooting into standard mode coming up as a CIRCUITPY drive.

import microcontroller
microcontroller.on_next_reset(microcontroller.RunMode.BOOTLOADER)
microcontroller.reset()

Tested on:

Adafruit CircuitPython 6.1.0-beta.2-182-g1b7fbaf31 on 2020-12-26; Adafruit MagTag with ESP32S2

and

Adafruit CircuitPython 6.1.0-beta.2-30-g6cced4940 on 2020-12-13; FeatherS2 with ESP32S2

I have previously followed the process to have UF2 combo bootloader on my devices.

@microdev1
Copy link
Collaborator

microcontroller.RunMode.BOOTLOADER isn't implemented on the esp32s2.

void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
if(runmode == RUNMODE_SAFE_MODE)
safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE);
}

I don't think it is possible to enter DFU (first-stage) bootloader on esp32s2 from software.
I tried to get reset to UF2 bootloader working but I am facing a strange issue #3813.

@ladyada
Copy link
Member
ladyada commented Dec 27, 2020

there is some way to enter the DFU bootloader from usercode because arduino does it...
@me-no-dev do you have any hints we could use to implement? :)

@me-no-dev
Copy link

@ladyada here is the shutdown handler that does the reboot into the proper mode: https://github.com/espressif/arduino-esp32/blob/idf-release/v4.2/cores/esp32/esp32-hal-tinyusb.c#L458-L479

it is registered here: https://github.com/espressif/arduino-esp32/blob/idf-release/v4.2/cores/esp32/esp32-hal-tinyusb.c#L531

Let me know if this does not help :)

@microdev1
Copy link
Collaborator

Thanks! @me-no-dev, this works... the changes are in my update-run-mode branch. :)

@dhalbert
Copy link
Collaborator

Thanks! @me-no-dev, this works... the changes are in my update-run-mode branch. :)

@microdev1 Could you make your changes into a PR?

@dhalbert dhalbert modified the milestones: 6.x.x - Bug Fixes, 7.0.0 Mar 31, 2021
@microdev1
Copy link
Collaborator

@microdev1 Could you make your changes into a PR?

This is stuck due to idf@v4.2. In my implementation, the function calls used to achieve this are part of idf@v4.3.

@ThomasAtBBTF
Copy link

I just want to point out, that I am very interested that this feature will work in the not to distance future,

@dhalbert
Copy link
Collaborator

This should be fixed now, with the latest merge, and also with the latest TinyUF2. Update your TinyUF2 bootloader to at least 0.5.0, following the instructions here: https://learn.adafruit.com/adafruit-magtag/install-uf2-bootloader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug espressif applies to multiple Espressif chips
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
0