cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with USBx MSC on NUCLEO-U5A5ZJ-Q

_fra_
Associate

Hello,

I've been trying to make USBx (device_only mode) MSC work on my NUCLEO-U5A5ZJ-Q for 2 weeks now, and I don't know what I'm doing wrong.

I've tried to run the tinyUSB MSC example and it works fine so the hardware is ok.

When using USBx, after some hours of digging around, I've managed to make windows recognize the device as a USB Mass Storage, but after some time (probably 20s) the device manager shows this:

_fra__1-1727441182343.png

If I look at the USB frames in wireshark I see this:

_fra__0-1727441059407.png

The first descriptor response string appears to be malformed according to wireshark, but that doesn't seem to bother windows

The real problem seems to be in the SCSI Inquiry: it took the device 20s to reply to the frame number 307 (host -> device URB_BULK in).

 

 

The setup:

- STM32CubeIde 1.16.1

- The ioc file attached to this post

- In USBx/App/ux_device_msc.c the USBD_STORAGE_GetMediaLastLba function returns 63 and the USBD_STORAGE_GetMediaBlocklength function returns 512

- In the main function I called MX_USB_OTG_HS_PCD_Init();

- In the main.c file I defined this function:

Spoiler

void start_usb_device(void) {

//MX_USB_OTG_HS_PCD_Init();

ux_dcd_stm32_initialize((unsigned long) 0, (unsigned long)&hpcd_USB_OTG_HS);

HAL_PCD_MspInit(&hpcd_USB_OTG_HS);

/*HAL_PCD_EP_Open(&hpcd_USB_OTG_HS, 0x83, 512, EP_TYPE_BULK);

HAL_PCD_EP_Open(&hpcd_USB_OTG_HS, 0x04, 512, EP_TYPE_BULK);*/

SysTick_Config(SystemCoreClock / 1000);

HAL_PCD_Start(&hpcd_USB_OTG_HS);

}

- I called the function above in the MX_USBX_Device_Init function (USBx/App/app_usbx_device.c)

- I added this include [#include "ux_api.h"] in the Middlewares/ST/usbx/common/usbx_stm32_device_controllers/ux_dcd_stm32.h file to make the project compile

 

Any help is appreciated, thank you in advance.

 

1 REPLY 1
_fra_
Associate

I looked more into this and I think there might be a problem inside the stm32 USBx library (the function _ux_device_class_storage_inquiry hangs for 20 seconds), so I don't think there is a way to solve the issue on my side and I don't think I have the knowledge necessary to fix the library myself.

Is there any way to open an issue and a chance for it to be fixed, or should I look at TinyUSB?