OTG Host on ESP32-S2?

ungato
Posts: 1
Joined: Tue Jun 16, 2020 3:27 am

OTG Host on ESP32-S2?

Postby ungato » Tue Jun 16, 2020 3:40 am

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

User avatar
fasani
Posts: 197
Joined: Wed Jan 30, 2019 12:00 pm
Location: Barcelona
Contact:

Re: OTG Host on ESP32-S2?

Postby fasani » Tue Jun 16, 2020 9:49 am

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
epdiy collaborator | http://fasani.de Fan of Espressif MCUs and electronic design

ESP_Sprite
Posts: 9709
Joined: Thu Nov 26, 2015 4:08 am

Re: OTG Host on ESP32-S2?

Postby ESP_Sprite » Tue Jun 16, 2020 10:40 am

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.)

jcwren
Posts: 6
Joined: Mon May 29, 2017 2:22 am

Re: OTG Host on ESP32-S2?

Postby jcwren » Thu Jun 25, 2020 1:27 am

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.

ESP_Sprite
Posts: 9709
Joined: Thu Nov 26, 2015 4:08 am

Re: OTG Host on ESP32-S2?

Postby ESP_Sprite » Thu Jun 25, 2020 7:36 am

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.

chegewara
Posts: 2362
Joined: Wed Jun 14, 2017 9:00 pm

Re: OTG Host on ESP32-S2?

Postby chegewara » Thu Jun 25, 2020 8:31 am

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.

jcwren
Posts: 6
Joined: Mon May 29, 2017 2:22 am

Re: OTG Host on ESP32-S2?

Postby jcwren » Thu Jun 25, 2020 12:55 pm

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.

istokm
Posts: 27
Joined: Thu Jun 25, 2020 12:11 pm

Re: OTG Host on ESP32-S2?

Postby istokm » 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

jcwren
Posts: 6
Joined: Mon May 29, 2017 2:22 am

Re: OTG Host on ESP32-S2?

Postby jcwren » Thu Jun 25, 2020 3:58 pm

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.

Who is online

Users browsing this forum: No registered users and 119 guests