I'm working on a ESP_NOW project with 2 ESP32 Dev Modules and a Adafruit feather S2. I downloaded a sketch to the Feather but had the board set to a ESP32 Dev Module. I noticed that while it was downloading but waited for it to give me a downloading error. I never got the error but it looked like it had stopped downloading, kind of froze, so I reset the board in the IDE and tried to download again. Now there was no port selected and when I unplugged it and plugged it back in it doesn't open a new port. A few minutes later I did get a timeout error so it must have still been trying to communicate when I unplugged it.
It now doesn't show a port, is there a way to recover this or do I throw it in the trash?
Thanks
John
Hi @Stumpy_L. The ESP32-S2 based boards have a unique characteristic, which is that they don't produce a serial port after a reset or power cycle if you had "Disabled" selected from Arduino IDE's Tools > USB CDC On Boot menu at the time the sketch was uploaded.
When the board is in this state, it will produce a serial port after you put the board into the special boot mode, after which you can upload a new sketch.
I'll provide instructions you can follow to do that:
- Press and hold the "Boot" button on the board.
- Press and release the reset button on the board.
- Release the "Boot" button on the board.
- Select the port of your board from the Tools > Port menu in Arduino IDE.
- Start an upload in Arduino IDE.
- Wait for the upload to finish.
- Press and release the reset button on the board.
The upload should now finish successfully.
if you had "Disabled" selected from Arduino IDE's Tools > USB CDC On Boot menu, you will find that the board will no longer produce a serial port after it is reset or power cycled just like before. If your sketch doesn't make any use of the serial port then this is no problem as you will only need the port when uploading and you now know the technique for doing that. If your sketch does use the serial port, then select Tools > USB CDC On Boot > Enabled from the Arduino IDE menus and then upload a sketch (following the procedure described above). After that, the board will produce a serial port even when the sketch is running.
1 Like
Excellent! That worked perfectly, I'll have to save that procedure.
Thanks so much for the help.
Also the USB CDC On Boot was set to Enable. Didn't know about that function.
Thanks again
You are welcome. I'm glad it is working now.
This option being set to "Disable" is only one of the possible causes of the board not producing a serial port.
The tricky thing about the boards with native USB capability like your board is the USB code that creates the CDC serial port is running on the same microcontroller as your sketch. This means your sketch code can break the USB code, or stop it from running. When that happens, the board no longer produces a serial port.
This can be unexpected to those who previously mainly worked with the boards like Uno and Mega with a dedicated USB chip that can never be affected by the sketch code.
It is actually fairly common to run into this "soft bricked" state during sketch development after we upload a version of the sketch that has a bug that happens to break the program's USB functionality. But once you know the technique for recovering the board from that state it doesn't pose any significant difficulty (though of course finding and fixing the bug might be another story!).
Regards, Per