cancel
Showing results for 
Search instead for 
Did you mean: 

USB HS communication between two Nucleo U5A5ZJ-Q boards

ennioaloisini
Associate III

Hi all,

I need to transfer big amount of data between two Nucleo U5A5ZJ-Q boards. I need to transfer a lot of data and UART communication is not sufficient, for that reason the USB HS could be the solution. I would like to test the USB HS bidirectional communication using two Nucleo U5A5ZJ-Q boards and I would like to know how I could create the two software using CubeMx and HAL library. I did not find examples and for that reason I ask you some information.

Thank you very much for the support.

17 REPLIES 17
Mohamed_AYED
Associate III

Hi @ennioaloisini  

In this case the USB class recommanded for data transfer is CDC ACM (Communication Device Class Abstract Control Model) in High Speed (HS) the max packet size is 512 for each 25 μs microframes.

You can start with this USB CDC ACM device example running on NUCLEO-U5A5ZJ-Q based on AzureRTOS Middleware:

https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Projects/NUCLEO-U5A5ZJ-Q/Applications/USBX/Ux_Device_CDC_ACM 

For Host side you can port this app example : 

https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Projects/STM32U5x9J-DK/Applications/USBX/Ux_Host_CDC_ACM 

 

You can also dev you application with STM32 USB lib, I recommend you see this videos -please note that cubemx with STM32U5xx series does not support ST USB LIB MW generation files):

Device:

https://www.youtube.com/watch?v=ft8LXVcYFRg&list=PLnMKNibPkDnFFRBVD206EfnnHhQZI4Hxa&index=11&ab_channel=STMicroelectronics 

Host:

https://www.youtube.com/watch?v=V3sMN-ErKPw&list=PLnMKNibPkDnFFRBVD206EfnnHhQZI4Hxa&index=19&ab_channel=STMicroelectronics 

 

 

 

Hi Mohamed_AYED,

thank you very much for the answer.

I would like to ask you some questions:

 

1) You wrote that CDC ACM class in HS mode allows to transfer up to 512 bit each 25usec. It is equivalent to about 20 Mb/s that is slower than 480 Mb/s. Is it possible to increase the transfer speed?

 

2) Do I have to use Azure RTOS for the CDC ACM class? 

 

3) Is it possible to use CDC ACM class without Azure RTOS or other RTOS?

 

4) What is the advantage to use Azure RTOS compared to create the application using STM32 USB lib?

 

Let me know!

Thank you very much for the support.

Mohamed_AYED
Associate III

1/ For USB protocol in HS mode the max packet size each 0,125ms for bulk transfer as described in USB spec

2/ No both of ST lib and AzureRTOS support the CDC ACM class you can also find other open sources usb stack that support cdc acm class like (Tinyusb) but as i know Tinyusb does not support stm32 usb controllers in host mode

3/ Yes it's possible to run USBx in standalone mode without RTOS

4/ Until now there is now officiel communication about benchmark between USBX and STlib (throughput, footprint ..)

 

Other solution is develop a vendor class (No classic class provided by usb spec) to send data over ISOC transfer with 1024 bytes for each 1,25us 

Just a question, @Mohamed_AYED  ,

>with 1024 bytes for each 1,25us 

is 6,5 Gbit --- isnt hi speed usb 480M clock ?  so how to get 6G on this ? or you talk about USB3.1 at 10Gbps ?

If you feel a post has answered your question, please click "Accept as Solution".
Mohamed_AYED
Associate III

@AScha.3 

Refering to USB2.0, max packet size in HS mode is up to 1024 byte.

Mohamed_AYED_0-1716120646925.png

If you see Table 5-5. High-speed Isochronous Transaction Limits:

Mohamed_AYED_1-1716120720964.png

 

 

Hi Mohamed_AYED,

thank you very much for the support.

I have some other questions:

 

1) If I have understood well I could program a NUCLEO-U5A5ZJ-Q with the project UX_Device_CDC_ACM and I could program a discovery board STMU5A9J-DK with the project UX_Host_CDC_ACM... then can the two boards communicate with each other with USB?

2) How could I check if the communication between the two boards works well? 

3) How could I use STlink VCP or Hyperterminal to check if the Nucelo or Discovery boards communicate well with PC or between them?

4) Regarding STM32 USB LIB... Is there an example project that can be used as a basis to create a project to run on the NUCLEO-U5A5ZJ-Q or  STMU5A9J-DK boards? 

5) You wrote that CubeMX does not support ST USB LIB MW for STM32U5xx... Why is it so? What does it involve?

 

Please let me know!

Thank you very much for the support.

Hi all,

Can someone answer to my previous questions?

Thank you very much for the support.

Mohamed_AYED
Associate III

HI @ennioaloisini 

 

ST USB LIB and USBX are a product independent stack you can dev or port any example if the hardware support.

1/ Yes, you are right.

2/ If you see the readme of the Host application there a trace over VCP of the STlink and for the device side you can test it with two VCP STlink and USB device CDC ACM.

 

please see application readme:

https://github.com/STMicroelectronics/STM32CubeU5/blob/main/Projects/NUCLEO-U5A5ZJ-Q/Applications/USBX/Ux_Device_CDC_ACM/README.md#hardware-and-software-environment 

 

https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Projects/STM32U5x9J-DK/Applications/USBX/Ux_Host_CDC_ACM#hardware-and-software-environment

3/ you can refer toDevice example :

https://github.com/STMicroelectronics/stm32u5-classic-coremw-apps/tree/main/Projects/NUCLEO-U575ZI-Q/Applications/USB_Device/CDC_Standalone

4/ generation of USB middleware files of ST lib is not supported, but you can add it manually and dev your app.

 

Hi @Mohamed_AYED ,

thank you very much for the support. I tried the examples programs on the Nucleo-U5A5ZJ-Q and Discovery STM32U5A9J-DK, but I had some problems.

1) First I tested the project UX_Device_CDC_ACM on the Nucleo-U5A5ZJ-Q board. I connected one usb cable between usb pc port and STLK usb port on the nucleo board. I use this cable to run the program with IAR in debug mode, so I could check step by step the program or watch variables. Then I connected another usb cable between another PC usb port and the usb type c port on the nucleo board. The PC recognize this COM port and then I activate Putty program to send message on the serial port. In IAR I checked the rx_buffer and I saw the message on the buffer. It is work, but I'm not able to see on Putty the answer of the nucleo board. How could I see it?

In the explanation of the project it is written that it is necessary to open two hyperterminals. Do I have to open two Putty sessions? In which way? why?

 

2) I tested the project UX_Host_CDC_ACM on the discovery board. I connected the usb stlink port of the discovery board to the usb port of the pc with an usb cable. I launched the project in IAR and then I went in debug mode to run and check the code. Then I connected an usb cable between another port of the pc and the usb type c port of the discovery board. Then I launched Putty, I supposed to see something on Putty, but I did not see messages. How could I check if it runs correctly or not?

 

3) Is it possible to use STM32 ST-LINK utility to send and read messages like Putty or Hyperterminal program?

 

Thank you very much for the support.