-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cpu/esp32: add periph_usbdev for ESP32-S2 and ESP32S3 #18624
Conversation
This file is an excerpt of STM32 header file `stm32/smsis/f7/include/stm32f767xx.h` since the ESP32x SoCs use the same Synopsys DWC2 IP core as USB peripherals.
Since the ESP32x SoCs integrate the same Synopsys DWC2 IP core as STM32 as USB peripherals, the driver is just a copy of `cpu/stm32/periph/usbdev_otg.c`, where the identifiers `stm32_*` and `STM32_*` have simply been replaced by `esp32_*` and `ESP32_*` respectively. Only the function `_usbdev_init` has been slightly changed.
a174ac6
to
90a6408
Compare
How about introducing a folder |
Indeed, it already worked with some Wouldn't The question is whether we should continue with this PR an separate drivers for now to support USB on the ESP32x SoC in the short term and de-duplicate the code later by merging them. |
How much work would it be to move this to a common place instead? Apart from clock setup, are there any esp32/stm32 specific changes to the code? |
Not very much. The most difficult problem will be to deal with the differences in the peripheral configuration. ESP32 needs only a small subset, in fact only the type of OTG controller and the peripheral address. Probably, we can use inheritance as for other data types like
No. |
This can be closed now, right? |
Closed in favor of PR #18644 |
Contribution description
This PR adds
periph_usbdev
driver for ESP32-S2 and ESP32-S3.It is an alternative to PR #18592 for using ESP32x USB peripherals with RIOT's
usbus
modules. It does not make PR #18592 obsolete as the tinyUSB stack provides a complete host and device stack.Please note:
cpu/stm32/periph/usbdev_otg.c
, where the identifiersstm32_*
andSTM32_*
have simply been replaced byesp32_*
andESP32_*
respectively. Only the function_usbdev_init
has been slightly changed.cpu/esp32/vendor/include/usbdev_esp32.h
is just an excerpt of filestm32/cmsis/f7/include/stm32f767xx.h
because the STM32F767xx uses the same Synopsys DWC2 IP core version and is therefore compatible with ESP32x SoCs.Testing procedure
tests/usbus_hid
dmesg
command and check the USB HID devices was found/dev/hidrawX
device to which you can write asroot
characters that are echoed in console window, for example:tests/usbus_ecm
ethtool
must show the USB CDC ECM interface as link detected:Issues/PRs references