Skip to content

Conversation

@jeremydick
Copy link

Fix zero length packets not being sent for pipe0

This fixes samples/subsys/usb/webusb failing to enumerate properly

Fix zero length packets not being sent for pipe0

Signed-off-by: Jeremy Dick <[email protected]>
@thenguyenyf thenguyenyf self-requested a review November 7, 2025 09:06
@thenguyenyf
Copy link
Contributor

Hello @jeremydick . According to RA8M1 HWM, the executing for ZLP transfer at control status stage doesn't need a CFIFOCTR:BVAL writing. Could you provide more detail about the issue you met? A console output or a USB packet capture maybe helpful.
image

@jeremydick
Copy link
Author

jeremydick commented Nov 12, 2025

I am running samples/subsys/usb/webusb on the EK-RA6M3G eval kit

The webusb sample prj.conf was updated with these additional configs for logging

CONFIG_USBD_LOG_LEVEL_DBG=y
CONFIG_UDC_DRIVER_LOG_LEVEL_DBG=y
CONFIG_LOG_BUFFER_SIZE=32768

west build -p always -b ek_ra6m3 samples/subsys/usb/webusb

Without the fix, enumeration on the host fails, the device is getting stuck where it should be sending a ZLP because the last packet length is exactly the max packet length.

At line 124 in the logs:

[00:00:00.233,000] <dbg> usbd_ep: usbd_ep_ctrl_set_zlp: add ZLP, wLength 255 buf length 64
[00:00:00.233,000] <dbg> udc: udc_ep_enqueue: Queue ep 0x80 0x1ffeb4bc len 64
[00:00:00.233,000] <dbg> udc_renesas_ra: udc_renesas_ra_ep_enqueue: 0xdd58 enqueue 0x1ffeb4bc
[00:00:05.838,000] <dbg> usbd_core: usbd_event_handler: RESET event

With the patch:

[00:00:00.286,000] <dbg> usbd_ep: usbd_ep_ctrl_set_zlp: add ZLP, wLength 255 buf length 64
[00:00:00.286,000] <dbg> udc: udc_ep_enqueue: Queue ep 0x80 0x1ffeb4bc len 64
[00:00:00.286,000] <dbg> udc_renesas_ra: udc_renesas_ra_ep_enqueue: 0xdd70 enqueue 0x1ffeb4bc
[00:00:00.286,000] <dbg> udc: udc_ctrl_update_stage: s-in->(status)

webusb_sample_log.txt
webusb_sample_with_fix.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants