-
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
drivers: add driver for Synopsys DWC2 that is used as USB OTG peripheral on STM32 and ESP32x SoCs #18644
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, that's the way to go 😃
Works like a charm (I only tested on STM32, the only ESP32x board I have that has a USB port directly connected to the MCU is ESP32-C3), just two small nitpicks:
ff7d953
to
79c3baf
Compare
79c3baf
to
c422d45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please squash!
Oops ...
|
Since `esp_can.h` is included by main `cpu/esp32/include/periph_cpu.h` after the include of the specific `periph_cpu_$(CPU_FAM)`, it is not necessary to include `esp_can.h` in each specific `periph_cpu_$(CPU_FAM)`.
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.
c422d45
to
890acb4
Compare
Yea comsys ran out of space after the update to Ubuntu 22.04 |
Looks like the auto-merge of the jammy fixes came in to late. I'll restart the CI run, so that no unrelated issued pop up in the build log. |
I restarted the CI run an restored the CI queue in the same order it was before. |
Looks like CI is back to normal now - thank you for providing all this 😃 Btw: Does the ESP-C3 use the same peripheral or does this require more changes? |
Unfortunatly not. ESP32-C3 uses a special USB Serial/JTAG controller which is an USB CDC ACM device with fixed configuration. If at all, we could only develop a driver which then only supports the CDC ACM class. ESP32-S2 and ESP32-S3 have this USB Serial/JTAG controller in addition to the USB OTG controller. |
890acb4
to
13eadda
Compare
@benpicco Thanks for reviewing and merging. |
Contribution description
This PR adds a driver for the Synopsys DWC2 IP core. It is an alternative to PR #18624 which avoids a lot of code duplication. STM32 as well as ESP32x SoCs use the Synopsys DWC2 core. According to tinyUSB documentation, EFM32GG12 and GD32VF103 also integrate the Synopsys DWC2 core.
Instead of copying the code from STM32's
periph/usbdev_otg.c
and modifying it very slightly only for ESP32x SoCs (as done in PR #18624), the code is now moved to a common location and extended by only a very small number of MCU-Specific changes. The Namespace is changed fromstm32
todwc2
. STM32 and ESP32x SoCs use the driver asperiph_usbdev
driver.Testing procedure
The following tests have to work for an ESP32 node as well as a STM32 node to check whether it is still working for STM32.
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