You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing USB host support for the CH32V203, and have identified ep_desc structures passed in to hcd_edpt_open() randomly being modified by observing ep_desc->wMaxPacketSize changing to nonsensical values due to the structure being allocated on the stack inside usbh_edpt_control_open():
Hi, it is by design, hcd driver need to maintain EP and transfer status internally since different HCDs behaves differently.
You can look at dwc2 example which has _hcd_data stuct.
Thank you for the clarification. I’ll add some comments to the HCD template about this to make it clearer for other new contributors, and send a PR soon. Unrelated, the CH32V203 HCD driver I’m writing is coming along nicely now, getting past assigning the device ID and starting enumeration!-- jpmOn 16 Apr 2025, at 18:21, HiFiPhile ***@***.***> wrote:
Hi, it is by design, hcd driver need to maintain EP and transfer status internally since different HCDs behaves differently.
You can look at dwc2 example which has _hcd_data stuct.
https://github.com/hathach/tinyusb/blob/bfe08176e516fede93dcd0bb3d43b4044fea25e4/src/portable/synopsys/dwc2/hcd_dwc2.c#L469—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
HiFiPhile left a comment (hathach/tinyusb#3083)
Hi, it is by design, hcd driver need to maintain EP and transfer status internally since different HCDs behaves differently.
You can look at dwc2 example which has _hcd_data stuct.
https://github.com/hathach/tinyusb/blob/bfe08176e516fede93dcd0bb3d43b4044fea25e4/src/portable/synopsys/dwc2/hcd_dwc2.c#L469
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
Operating System
Linux
Board
ch32v203c_r0_1v0
Firmware
examples/host/device_info
What happened ?
I'm writing USB host support for the CH32V203, and have identified
ep_desc
structures passed in tohcd_edpt_open()
randomly being modified by observingep_desc->wMaxPacketSize
changing to nonsensical values due to the structure being allocated on the stack insideusbh_edpt_control_open()
:I've added some extra logging to
usbh.c
, and this is what I'm getting:According to the linker script,
0x20004E88
is inside the stack:Which means
.stack
starts at0x20000000
+0x5000
-0x800
=0x20004800
I'm not sure of the best way to fix this, because all other uses of
tusb_desc_endpoint_t
are in higher-level drivers.For now, I'll fix EP0 wMaxPacketSize at 8 bytes to get it working.
How to reproduce ?
Reproduction in "What Happened"
Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)
Log in "What Happened"
Screenshots
No response
I have checked existing issues, dicussion and documentation
The text was updated successfully, but these errors were encountered: