STMicroelectronics / stm32-usbx-examples

Provide a set of USB examples running on STM32 products based on USBX middleware software library.
Other
9 stars 1 forks source link

Can provide an example of a STM32U5 USBX composite device? #1

Open Barfell opened 7 months ago

Barfell commented 7 months ago

I have a STM32U5x9J-DK board, high speed usb composite device, the MSC + CDC +HID can not read and write at the same time.

Barfell commented 7 months ago

and add a WINUSB?

ayedm1 commented 7 months ago

Hi @Barfell, Can you give more details about your request ?? HID (mouse or keyboard) MSC (SD or RamDisk) CDC (with UART ??)

which IDE ?

How WINUSB will be supported in your application ??

Barfell commented 7 months ago

Hi @Barfell, Can you give more details about your request ?? HID (mouse or keyboard) MSC (SD or RamDisk) CDC (with UART ??)

which IDE ?

How WINUSB will be supported in your application ??

custom hid, can send data and receive data. sd card. cdc without uart, it can send and receive. IDE:MDK

When the MSC reads and writes, don't operate on CDC and HID, and when the MSC reads and writes is completed, CDC sends and receives normally, but HID does not.

If the MSC is read-only, CDC and HID are not affected.

HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_HS, 0x100); HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 0, 0x40); HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 1, 0x100);//81

HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 2, 0x40);//82 HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 3, 0x10);//83

HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 4, 0x40);//84

//81 MSC IN 81 //01 MSC OUT 01 //82 CDC IN 82 //02 CDC OUT 02 //83 CDC CMD 83 //84 HID 84

Barfell commented 6 months ago

When write the MSC, the HID devicce can not response USBD_Custom_HID_SetReport function, can not receive the data from the host.

Barfell commented 6 months ago

Hi @Barfell, Can you give more details about your request ?? HID (mouse or keyboard) MSC (SD or RamDisk) CDC (with UART ??)

which IDE ?

How WINUSB will be supported in your application ??

WinUSB used for data DAQ

Barfell commented 6 months ago

U5A9J_MSC.zip Here the project,it not work normally.MSC+CDC+HID

Barfell commented 6 months ago

The cause has been located, but I don't know how to solve it. USBD_STORAGE_Write function call the fx_media_write function, It's taking too long, Comment out the function fx_media_write,hid and cdc worked perfectly.

ayedm1 commented 6 months ago

Hi @Barfell, yes it can be the cause. It's recommande to avoid using file system fx with storage class. I suggest to use direct sd hal.

Barfell commented 6 months ago

Hi @ayedm1 ,I'm use HAL_SD_WriteBlocks instead fx_media_write, HAL_SD_ReadBlocksinstead fx_media_read, the HID and CDC can work at the same time.

Barfell commented 6 months ago

STM32U5x9J-DK board, use file x, can work perfectly, because use high speed USB? maybe。