Skip to content
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

Upgrade TinyUSB to v0.16.0, allow dual role operations, fix HS port operations #1116

Merged
merged 6 commits into from Jan 5, 2024

Conversation

salkinium
Copy link
Member

@salkinium salkinium commented Jan 3, 2024

Had a look at what TinyUSB is capable of now, it doesn't prevent you anymore from running Device and Host at the same time, so I refactored the code to allow generating both.

Also fixed some very embarrassing oversight of not configuring the USB pins for high speed, which prevented the ULPI signals from working. In addition, the HS port can also be used in FS mode, in which case the ULPI clock must remain disabled! This is now correctly being done, together with the GPIO config.

I don't have a way to test host mode, due to lack of the correct adapter. I would do that later and fix whatever is broken then.

TinyUSB changes:

  • Upgrade TinyUSB to v0.16.0.
  • Allow Device and Host to run on the same device on separate ports.
  • Allow to downgrade the HS port speed to FS.
  • Correctly partition the device class files for host and device, incl. shared files.

STM32 changes:

  • Validate the ULPI signals on HS port on STM32 while also allowing to connect FS signals.
  • Configure pins for high speed on STM32 USB ports.
  • Split off the USBOTGHSULPI clock into it's own peripheral so that HS port in FS mode works.
  • Moved the all_peripherals generator to :cmsis:device:peripherals query.
  • DISCO-F429ZI BSP gets a logger, it requires closing SB11/SB15 and upgrading the STLink firmware.

Tested:

  • Device Mode:
    • generic/usb:
      • Black-Pill-F401 (cannot find the F411 version)
      • DISCO-F072RB
      • DISCO-F407VG
      • DISCO-F429ZI: new, didn't work before
      • DISCO-F469NI: new, didn't work before
      • DISCO-F746G: FS port
      • DISCO-F746G: HS port, new, didn't work before
      • DISCO-L476VG
      • NUCLEO-F429ZI
      • NUCLEO-H723ZG: new, didn't work before
      • NUCLEO-H743ZI: new, didn't work before
      • RP Pico
      • SAMD21 Mini
    • f3_discovery/dfu:
      • DISCO-F303VC
  • Host mode
  • Dual Mode
  • Documentation

@salkinium salkinium force-pushed the feature/upgrade_tinyusb branch 5 times, most recently from ca5e61f to a1f923d Compare January 4, 2024 10:29
@salkinium salkinium added the ci:hal Triggers the exhaustive HAL compile CI jobs label Jan 4, 2024
@salkinium salkinium marked this pull request as ready for review January 4, 2024 15:21
@salkinium salkinium removed the ci:hal Triggers the exhaustive HAL compile CI jobs label Jan 4, 2024
@salkinium salkinium added the ci:hal Triggers the exhaustive HAL compile CI jobs label Jan 4, 2024
@salkinium salkinium added ci:hal Triggers the exhaustive HAL compile CI jobs and removed ci:hal Triggers the exhaustive HAL compile CI jobs labels Jan 4, 2024
Copy link
Member

@rleh rleh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work :)
Thanks!

ext/hathach/module.md Show resolved Hide resolved
ext/hathach/tusb_port.cpp.in Outdated Show resolved Hide resolved
- Allow running device and host mode on separate ports at the same time.
- Allow speed selection of HS port.
- Correctly access all host and device class files.
To run the OTGHS port in FS mode the ULPI clock must be disabled.
The HS port can use both the DP and DM or the ULPI signals.
All signals *must* be configured for high speed though!
@salkinium salkinium merged commit 1f210c1 into modm-io:develop Jan 5, 2024
13 checks passed
@salkinium salkinium deleted the feature/upgrade_tinyusb branch January 5, 2024 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants