This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

USB ISO endpoint max packet size of 0

Hello,

I am working on implementing the USB HAL for the nRF52840 for Mbed-OS's upcoming USBDevice feature release. I am encountering an issue where the automated test suite fails because the Mbed test USB device attempts to set the max packet size of an ISO endpoint to 0. When nrf_drv_usbd_ep_max_packet_size_set is called with a size of 0, it ASSERTs, causing the test to hang. See the offending lines of code here: https://github.com/AGlass0fMilk/mbed-os/blob/ceb2bc064ee74e1345fc090b426293705419f423/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_14_2/drivers_nrf/usbd/nrf_drv_usbd.c#L1918-L1929

This assert is still present in nRF SDK version 15.2 (latest). However, it seems this conflicts with the USB 2.0 specification as quoted below:

All device default interface settings must not include any isochronous endpoints with non-zero data payload sizes (specified via wMaxPacketSize in the endpoint descriptor). Alternate interface settings may specify non-zero data payload sizes for isochronous endpoints.

This was brought to my attention by an engineer at Mbed. You can see the discussion here on Github: https://github.com/ARMmbed/mbed-os/issues/7674#issuecomment-450366950

So it would seem the driver shouldn't ASSERT when the size is equal to 0, at least when the specified endpoint is an ISO endpoint.

Can anyone from Nordic comment on this? I'd like to know what the appropriate action would be when the upper level stack attempts to set an ISO endpoint max packet size to 0.

Thanks!

Related