Seeed Esp32-S3 as Jostick HID - cannot uplaod a new sketch

Hello everybody,
i want to use a seeed esp32-s3 in combanation with the esp32-s3 Joystick Library as an Gamepad on my pc.

I am facing an issue when trying to uplaod a new sketch to this esp32-s3 after initially loading a joystick sketch to it without any issues.
The error is:
Note: This error originates from pySerial. It is likely not a problem with esptool, but with the hardware connection or drivers.

I cannot get the ESP32-s3 in boot mode or to accept a new sketch (first try via PlatformIO then via ArduinoIDE) - any ideas on how i could fix this?

I tried to follow the guide on

but if i press and hold the bood button before connecting the esp32-s3 to the pc i see another entry in the arduino ide “TAMC Termod S3” to which i also can upload the blink sketch, but this is not behaving correctly (not blinking) and also with the same approach i cannot upload a new sketch to XIAP_ESP32S3

Thanks a lot.

Does the following blink sketch work?

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);          // LED
}

void loop() {
  digitalWrite(LED_BUILTIN, LOW);        // LED ON
  delay(10);                             // 10mS For LED visibility
  digitalWrite(LED_BUILTIN, HIGH);       // LED OFF
  delay(500);                            // OFF 500mS and loop
}

Use Arduino IDE
make sure XIAO ESP32S3 (not any other dev board) is selected as board, before during and after upload

The LED_Builtin pin changes on different boards, you could try hard coding the pin into your sketch

Once you successfully upload a sketch, even Basic/Bareminimum it should try to hold the selected board

Hello cgwaltnbey, Hello msfujino,
thanks a lot for your responses.

I managed to upload the blink sketch, as you indicated the board that gets recognized after the boot and power up procedure does not recognize the LED_BUILTIN, but the Xiao_ESP32S3 does.

So i can reset the board (as long as i didn´t damange the boot button while holding and plugging in, not to easy with those headers soldered to the Board :D)

So while i can get the Board unstuck, upload a new Blink sketch and then upload an altered version of my joystick sketch using the Joystick_ESP32S2 library - i wonder why this is necessary.

Why is it that you cannot upload a new sketch to the board after it was declared as a HID by USB.begin();…?

in simple terms, i have found out that if the processor is very buisy working or communicating data back over the usb for serial monitor it does not have its ears on and is not listening for the usb to tell it to upload a new sketch.

so an option is to write into your code an escape route to deactivate the serial and tell the processor to chill

either a serial command to stand down or a button you can press

include in this code the commands

Serial.end();  // This will end the Serial Monitor Connection
exit(0);          // This will end program execution

also try lowering serial communications speed

Serial.begin(19200); // This is almost the slowest the ESP32 will run serial… you can try 9600, but know that it is known that problems may happen and this may be the reason

also check out Arduino OTA… this is interesting procedure where the ESP32 can be updated Over The Air… by WiFi so you dont have to physically connect to the device… it uses a update process that is always running in the background of your code… may cause problems with your code… but only if you are doing crazy lot of stuff at once… shouldnt have problems doing regular stuff

You can remove Arduino OTA from your code once you get it stable qnd dont need to troubleshoot

If you are real brave look for this file
C:\Users\cgwal\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\boards.txt

#############################################################

XIAO_ESP32C3.name=XIAO_ESP32C3
XIAO_ESP32C3.vid.0=0x2886
XIAO_ESP32C3.pid.0=0x0046

each board is divided by #######
make a backup copy of the boards.txt file and delete all the boards except for the ones you have-are using just the SEEED XIAO

then the other boards cannot be selected or auto selected by the arduino IDE

It looks like the XIAO is soldered to the board, what is connected to GPIO 0, 3, 45, and 46?

Have you read the Straping Pins section of the Wiki?

At each startup or reset, a chip requires some initial configuration parameters, such as in which boot mode to load the chip, voltage of flash memory, etc. These parameters are passed over via the strapping pins. After reset, the strapping pins operate as regular IO pins.

Hi msfujino,
No not quite, i just soldered some header pins to the bottom of the board to use it on a breadboard with jumper wires which restricted the access to the Boot Button.

But the issue is resolved so far and i am just trying to reduce the amount of necessary Uploads of new sketches to a board which already got declared as HID.