LILYGO T-Dongle-S3 OTG development loop (ESP32S3 Dev Module)

Hey! I have this board: T-Dongle S3 – LILYGO®

LILYGO T-Dongle-S3, not the T-Display-S3 which seems to be another (better?) variant.

I made a simple project here: GitHub - kohanyirobert/wake-on-esp32s3

Everything works. My use case is: I want the board to act as a webserver/listener and USB keyboard. When attached to my laptop (through a USB-C hub) whenever it receives a HTTP request/network packet it should send a keypress as if I’d pressed a key to wake up the machine or do some stuff.

This works. However the development cycle is tedious with PlatformIO.

Since I have to switch/communicate with the board not in USB mode but in OTG mode (I’m unsure what this actually mean by the way, but it works) whenever I’d like to upload my code to the board first I have to unplug the dongle and replug it while holding the button on it. After which if I want to run my code I to unplug it and replug it (without holding the button). This part is tedious, I fear I’ll break the dongle eventually.

Any way I can do the same upload/test cycle without unplugging and replugging the damn thing all the time? This seems to work from the Arduino IDEMaybe this works in Arduino IDE (it seems after writing this post that this is not the case, it doesn’t work either), but I like VS Code much better.

Any pointers?

I think we already discussed how to flash an ESP32 when its using the TinyUSB stack?

Thanks, I missed this thread somehow. I read it. My case is similar, but here’s the difference I think: the OP of that question wasn’t able to flash their board when ANDROID_USB_MODE is set to 0. This works for me, but only after I plug my board into USB while holding its button.

I tested that if I plug my board into a USB port while holding down its single button I can continuously reupload my code, but it’ll never execute. I didn’t test this previously, but it works with or without the 3 extra config lines.

If I unplug my board and just plug it (without holding its button) my code executes, but I can’t upload my new code - with or without the the extra config mentioned in the other post.

I get serial write timeout (the extra config does kick in, I see extra lines in the output

Looking for upload port...
Auto-detected: COM4
Forcing reset using 1200bps open/close on port COM4
Waiting for the new upload port...

Just for the heck of it I tested using Arduino again … but now things didn’t work as I expected them to even there (I didn’t thoroughly test this, missed some key working principles here).

So I have to step back and ask an important question :slight_smile:

Is this development loop could/should even supposed to work?

  1. I plug the board into USB without holding the button
  2. If it contains some code it starts to execute
  3. Meanwhile I start to upload my new code
  4. Boards resets/restarts in a “mode” where it can accept my code (without unplugging the board)
  5. When upload finished it resets again into “execution mode”
  6. New version of code starts to execute

Is this plausible at all? Will this ever work, or hard to tell? I’m approaching this from a developer UX viewpoint rather than how it’s supposed to work, because I’m not knowledgeable.

If it’s relevant, the dongle’s got a GitHub repo (GitHub - Xinyuan-LilyGO/T-Dongle-S3: An ESP32S3 development board that can freely use WIFI, BLE, TF, LED, TFT_LCD functions.) with some usage information. I believe someone whose native tongue is not English have written this, as such a crucial piece of info is hazy for me. It says at one point:

1. The board uses USB as the JTAG upload port. When printing serial port information on USB_CDC_ON_BOOT configuration needs to be turned on. If the port cannot be found when uploading the program or the USB has been used for other functions, the port does not appear. Please enter the upload mode manually.
  1. Press and hold the BOOT button , While still pressing the BOOT button, Insert USB
  2. Release the BOOT button
  3. Upload sketch

This is what I do, and it works, but it just sucks ass to do this :smiley: