-
Notifications
You must be signed in to change notification settings - Fork 7.6k
ESP32-S2 CDC doesn't show up after flashing in download mode #5139
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
Comments
Hi @UnexpectedMaker, Is something similar you are trying to do? https://youtu.be/_I-MI8_gGM8?t=4189 (It's in Portuguese, sorry :( ) |
I'm not really sure what that video is showing, sorry. |
@me-no-dev @chegewara I've found the issue and how to reproduce it and why others are not seeing it: If Serial.begin() is present, it works. If Serial.begin() is not present, then the CDC doesn't enumerate and teh user has to go into download mode to flash the board every time. So I guess this is still linked to the previous issue about CDC and Serial, but for use cases where serial is not needed, the CDC should still enumerate as a device to flash to. Thanks! |
Yes, it is exactly what i described in the other issue. |
Ok, sorry I created extra noise about it ;) My focus was on no CDC enumerating and not that Serial wasn't working, so I was just focused on the enumeration/flashing side of the issue. Do we have an idea about how to fix this? It used to work fine in the S2 beta - and as I mentioned in the video, there used to be another CDC option in the menu, one for |
When you select |
I don't agree - this is not how it used to work while in Beta. I was the one working with @me-no-dev on how this initial worked, and there wasn't even a "serial output goes to...." menu option when CDC support was first implemented. It was possible back then to flash to the CDC and have it enumerate before we could even direct serial output to the CDC - that came after. This is a BUG. This should 100% NOT work this way. As I said, there used to be 2 menu options. One has been removed. the one that allowed the user to decide if they were using the CDC or external Serial2UART. If this is how it's intended to work, then it's a terrible implementation. It's not obvious or user friendly in any way. To a user - having the CDC enumerate has nothing to do with having serial output enabled or not. Not every project uses serial out. This workflow has to change. |
Just to be clear... I should be able to connect a FeatherS2 to my computer, select I am using the CDC, flash an empty Arduino project onto it.. just an empty setup(){} and loop(){} and after I flash it and it restarts, it should appear in my ports list so I can flash it again and again, no matter what is in my firmware. A user should not have to put any "required" code in their own firmware for CDC to kick in. |
what that user describes is expected. You do use a different serial for your boards so the enumerated serial will change.
persistence or not, this will always be the case :) |
Yup, I understand that (Though the ERROR:... is going to be changed to something less dramatic hopefully as it's not an error, but INFO for the user - espressif/esptool#631 ) But none of this addresses my issue and what I believe is a bug. The FeatherS2 in this case never presents itself as a new port If I choose the CDC, then it should enumerate and appear as a port no matter if I put Serial.begin() or not in my code. I've explicitly stated I am using the CDC, and therefor expect that the device appears for me after it restarts. |
I guess we can call USBCDC::begin after USB::begin in arduino-esp32/cores/esp32/main.cpp Lines 50 to 52 in 21947eb
Alternatively if the global change is not desirable, this can be made a board-specific thing, in one of two ways:
|
Hey Ivan :) I can't think of any use case or situation where if I chose CDC from the menu that I would't want the USB to enumerate, so I think this should 100% be a global setting when using CDC, and not something at the board level. Can you give me an example of a situation where a user might choose CDC but not want the CDC to actually enumerate to be used? |
Can you please retry with this sketch and current master? |
Hiya!!!! Not really sure what that sketch is supposed to do.. I only have CDC USB on my boards, so I have no way of seeing the output I don't think. What I will say is this is now (kinda) working - if I flash blink on my FeatherS2 without any Serial.begin() my CDC enumerates after reset - yay! But... when flashing via the CDC, the board doesn't auto reset after flash, but also shows no reset error or notification that the user has to reset the board to make the code start running. So flashing blink to CDC does nothing until after pressing reset. Hopefully just a bug :) Thanks for working on this! |
Is this in the case when you initially pull GPIO0 low to put the board into download mode? Or you already have some CDC-capable program loaded, and flashing is done without forcing GPIO0 low? |
Hey Ivan :) This is after I have CDC capable code running. I can re-flash blink again and again and it will never reset and start running unless I press reset manually. |
@UnexpectedMaker this sketch works on all USB boards. It will be very helpful if you have another USB-UART connected to UART0 to see the logs. I have recently added changes to the USB code and with current mater can upload fine with all boards but one, which has it's D+and D- lines swapped. I even tried with selecting FeatherS2 as board. (Note: tested on both Windows10 and OS X Big Sur) |
@me-no-dev my uploading is working fine now with your changes - just no auto reset happening after upload, well, not on this FeatherS2 anyway. I can try some other boards tomorrow and I'll get back to you :) |
wait... what do you mean by auto-reset? how did you enter download mode? hit upload while the sketch is running or manually with buttons? |
No, this is nothing to do with download mode. This is after the very first flash using download mode, then switch to CDC and flash again. Flashing via CDC doesn't reset the board after flashing it. I still have to manually hit reset. it gets to the end of the flashing.... Compressed 3072 bytes to 125...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (125 compressed) at 0x00008000 in 0.0 seconds (effective 590.7 kbit/s)...
Hash of data verified.
Leaving... But doesn't reset the board for me like any other board does. So no blinking LED until after I hit reset. This happens with or without Serial.begin() |
huh? this is really strange. Please attach UART to RX0/TX0 so we can see what is going on (and use the sketch I pointed to) |
You did update all tools with get.exe, right? |
@UnexpectedMaker Can you please take a look on proposed questions? We will appreciate it! |
@me-no-dev Can we closed this? |
I guess. Surely @UnexpectedMaker can ping us if here are more issues |
While in the beta branch, any S2 boards that were set to use CDC, that had a VID/PID, would appear in the ports list after initial (from being in download mode) and then manually reset. They would appear as the board name (eg:
/dev/cu.usbmodem12345 (UM FeatherS2)
- but this no longer works.Once reset, the board doesn't appear at all in the post list and requires going back into download mode again to been seen and flashed again.
Tested on WIn 10 and macOS Catalina with both FeatherS2 and TinyS2 boards. I cant test using
ESP32S2 Dev Board
as that has no menu for CDC.The text was updated successfully, but these errors were encountered: