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

Add support to STM32 USB OTG-HS to re-define what is passed into HAL_SYSCFG_SetOTGPHYReferenceClockSelection() #79823

Closed
erikarn opened this issue Oct 15, 2024 · 0 comments · Fixed by #82540
Assignees
Labels
area: USB Universal Serial Bus Enhancement Changes/Updates/Additions to existing features platform: STM32 ST Micro STM32

Comments

@erikarn
Copy link

erikarn commented Oct 15, 2024

Is your enhancement proposal related to a problem? Please describe.

The current Zephyr STM32 USB OTG-HS driver hard-codes a 16MHz clock source into the HSE clock.

From drivers/usb/device/usb_dc_stm32.c:

    HAL_SYSCFG_SetOTGPHYReferenceClockSelection(SYSCFG_OTG_HS_PHY_CLK_SELECT_1);

This means if you're using a different clock (in my case a 24MHz crystal), it needs a code change.

In my case I'm using an STMU5 part, the definitions are in the STM32 HAL:

stm32cube/stm32u5xx/drivers/include/stm32u5xx_hal.h

Update Oct 16 - I've now verified that changing it to SELECT_4 works fine for my 24MHz crystal on the board.

Describe the solution you'd like

It would be nice to either show up as a device-tree config, or a Kconfig option. I'm going to prototype both.

Describe alternatives you've considered

Additional context

@erikarn erikarn added the Enhancement Changes/Updates/Additions to existing features label Oct 15, 2024
@nordicjm nordicjm added the platform: STM32 ST Micro STM32 label Oct 15, 2024
@nordicjm nordicjm added the area: USB Universal Serial Bus label Oct 15, 2024
@erwango erwango assigned marwaiehm-st and unassigned erwango Oct 15, 2024
erikarn pushed a commit to erikarn/zephyr that referenced this issue Dec 3, 2024
…ephyrproject-rtos#79823)

This board has the required clock crystal (X4) and jumper settings
present to enable the USB 2.0 HS support.

* Enable the HSE clock (16MHz)
* Flip the PLL1 configuration over to use the HSE clock, but still
  outputting 160MHz to sysclk/apbclk.
* Add the USB HS device tree node.
* Update the board documentation.

Signed-off-by: Adrian Chadd <adrian.chadd@meta.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: USB Universal Serial Bus Enhancement Changes/Updates/Additions to existing features platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants