Page 1 of 1

OTG Host on ESP32-S2?

Posted: Tue Jun 16, 2020 3:40 am
by ungato
Hello!

I have an ESP32-S2 development board, an ESP32-S2-Saola-1M. I would like to use it to read keypresses from a wireless keyboard's USB receiver. From what I can tell, the ESP32-S2 is capable of being a USB OTG Host in silicon, but it is not supported from within esp-idf, as only device mode is supported using the tinyusb stack.

I want to write my own "driver" to be able to use the ESP32-S2's USB host capability to communicate with the keyboard. But I am pretty confused with how to interact with the USB registers needed to do this, as I am used to just using the built-in esp-idf drivers.

Does anyone have any pointers regarding how to set the USB OTG D+/D- pins, read/write to its FIFO, the registers I would need to use and the interrupt routines I would need to write? I'm looking through the ESP32-S2 manual and it's not clear to me exactly what I need to do to make such code work.

Thanks

Re: OTG Host on ESP32-S2?

Posted: Tue Jun 16, 2020 9:49 am
by fasani
I'm also interested like ungato to know more about OTG host in the S2. It's definitivaly one very interesting feature!
Please let us know some details

Re: OTG Host on ESP32-S2?

Posted: Tue Jun 16, 2020 10:40 am
by ESP_Sprite
Sorry, it's not trivial, we do not have host code out yet (is in progress) and afaik the USB portion of the TRM is not out yet... so at the moment I can't tell you much more than to please wait a bit until we proceed with that. (Alternatively, it theoretically may be possible to port a host driver from some other chip that has a DWC-OTG USB peripheral, but without the TRM that may be hard as well.)

Re: OTG Host on ESP32-S2?

Posted: Thu Jun 25, 2020 1:27 am
by jcwren
Seems pretty odd that everything regarding the ESP32-S2 is touting it's USB OTG, yet there is absolutely no support for it anywhere.

It's kind of hard to design a product based on the promise of USB OTG if there's no support for it.

Re: OTG Host on ESP32-S2?

Posted: Thu Jun 25, 2020 7:36 am
by ESP_Sprite
Well, it's a new chip... it's even harder to develop a fully functioning, release-ready driver for a chip we don't have yet, and after it's out it usually takes a while for all the drivers to be written. The other way to go would be to only release a new chip once support for it is 100% complete, which mean you'd have to wait a few months longer for it. We prefer the 'release early, release often' scheme.

Re: OTG Host on ESP32-S2?

Posted: Thu Jun 25, 2020 8:31 am
by chegewara
As much as i would like to start with usb host i like this approach even more
ESP_Sprite wrote:We prefer the 'release early, release often' scheme.
We have time to get started with new API that is partially ready, like usb device for example. In few week i learned a lot and i still have time to learn before it is ready, and i know folks that cant wait to get TWAI ready to go.
USB host is just a part of new features. To be honest ive been very skeptical about esp32 S2 after seeing specs. I thought it is chip designed mostly to support AWS freertos, with all extra efuses and encryption stuff, but now i am having so much fun with usb so i dont really care about aws. And of course there is or will be wifi ToF.

Re: OTG Host on ESP32-S2?

Posted: Thu Jun 25, 2020 12:55 pm
by jcwren
The problem I have is there's no disclaimer anywhere that I can find that USB OTG firmware support doesn't exist.

At the very least the API docs should include an entry for it and a note in parenthesis or a paragraph that states it's status.

The only real reason I can see for choosing an ESP32-S2 over the ESP32 is the USB OTG and possibly the Time Of Flight function. I have a couple projects and products in mind where USB OTG + WiFi is useful. And they only thing that makes it useful isn't supported yet. So I have 2 WROOM modules, 2 WROVER modules, 2 SALOA WROOM boards, 2 SALOA WROVER boards,2 Cucumber RI boards, and a Cucumber RIS board that are effectively useless to me at this point.

Sure, perhaps I should have read the entire docs site before getting excited and purchasing the eval boards, but I would have never imagined that a product whose only real claim to fame is one feature wouldn't have that feature supported.

FWIW, I'm primarily interest in OTG host support for VCP and HID devices.

Re: OTG Host on ESP32-S2?

Posted: Thu Jun 25, 2020 1:41 pm
by istokm
There is a official post about ESP-IDF support for new ESP32-S2 features. I found it while looking for WiFi ToF documentation so it's not actually that hard to find.

https://esp32.com/viewtopic.php?f=10&t=14532

Re: OTG Host on ESP32-S2?

Posted: Thu Jun 25, 2020 3:58 pm
by jcwren
Marek Ištok wrote:
Thu Jun 25, 2020 1:41 pm
There is a official post about ESP-IDF support for new ESP32-S2 features. I found it while looking for WiFi ToF documentation so it's not actually that hard to find.

https://esp32.com/viewtopic.php?f=10&t=14532
Still should be in the docs, not some random post. Also, that list hasn't been updated in over 6 weeks.