USB Host not working on "ESP32-S3-USB-OTG Development Board"

Kevin_512
Posts: 3
Joined: Wed Jan 05, 2022 2:18 pm

USB Host not working on "ESP32-S3-USB-OTG Development Board"

Postby Kevin_512 » Fri Apr 01, 2022 9:03 am

I bought the ESP32-S3-USB-OTG Development Board specifically to use the USB Host functionality but I have not been able to make it to work. It always stops after "CLASS: Registering Client"

Code: Select all

git checkout master
git submodule update --init --recursive
I have tried the following examples on Master branch [69c95bf98306b58d2e8ebca3860dedc9241db68f]:
  • esp-idf/examples/peripherals/usb/host/usb_host_lib
  • esp-idf/examples/peripherals/usb/host
Full output of monitor:

Code: Select all

idf.py monitor -p $PORT
Executing action: monitor
Running idf_monitor in directory /Users/username/esp/esp-idf-latest/esp-idf/examples/peripherals/usb/host/usb_host_lib
Executing "/Users/username/.espressif/python_env/idf5.0_py3.9_env/bin/python /Users/username/esp/esp-idf-latest/esp-idf/tools/idf_monitor.py -p /dev/cu.SLAB_USBtoUART -b 115200 --toolchain-prefix xtensa-esp32s3-elf- --target esp32s3 /Users/username/esp/esp-idf-latest/esp-idf/examples/peripherals/usb/host/usb_host_lib/build/usb_host_lib_example.elf -m '/Users/username/.espressif/python_env/idf5.0_py3.9_env/bin/python' '/Users/username/esp/esp-idf-latest/esp-idf/tools/idf.py'"...
--- idf_monitor on /dev/cu.SLAB_USBtoUART 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0110,len:0x18d0
load:0x403b6000,len:0xb70
load:0x403b9000,len:0x31b0
entry 0x403b6240
I (24) boot: ESP-IDF v5.0-dev-2326-g36b83fcb98 2nd stage bootloader
I (25) boot: compile time 16:55:32
I (25) boot: chip revision: 0
I (28) boot.esp32s3: Boot SPI Speed : 80MHz
I (33) boot.esp32s3: SPI Mode       : DIO
I (37) boot.esp32s3: SPI Flash Size : 2MB
I (42) boot: Enabling RNG early entropy source...
I (48) boot: Partition Table:
I (51) boot: ## Label            Usage          Type ST Offset   Length
I (58) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (66) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (73) boot:  2 factory          factory app      00 00 00010000 00100000
I (81) boot: End of partition table
I (85) esp_image: segment 0: paddr=00010020 vaddr=3c020020 size=0a9d0h ( 43472) map
I (101) esp_image: segment 1: paddr=0001a9f8 vaddr=3fc91370 size=02b78h ( 11128) load
I (104) esp_image: segment 2: paddr=0001d578 vaddr=40374000 size=02aa0h ( 10912) load
I (113) esp_image: segment 3: paddr=00020020 vaddr=42000020 size=1ec00h (125952) map
I (141) esp_image: segment 4: paddr=0003ec28 vaddr=40376aa0 size=0a8d0h ( 43216) load
I (151) esp_image: segment 5: paddr=00049500 vaddr=50000000 size=00010h (    16) load
I (157) boot: Loaded app from partition at offset 0x10000
I (157) boot: Disabling RNG early entropy source...
I (171) cpu_start: Pro cpu up.
I (171) cpu_start: Starting app cpu, entry point is 0x4037513c
0x4037513c: call_start_cpu1 at /Users/username/esp/esp-idf-latest/esp-idf/components/esp_system/port/cpu_start.c:152

I (0) cpu_start: App cpu up.
I (185) cpu_start: Pro cpu start user code
I (186) cpu_start: cpu freq: 160000000 Hz
I (186) cpu_start: Application information:
I (189) cpu_start: Project name:     usb_host_lib_example
I (195) cpu_start: App version:      v5.0-dev-2326-g36b83fcb98
I (201) cpu_start: Compile time:     Apr  1 2022 16:55:21
I (207) cpu_start: ELF file SHA256:  13b49b0ab9ae4ab2...
I (213) cpu_start: ESP-IDF:          v5.0-dev-2326-g36b83fcb98
I (220) heap_init: Initializing. RAM available for dynamic allocation:
I (227) heap_init: At 3FC948F0 len 0004B710 (301 KiB): D/IRAM
I (233) heap_init: At 3FCE0000 len 0000EE34 (59 KiB): STACK/DRAM
I (240) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (246) heap_init: At 600FE000 len 00002000 (8 KiB): RTCRAM
I (253) spi_flash: detected chip: gd
I (257) spi_flash: flash io: dio
W (261) spi_flash: Detected size(8192k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (274) sleep: Configure to isolate all GPIO pins in sleep state
I (281) sleep: Enable automatic switching of GPIO sleep configuration
I (288) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (308) DAEMON: Installing USB Host Library
I (338) CLASS: Registering Client

Jamawa
Posts: 16
Joined: Sun Aug 16, 2020 10:46 am

Re: USB Host not working on "ESP32-S3-USB-OTG Development Board"

Postby Jamawa » Fri Apr 01, 2022 8:04 pm

I have the kit and it does work as host, and the usb-host-lib example should give you the USB descriptors of the device you’re connecting, from the looks of it.
Did you route the the USB signals to the host connector and enable the power on it? Both need to be done for the ESP32 to function as host.
The block diagram on https://docs.espressif.com/projects/esp ... guide.html shows what I mean.
The code for this routing is not part of the examples and need to be added (as the examples are generic examples).

I power my devices using the “USB A male to PC” connection in the block diagram of, with the power switch off (option 2 from the section Power Supply Options on that page)
Programming and logging as usual using the micro-USB plug, works just fine.

Kevin_512
Posts: 3
Joined: Wed Jan 05, 2022 2:18 pm

Re: USB Host not working on "ESP32-S3-USB-OTG Development Board"

Postby Kevin_512 » Wed Apr 06, 2022 6:50 am

Hi Jamawa,

Thank you so much for the response! I got it working eventually. It took a few more hours of trial and error to realise that one of the configurations required was LIMIT_EN

For anyone else planning to run the examples, you can add these two lines to the example code, and put the file I have created in the source folder.

Code: Select all

#include "usb_otg_esp32_s3_additions.h"
Call the function before trying to use the USB host capabilities.

Code: Select all

void app_main(void)
{
    usb_host_power_init();
...    
Important configurations
  • DEV_VBUS_EN (GPIO_NUM_12) configured as HIGH.
    // Purpose: Powers USB_HOST (USB-A socket/receptacle) with power from the USB_DEV port (USB-A plug) as opposed to the battery
    // [Therefore we should set the battery switch to OFF when using this mode]
  • BOOST_EN (GPIO_NUM_13) configured as LOW.
    // Purpose: Avoids undefined behaviour. Disable when using USB power, as we do not need the boost functionality.
    // The boost IC can raise the battery voltage from 3.5 to 5 when enabled.
  • IDEV_LIMIT_EN (GPIO_NUM_17) configured as HIGH.
    // Purpose: Enables voltage to leave the current limiting IC (Vout)
  • USB_SEL (GPIO 18) configured as HIGH.
    // Purpose: Determines whether signals are routed to either the USB_HOST or the USB_DEV
Github repo: https://github.com/MGZ-LLC/esp32_s3_usb_otg_additions

Attached file:
Attachments
usb_otg_esp32_s3_additions.h
File to include for esp32-s3-usb-otg
(3.34 KiB) Downloaded 387 times

gautam-dev-maker
Posts: 3
Joined: Mon Jul 11, 2022 9:47 pm

Re: USB Host not working on "ESP32-S3-USB-OTG Development Board"

Postby gautam-dev-maker » Mon Jul 11, 2022 10:39 pm

Hi Kevin,

I am facing the same issue with ESP32-S3-DevKitC-1. I tried your solution, but it wasn't working on my chip. Is there any other way to power the USB port?

Thanks in advance.

Kevin_512
Posts: 3
Joined: Wed Jan 05, 2022 2:18 pm

Re: USB Host not working on "ESP32-S3-USB-OTG Development Board"

Postby Kevin_512 » Mon Aug 22, 2022 8:31 am

gautam-dev-maker wrote:
Mon Jul 11, 2022 10:39 pm
Hi Kevin,

I am facing the same issue with ESP32-S3-DevKitC-1. I tried your solution, but it wasn't working on my chip. Is there any other way to power the USB port?

Thanks in advance.
Hi gautam-dev-maker,

I am not aware of other ways to power the USB port.

Have you been able to get it working since you posted this?

gautam-dev-maker
Posts: 3
Joined: Mon Jul 11, 2022 9:47 pm

Re: USB Host not working on "ESP32-S3-USB-OTG Development Board"

Postby gautam-dev-maker » Tue Dec 27, 2022 12:31 pm

Kevin_512 wrote:
Mon Aug 22, 2022 8:31 am
gautam-dev-maker wrote:
Mon Jul 11, 2022 10:39 pm
Hi Kevin,

I am facing the same issue with ESP32-S3-DevKitC-1. I tried your solution, but it wasn't working on my chip. Is there any other way to power the USB port?

Thanks in advance.
Hi gautam-dev-maker,

I am not aware of other ways to power the USB port.

Have you been able to get it working since you posted this?
Yes, I got it working, it was a simple wiring mistake from my end.

Thank you.

esp_fpv
Posts: 1
Joined: Mon Jan 30, 2023 11:38 am

Re: USB Host not working on "ESP32-S3-USB-OTG Development Board"

Postby esp_fpv » Mon Jan 30, 2023 11:46 am

gautam-dev-maker wrote:
Mon Jul 11, 2022 10:39 pm
Hi Kevin,

I am facing the same issue with ESP32-S3-DevKitC-1. I tried your solution, but it wasn't working on my chip. Is there any other way to power the USB port?

Thanks in advance.
There is a hardware solution only to route 5V to VBUS:
Shorten diode D7 or connect D7 anode to Pin VCC_5V.

Ignore the GPIO settings for the ESP32-S3-USB-OTG board.

I would connect self powered devices only to the modified port, like a printer!

I don't know why they have an unused label VBUSB in the schematics.

Who is online

Users browsing this forum: Google [Bot] and 86 guests