Skip to content

drivers: usb: udc: stm32: implement proper isochronous support for ST USB IP #105151

Merged
nashif merged 3 commits intozephyrproject-rtos:mainfrom
mathieuchopstm:topic/stm32_stusb_isochronous_support
Mar 24, 2026
Merged

drivers: usb: udc: stm32: implement proper isochronous support for ST USB IP #105151
nashif merged 3 commits intozephyrproject-rtos:mainfrom
mathieuchopstm:topic/stm32_stusb_isochronous_support

Conversation

@mathieuchopstm
Copy link
Copy Markdown
Contributor

The ST USB IP (compatible st,stm32-usb) supports two different modes of operation for each endpoint:

  • single-buffered mode
    • Each direction (e.g., EP0 IN / EP0 OUT) uses a single USB SRAM buffer and a single buffer descriptor register to perform transfers
  • double-buffered
    • A single direction (e.g., EP1 OUT) uses two USB SRAM buffers and two buffer descriptor registers to perform transfers
      • (The two buffers are used similarly to front/back buffers in video apps)
    • The other direction (e.g., EP1 IN) cannot be used

Unlike others, isochronous endpoints must be double-buffered which requires special handling that, up until now, was not implemented in the driver. As such, it was possible to incorrectly configure the IP which could result in e.g. wrong data being sent to the USB bus.

Update the UDC driver to properly support isochronous operation with this IP. To this end, and due to stack architecture, three new Kconfig options are introduced:

  • UDC_STM32_STUSB_ISOCHRONOUS_SUPPORT: enables overall isochronous support
  • UDC_STM32_STUSB_ISO_OUT_EP_NUM / UDC_STM32_STUSB_ISO_IN_EP_NUM: used to reserve a fixed number of endpoints for isochronous operation (in either direction)
    • This is done because the stack does not allow placing constraints on another EP when one is being configured
    • However, it would be sufficient to:
      • mark EPn <OUT/IN> as not supporting isochronous mode once EPn <IN/OUT> has been configured in bulk/interrupt mode
      • mark EPn <OUT/IN> as not being available (no mode supported) once EPn <IN/OUT> has been configured in isochronous mode
    • If the endpoint configuration mechanism of the stack is updated in the future, this could be revisited

Tested OK on STM32H573I-DK with samples/subsys/usb/uac2_explicit_feedback (requires additional patches not provided here)

@zephyrbot zephyrbot added platform: STM32 ST Micro STM32 area: USB Universal Serial Bus labels Mar 9, 2026
@mathieuchopstm mathieuchopstm force-pushed the topic/stm32_stusb_isochronous_support branch 2 times, most recently from 433865a to 9ea9c3d Compare March 10, 2026 11:54
@mathieuchopstm mathieuchopstm added this to the v4.4.0 milestone Mar 10, 2026
erwango
erwango previously approved these changes Mar 16, 2026
@mathieuchopstm
Copy link
Copy Markdown
Contributor Author

Would appreciate review/+1 from an USB maintainer: @jfischer-no / @tmon-nordic / @josuah if one of you could please take a look 🙂

Comment thread drivers/usb/udc/udc_stm32.c Outdated
@mathieuchopstm
Copy link
Copy Markdown
Contributor Author

@tmon-nordic PTAL again

Move options such that all generic options go toghether, followed by
hardware-specific ones and wrap the HW-specific options in dedicated menus.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
@mathieuchopstm mathieuchopstm force-pushed the topic/stm32_stusb_isochronous_support branch from a32cbb6 to 4efa9cc Compare March 23, 2026 12:51
tmon-nordic
tmon-nordic previously approved these changes Mar 23, 2026
gautierg-st
gautierg-st previously approved these changes Mar 24, 2026
Comment thread drivers/usb/udc/Kconfig.stm32 Outdated
erwango
erwango previously approved these changes Mar 24, 2026
Update the copyright notice to use SPDX-FileCopyrightText. While at it, add
STMicroelectronics to the list of copyright holders as we have made
numerous contributions to this driver recently.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Implement proper support for isochronous operation when "st,stm32-usb" IP
is used. Previously, the driver did not take into account specificities of
this IP regarding isochronous endpoints resulting in invalid transfers.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
@mathieuchopstm mathieuchopstm force-pushed the topic/stm32_stusb_isochronous_support branch from 4efa9cc to 3aee3a2 Compare March 24, 2026 10:21
@mathieuchopstm
Copy link
Copy Markdown
Contributor Author

Fixed the typo reported by @gautierg-st and added STMicroelectronics to the copyright list of the driver in a preliminary commit while at it.

@sonarqubecloud
Copy link
Copy Markdown

@nashif nashif merged commit 0dd0a8f into zephyrproject-rtos:main Mar 24, 2026
27 checks passed
@mathieuchopstm mathieuchopstm deleted the topic/stm32_stusb_isochronous_support branch March 24, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: USB Universal Serial Bus platform: STM32 ST Micro STM32

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants