adafruit / tinyuf2

UF2 bootloader based on TinyUSB for embedded devices such as ESP32S2, STM32F4 and iMX RT10xx
MIT License
302 stars 165 forks source link

Adafruit ESP32 S3 REV TFT Arduino 2.2.1 No Comm Port V0.16.0 #353

Closed Andrewiski closed 7 months ago

Andrewiski commented 8 months ago

Operating System

Windows 10

INFO_UF2.TXT

When attempting to program on a ESP32 S3 Rev TFT using bootloader version 0.16.0, Arduino immediately errors with "A fatal error occurred: Could not open COM9, the port doesn't exist" even though the com port is listed in device manager in windows. Downgrading to 0.12.3 bootloader, power resetting, and programming again the device programs and does the normal hang after "Hard resting via RTS Pin" that requires the push of rest button but the device is programmed. With version 0.16.0 bootloader the USB uf2 programming seems to work and a double tap of reset bring up the uf2 bootloader as expect bug seems to only effect Arduino programming I confirmed same issue on multiple ESP S3 Rev TFT's on multiple Windows computers. I did not try moving forward from 0.12.3 to see what version it breaks.

What happened ?

Arduino programming fails with

A fatal error occurred: Could not open COM9, the port doesn't exist
Failed uploading: uploading error: exit status 2

How to reproduce ?

ESP32 S2 Rev TFT upgrade bootloader to 0.16.0, Power reset to activate bootloader, Check Info_Uf2.txt Confirm Successful Upgrade (I have had the 0.16.0 show and then on power cycle revert)

TinyUF2 Bootloader 0.16.0 - tinyusb (0.15.0-566-gf1e006d09)
Model: Adafruit Feather ESP32-S3 Reverse TFT
Board-ID: ESP32S3-FeatherRevTFT-revC
Date: Jul 25 2023
Flash Size: 0x00160000 bytes

Drag and Drop Feather_ESP32S#_ReverseTFT_FactoryTest.uf2 to Feather USB Drive Now Should be running the factory Test and Serial Port Show in Windows. Using Arduino Studio perform Upload of any Simple Code. Arduino upload fails with Immediately after Compile With Could not open COM10, the port doesn't exist COM10 is present in device manager still, factory code is still running device did not program at all

Sketch uses 359793 bytes (24%) of program storage space. Maximum is 1441792 bytes.
Global variables use 31896 bytes (9%) of dynamic memory, leaving 295784 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.5.1
Serial port COM10

A fatal error occurred: Could not open COM9, the port doesn't exist
Failed uploading: uploading error: exit status 2

Debug Log

No response

Screenshots

image

hathach commented 8 months ago

Thank for reporting the issue, intially, I thought it is due to the new IDF v5.1 used by latest arduino-esp32. Howver, after migrating tinyuf2 from idf v4 to v5. The issue stil; persists. I did a lot more tests and finally find the root cause. It is caused by the newly-introduced periman module. I have submitting PRs with detail explanation to arduino-esp32 core

The change is very simple, just change the return from false->true in a function. If you cannot wait for the fix, you can simply make the change local. Should it work for you, maybe drop a comment there, the more people test this, the more likely (and sooner) espressif would merge it.