Host library help for esp32

X86Jamie
Posts: 5
Joined: Thu Dec 04, 2025 12:56 pm

Host library help for esp32

Postby X86Jamie » Fri Dec 05, 2025 1:07 am

I have a Esp32s3-wroom-1 and want to use OTG usb gpio pin 19, and 29 connect to dm, dp usb on the modem and have the Esp32 enumerate the 3 ports AT, nema, and dm just like windows or open wrt would. Seems impossible to get any cdc host libraries to compile! I really don’t like using vs code with expressif idf extension very clunky. Id prefer ardunio IDE.

Any examples for this kind of host code.

lichurbagan
Posts: 59
Joined: Thu Nov 13, 2025 3:20 pm

Re: Host library help for esp32

Postby lichurbagan » Fri Dec 05, 2025 10:28 am

Right now, Arduino-ESP32 does not support USB-Host (CDC-Host, HID-Host, MSC-Host) on the ESP32-S3.
Only USB-Device mode is fully supported in Arduino.

USB-OTG host mode does work perfectly in ESP-IDF (with TinyUSB), but Arduino does not expose the host-side APIs yet.

X86Jamie
Posts: 5
Joined: Thu Dec 04, 2025 12:56 pm

Re: Host library help for esp32

Postby X86Jamie » Fri Dec 05, 2025 12:22 pm

I have vs code with expressif extension and tried v4, v5 nothing compiles when trying to use cdc host libraries. I do not see config settings for cdc host or tiny USB stack enable. It is very difficult. And the vs code extension is so clunky and slow on a decant low end gaming laptop.

Any other IDE? And what settings for config for my esp32s3-wroom-1. Any example code for modem communication over usb, and esp acting as host? I’ll take an example using any IDE:)

Thanks so much.

X86Jamie
Posts: 5
Joined: Thu Dec 04, 2025 12:56 pm

Re: Host library help for esp32

Postby X86Jamie » Sat Dec 06, 2025 2:53 pm

I’m now using windows Powershell and esp-idf-4.4 directly! This is the fastest way to compile!

I found this https://gitlab.informatik.uni-bremen.de ... t_bg96.cpp

It compiled and loaded no problem. But the debug output says it’s failing to enumerate my device. I’m wondering if this is not compatible with my chip? Or if need to down grade the ships base instruct set … if possible?

Otherwise maybe the config settings need to be changed from default?

nopnop2002
Posts: 347
Joined: Thu Oct 03, 2019 10:52 pm
Contact:

Re: Host library help for esp32

Postby nopnop2002 » Sun Dec 07, 2025 12:52 pm

Here is official example.
https://github.com/espressif/esp-idf/tr ... s/usb/host

You need external USB CONNECTOR.

Code: Select all

ESP BOARD       USB CONNECTOR (type A)
                   --
[5V] -----------> | || VBUS (5V)
[GPIO19]  ------> | || D-
[GPIO20]  ------> | || D+
[GND] ----------> | || GND
                   --

X86Jamie
Posts: 5
Joined: Thu Dec 04, 2025 12:56 pm

Re: Host library help for esp32

Postby X86Jamie » Wed Dec 10, 2025 12:57 pm

Thanks. But that example doesn’t do me any good.

I need the CDC/host/bg96 modem example from Version 5.0 beta. Why was it dropped? It kinda worked as in I was able to send at commands to modem via otg cdc uart.

The trouble is esp-idf doesn’t support blynk Arduino libraries until version 5.1, which is when they dropped the bg96 modem example.

I tried to move the bg96 code over to the 5.1 version it was a never ending nightmare of differences and never compiled.

Next I in the Arduino ported cdc example I linked at the beginning I ported it to use the bg96 code and it worked. It’s just very buggy keeps dropping connections for no reason even though I have a minimal sketch and good signal strength.

Also every other power cycle it seems I need to physically unplug then hot plug the modem back in order for it to enumerate again on the esp32!!

Such a nightmare! Why isn’t this better supported? Why say it does otg cdc host usb when there is such limited offerings? I bought the more expensive esp32 for that exact reason!

nopnop2002
Posts: 347
Joined: Thu Oct 03, 2019 10:52 pm
Contact:

Re: Host library help for esp32

Postby nopnop2002 » Thu Dec 11, 2025 1:41 am

I tried to move the bg96 code over to the 5.1 version it was a never ending nightmare of differences and never compiled.

The cdc_acm_bg96 sample code was able to build with ESP-IDF V5.5.
I don't have a Quectel BG96 LTE/GPS so I'm not sure if it will work properly.
The usb_host_cdc_acm component must use V1.

Code: Select all

## IDF Component Manager Manifest File
dependencies:
  idf: ">=4.4"
  igrr/libnmea: "^0.1.1"
  usb_host_cdc_acm: "1.*"
Attachments
cdc_acm_bg96.jpg
cdc_acm_bg96.jpg (174.48 KiB) Viewed 3425 times

X86Jamie
Posts: 5
Joined: Thu Dec 04, 2025 12:56 pm

Re: Host library help for esp32

Postby X86Jamie » Thu Dec 11, 2025 12:45 pm

5.5 has cdc bg96 in public repo? Or you have to manually add it? Thanks I’ll give this a try.

If you don’t have a bg96 but have a bg95, ec25, any of them and likely more will work. You just have to change the device vid, or pid to match.

nopnop2002
Posts: 347
Joined: Thu Oct 03, 2019 10:52 pm
Contact:

Re: Host library help for esp32

Postby nopnop2002 » Thu Dec 11, 2025 11:57 pm

>5.5 has cdc bg96 in public repo?

No.

>Or you have to manually add it?

Yes.

You can get fron here.
https://github.com/espressif/esp-idf/tr ... c_acm_bg96

Who is online

Users browsing this forum: Baidu [Spider], meta-externalagent, PetalBot and 9 guests