I would like to use USB host on ESP32-S2 in ESP-IDF
Re: I would like to use USB host on ESP32-S2 in ESP-IDF
cannot open source file "hal/usb_types_private.h"
Re: I would like to use USB host on ESP32-S2 in ESP-IDF
Yes, there is error in README, it was a bug in logs, but it is also fixed in most recent update in both repositories.
Those repositories are not production ready, but after adding few more esp_err_t checks from esp-idf function and it should be pretty stable code. The thing is esp-idf is supporting only BULK endpoint type so far, which means you are limited to devices that are not using INT or ISO. I was not sure how to handle port and pipes events and i decided to support both, callbacks and events handler, letting users to pick. I also decided to completely ignore polling option, as you can use it without my implementation.
CDC-ACM driver also was initially tested with device based on esp32 S2 and app from arduino.
As for hardware, you dont need anything but wires. Here is description:
https://docs.espressif.com/projects/esp ... s/usb.html
https://docs.espressif.com/projects/esp ... s/dfu.html
Did you update esp-idf to most recent master? Latest update is from yesterday.ploegmma wrote:cannot open source file "hal/usb_types_private.h"
Re: I would like to use USB host on ESP32-S2 in ESP-IDF
Thanks. Any photo of how you connected your dev board to the USB device? I have an ESP32-S2-saola-1 V1.2
Re: I would like to use USB host on ESP32-S2 in ESP-IDF
Thanks. From what I gathered in the docs and inspecting my dev board, there are no serial resistors on the D+ and D- lines. I couldn't find any information on the documents regarding what value of serial resistors for inline with D+ and D-, which worries me. The only place I saw them is on S2-WROVER "6 Peripheral Schematics" with two zero-ohm resistors R4 and R6. I know it's not that big of a deal for a mere USB 1.1 host but it's good to know what values to have. I'm used to MAX3421E usb 1.1 host, which requires 33 ohm serial resistors.
Re: I would like to use USB host on ESP32-S2 in ESP-IDF
Here is my breadboard setup. There is more elements than you need, because sometimes i am using it to do passthru to PC and i am connecting logic analyzer to see packets.
Re: I would like to use USB host on ESP32-S2 in ESP-IDF
I dont know MAX3421E, but on S2 saola i dont need any resistors.zliudr wrote: ↑Fri Apr 30, 2021 3:52 amThanks. From what I gathered in the docs and inspecting my dev board, there are no serial resistors on the D+ and D- lines. I couldn't find any information on the documents regarding what value of serial resistors for inline with D+ and D-, which worries me. The only place I saw them is on S2-WROVER "6 Peripheral Schematics" with two zero-ohm resistors R4 and R6. I know it's not that big of a deal for a mere USB 1.1 host but it's good to know what values to have. I'm used to MAX3421E usb 1.1 host, which requires 33 ohm serial resistors.
Re: I would like to use USB host on ESP32-S2 in ESP-IDF
chegewara, I really apreciate your help.
Were you able to get Bulk endpoints working? Whenever I try to initiate a transfer the pipe goes into a halted hcd_pipe_state and reports a generic error.
Also, I took your code and made a libusb inspired API for hcd. You can see it here.
https://github.com/chipweinberger/xesp- ... ain/main.c
If you're curious to look at my code, the halting problem happens in main.c when I call xesp_usbh_xfer_from_pipe(midi_pipe_in, data_buff);
I've tried a million ways of setting up the transfer, but no luck yet.
Were you able to get Bulk endpoints working? Whenever I try to initiate a transfer the pipe goes into a halted hcd_pipe_state and reports a generic error.
Also, I took your code and made a libusb inspired API for hcd. You can see it here.
https://github.com/chipweinberger/xesp- ... ain/main.c
If you're curious to look at my code, the halting problem happens in main.c when I call xesp_usbh_xfer_from_pipe(midi_pipe_in, data_buff);
I've tried a million ways of setting up the transfer, but no luck yet.
Re: I would like to use USB host on ESP32-S2 in ESP-IDF
Hope I have time to check this out in the summer. I can probe with my USB analyzer. I just did some probing to answer an Arduino forum problem on MAX3421E hardware with UHS V2.0 library. Turns out some driver routine probably didn't turn on retry or something so that a set_address command didn't actually keep polling for IN and just gave up. And a more generic sample code with no device-specific driver was able to keep polling a dozen times and the device eventually responded with IN, as the status stage of control transfer. I wonder if there's similar issues with this host stack. Is anyone using USB analyzers to help debug? I'm using Beagle. It's been big help. If you do PC-based USB device-class stuff, you can scrape by with WireShark but with host-class stuff, you need a hardware analyzer or you're just shooting blind.
Re: I would like to use USB host on ESP32-S2 in ESP-IDF
Yes! found the issue. When I open the bulk endpoint the usb device address is no longer zero. I needed that number to be dynamic. Totally overlooked that.
hcd_pipe_config_t config = {
.callback = pipe_isr_callback,
.callback_arg = (void *)port,
.context = NULL,
.ep_desc = use_ep0 ? NULL : ep,
.dev_addr = 0, // Bug! This needed to be the updated device address
.dev_speed = port_speed,
};
hcd_pipe_config_t config = {
.callback = pipe_isr_callback,
.callback_arg = (void *)port,
.context = NULL,
.ep_desc = use_ep0 ? NULL : ep,
.dev_addr = 0, // Bug! This needed to be the updated device address
.dev_speed = port_speed,
};
Who is online
Users browsing this forum: Bing [Bot] and 119 guests