circuitpython: Magtag does not boot to CP after flash

FYI - I just updated to the current main CP repo – now at 6.1.0-beta2 – when I build and flash my magtag – it will only boot to the MAGTAGBOOT bootloader after powercycle or reset – then I have to copy over the firmware.uf2 file manually – it runs fine but that is a new step – has something changed. Are others seeing the same? here is the sequence I am using

jerryneedell@jerryneedell-ubuntu-macmini:~/projects/circuitpython/ports/esp32s2$ make BOARD=adafruit_magtag_2.9_grayscale flash PORT=/dev/ttyACM0
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
ninja: Entering directory `build-adafruit_magtag_2.9_grayscale/esp-idf'
[1/1] Performing build step for 'bootloader'
ninja: no work to do.
esptool.py --chip esp32s2 -p /dev/ttyACM0 --no-stub -b 460800 --before=default_reset --after=no_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x0000 build-adafruit_magtag_2.9_grayscale/firmware.bin
esptool.py v3.0-dev
Serial port /dev/ttyACM0
Connecting...
Chip is ESP32-S2
Features: WiFi, ADC and temperature sensor calibration in BLK2 of efuse
Crystal is 40MHz
MAC: 7c:df:a1:06:8e:a8
Changing baud rate to 460800
Changed.
Enabling default SPI flash mode...
Configuring flash size...
Erasing flash...
Took 7.92s to erase flash block
Wrote 1302528 bytes at 0x00000000 in 29.6 seconds (351.5 kbit/s)...
Hash of data verified.

Leaving...
Staying in bootloader.
jerryneedell@jerryneedell-ubuntu-macmini:~/projects/circuitpython/ports/esp32s2$ cp build-adafruit_magtag_2.9_grayscale/firmware.uf2 /media/jerryneedell/MAGTAGBOOT/

It works fine after loading the .uf2

On my metro_esp32s2 – it boots to CIRCUITPY normally after flashing.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

@jerryneedell do flash-circuitpython-only. The normal flash target will overwrite the second stage bootloader that does double tap detection and also overwrite OTA data which track what to run next. It defaults to the factory partition which is where UF2 lives.

I do not see this: I do not have the UF2 bootloader on my MagTag and have been loading the .bin firmware files via esptool.py. I just tried the 6.1.0-beta.2 download and it’s the same. I think it has to do with whether you have the bootloader on your board or not.

Hypothesis: When the board resets, if the UF2 bootloader is present, it goes to the UF2 bootloader. If the bootloader has loaded a UF2, it has remembered that fact in flash, and transfers control to the loaded UF2. If it hasn’t loaded a UF2, then it doesn’t know there’s something to run and stays in MAGTAGBOOT mode.