Page 1 of 1

USB OTG and Serial/UART

Posted: Fri May 02, 2025 8:59 am
by cybersack
New here guys and this is my first new topic.
I previously piggybacked onto viewtopic.php?p=147233&sid=92cbd9e48b33 ... ce0c6e59f3
but I think my post has been missed.

I need some advice/assistance in choosing the correct dev board/kit.
I am a software engineer, not a microcontroller or embedded engineer, so 'obvious' to you may not be obvious to me ... hence the post :)

I currently use ESP32-WROOM-32D dev boards for my newbie prototyping, and I have a need to integrate Android over USB, which means using OTG. All good on the 'droid side.

On the microcontroller side, I have 2 questions:

[1]
Can I connect a serial/uart adapter on the rx/tx pins so that runtime communications could flow via this OTG connection, whilst the on-board USB jack continues to provide power and is used for upload/flashing ?
If so, is there sample code for this somewhere ?

[2]
It seems there might be a more robust/simple way to achieve this as I see dev kit:
https://docs.espressif.com/projects/esp ... guide.html
which might be an out-of-box solution that would fit my needs to keep the power/upload usb port function separate from the communications function.
If this is correct, which of the USB jacks should be used for which purpose ?

Re: USB OTG and Serial/UART

Posted: Mon May 05, 2025 2:12 am
by Sprite
What does the Android side need to see? If it needs to see a custom USB device, you need an ESP32-S3 (or -S2) as you need an usb-otg device on the ESP32 side and the 'classic' ESP32 does not have that. I don't recall if the OTG kit you mentioned has the infrastructure to do what you want, but it may be easier to get a esp32-s3-devkitc1 which also has an USB-UART port for debugging/uploading and an USB-OTG port you can connect to your phone.

Re: USB OTG and Serial/UART

Posted: Mon May 05, 2025 9:42 am
by cybersack
What does the Android side need to see?
I will use the interfaces and classes around
android.hardware.usb.UsbDevice;
android.hardware.usb.UsbDeviceConnection;
android.hardware.usb.UsbInterface;
android.hardware.usb.UsbManager;

I also wish to use ESP Now comms, so if esp32-s3-devkitc-1 supports that, then it would seem to be a suitable kit to use.

Thank you