8000 Unable to get into .UF2 boot mode from code · Issue #10247 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

Unable to get into .UF2 boot mode from code #10247

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

Open
ThomasAtBBTF opened this issue Apr 13, 2025 · 10 comments
Open

Unable to get into .UF2 boot mode from code #10247

ThomasAtBBTF opened this issue Apr 13, 2025 · 10 comments
Milestone

Comments

@ThomasAtBBTF
Copy link

With (much) older versions of CircuitPython I was able to get into .UF2 boot mode from inside a running CircuitPython app.
The current instructions / documentation in circuitpython.org for version 9 suggest to code like so:
import microcontroller
microcontroller.on_next_reset(microcontroller.RunMode.UF2)
microcontroller.on_next_reset()
However, this currently does not work for me for any ESP32S3 boards I have access to.

Any ideas ?

Thomas

@Neradoc Neradoc transferred this issue from adafruit/circuitpython-org Apr 13, 2025
@Neradoc
Copy link
Neradoc commented Apr 13, 2025

I would ask: what does "does not work" mean ? But you have the last line wrong, so if that's the code you are actually using (and not a typo here), you would have gotten a TypeError: function takes 1 positional arguments but 0 were given exception.

This is what you want:

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

It works for me (tested on a TFT feather and a QTPY on 9.2.7).
If you code was correct and you still get the issue, what board are you using exactly ?
And what version of Circuipython ?

@ThomasAtBBTF
Copy link
Author
ThomasAtBBTF commented Apr 13, 2025

I tried this with a:

  • adafruit_feather_esp32s3_reverse_tft
  • firebeetle2_esp32s3
  • yd_esp32_s3_n16r8
    I tried with all of them under 9.2.7
    With the firebeetle2_esp32s3 I also tried 9.0.5 to see for me if it was working in an earlier version but it did't

What does not work mean:

  • all three boards are not showing a USB drive after the reset I "see" CIRCUITPY drive and the normal com port.
  • I do not see a Typerror Message!

Here, what I get in PUTTY:
Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 9.2.7 on 2025-04-01; DFRobot FireBeetle 2 ESP32-S3 with ESP32S3
'>>> import microcontroller
'>>> microcontroller.on_next_reset(microcontroller.RunMode.UF2)
'>>> microcontroller.reset()

Immediately after reset() the serial connection is lost and Putty brings up a error message!

Also: I am asking this in part also, because with all three boards I can not get into the .UF2 "drive by pressing the BOOT / RESET combination. And "Yes" I got this working on other boards.

PS: I added manually the ' quote sign in front of the > > > chars from the REPL

@ThomasAtBBTF
Copy link
Author

Additional info:
When I call:
import microcontroller
microcontroller.on_next_reset(microcontroller.RunMode.BOOTLOADER)
microcontroller.reset()

I get a "new" COM-Port and a "bad" ESP32S3 device in the Windows "device manager"

@snkYmkrct
Copy link
snkYmkrct commented Apr 13, 2025

I just tested the UF2 code above on a ESP32-S3 Reverse TFT Feather with a fresh install of CircuitPython 9.2.7, and it works correctly, it reboots into the FTHRS3BOOT UF2 drive.

What version is your TinyUF2 Bootloader ?

microcontroller.RunMode.BOOTLOADER would put the board into ROM bootloader mode, so new COM port and no drive is the correct behaviour.

@Neradoc
Copy link
Neradoc commented Apr 13, 2025

Also: I am asking this in part also, because with all three boards I can not get into the .UF2 "drive by pressing the BOOT / RESET combination.

Is the UF2 bootloader even installed ? How did you install Circuitpython if you can't get into the UF2 bootloader ? The installer on the board page ? (you want the full/uf2 install) Or did it work and no longer does ?

@ThomasAtBBTF
Copy link
Author

I will try again with CP 9.2.7 I falsely stated above that I tested with the Reverse TFT Feather with 9.2.7 but when I checked it was version 9.2.4.

I updated the bootloader from https://circuitpython.org/board/adafruit_feather_esp32s3_reverse_tft/ using the open installer.
After a manual reset the drive FTHRS3BOOT appeared.

Also when typing now:
import microcontroller
microcontroller.on_next_reset(microcontroller.RunMode.UF2)
microcontroller.reset()

The FTHRS3BOOT appears.

Thank you snkYmkrct for mentioning the bootloader !

@ThomasAtBBTF
Copy link
Author

I have no idea how I got "rid of" the bootloader on the adafruit_feather_esp32s3_reverse_tft

On the firebeetle2 there is no bootloader option on https://circuitpython.org/board/firebeetle2_esp32s3/
So I uploaded firmware.bin at pos 0 with the help of the website: https://adafruit.github.io/Adafruit_WebSerial_ESPTool/
Can anyone give me idea how / where I can find the bootloader for the firebeetle2 and with what parameters I need to upload the UF2 Bootloader into the board.

@snkYmkrct
Copy link
snkYmkrct commented Apr 13, 2025

You can download the UF2 bootloader from the tinyuf2 repo and the process to install should be the same as the reverse tft feather, using the combined.bin file
Not sure why it's not linked on the CircuitPython download page.

@ThomasAtBBTF
Copy link
Author
ThomasAtBBTF commented Apr 13, 2025

After using combined.bin from tinyuf2-firebeetle2_esp32s3-0.30.0.zip and rebooted, the drive FIRE2BOOT appeared.
Then I copied the CP 9.2.7 .UF2 file into the FIRE2BOOT drive.
After a reset the CIRCUITPY drive appeared and I can confirm that the sequence:

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

Brings me again into the FIRE2BOOT drive!

Great!

One small thing remains and this may be specific to the firebeetle2:

When I press the BOOT RESET combination, the board does not come up with the FIRE2BOOT drive but the COM-Port comes up with the USB / JTAG serial debug unit (COM46 in my case)

I will try my yd_esp32_s3_n16r8 board next.

< 86B2 !-- no margin wins, so we check it last and use its value if true. -->

@snkYmkrct
Copy link

Holding BOOT and pressing RESET puts the board in the ROM bootloader.

The UF2 bootloader should start by double pressing RESET -- you may need to try a few times to get the timing right -- see more details here

@dhalbert dhalbert added this to the Support milestone Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
0