cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 and USB FS/HS with ULPI

christo
Associate III
Posted on December 02, 2015 at 19:36

Hi to All,

I would like to share my experience to create test application and measure the USB performance for both FS and HS with external ULPI PHY (USB3300) on STM32F4 MCU series.

To do that Olimex STM32-H405 board and USB3300 module was used as hardware. Because of high speed the connection between them was made with very short wires and using default pin connection case with USB3300 reset pin connected to PA6. In addition to use default USB FS Device pin-out USB_P was re-wired from PC4 to PA9. For debugging USART2 (PA2 Tx only) is used. The pins for USART1/6 and SDIO ware reserved for future use. Additional hardware used is ST-LINK V2 (for FW uploading and debugging) and FT4232-HUB module for inter connectivity. Windows 7 PC (i7) and a20-Lime2-SOM with Linux 3.4.79+ are used as hosts for terminating of USB connections.

STM32F4 application was created from the scratch using STM32CubeMX and STM32Cube FW (for STM32F4 ver. 1.8.0) including both USB FS and HS with external ULPI PHY interfaces set as CDC devices and FreeRTOS. Development was made in Eclipse IDE as Makefile project thanks to 

http://wunderkis.de/stm32cube/index.html

Makefile framework. In addition library standard input and output was redirected to UART2 thanks to newlib staff added.

USB FS/HS devices info was verified with UVCView on Windows and �lsusb� command and �usb-devices� script on Linux. It was assured of full / high speed of USB FS/HS devises respectively.

Performance measurement was planned to be done on both device and host sides. On STM32F4 FW side two FreeRTOS threads sending data continuously at maximal speed using long buffers with built-in throughput measurement ware added. In the loop of the default startup thread the results are printed to stdout.

The first tests ware done without host measurement of the throughput and Linux �cat� command (with stdin redirected from /dev/ttyACM devices) was used to terminate USB connections. To eliminate the print to screen time stdout was redirected to /dev/null. The results measured for USB FS/HS throughput and data memory usage at different sizes of USB FS/HS transmit buffers ware presented on the following diagram.

0690X000006035wQAA.jpg

There were problems to use terminal utilities like screen for example in Linux and PuTTY in Windows simultaneously connected to both USB FS and HS devices. The main problem is that USB FS connection stopped either immediately or after some time to respond on some unknown reason.

As a next step a simple Python script was developed to measure simultaneously the throughput on host side. For connecting to USB devices both Python Sys and Serial libraries were used. The best result was reached with PySerial based scripts running after USB FS on Linux and USB HS on Windows simultaneously with internal measurement printed via USART2 on PyTTY on Windows. There was a problem to run the script on the same host simultaneously after both USB FS and HS devices (USB HS throughput degraded down to FS one). The results in case of the best performance reached at the first test (using 2 and 38.5 kB transmit buffers for USB FS and HS respectively) are shown on the following picture.

0690X000006033IQAQ.jpg

It is visible that USB HS throughput is 2.5 times lower (15 vs. 38 MBps) while USB FS one is almost the same (972 v. 1018 kBps). The main reason for lower throughput measured at USB HS could be Python limitation � much slower if Sys library is used (2 MBps measured for USB HS).

The maximal USB HS throughput cannot be verified using Python (or other script language) so other application has to be developed � most probably C for Linux.

Preliminary measurement results for USB HS with external UPLI PHY (120 Mbps verified on both sides and 310 Mbps verified on device side only vs. 75 Mbps measured over Ethernet with STM32-E407 board) make believe that much better than 100 Mbps LAN communication performances can be expected in this case on STM32F4 MCUs.

Unfortunately, it is under a question the connection reliability and compatibility with different host HW and SW. Other not solved problem is Ethernet over USB support in STM32Cube SW even there are some projects in that way like

https://github.com/fetisov/lrndis

.

Best regards

Chris

#ulpi #performace #stm32f4 #usb
4 REPLIES 4
christo
Associate III
Posted on December 09, 2015 at 09:11

Hi to All,

I have finally solved some problems at measurement of the throughput via USB HS with HS ULPI and its verification from both device and host sides.

0690X0000060362QAA.jpg

Best regards

Chris

gnohiah
Associate
Posted on July 20, 2016 at 07:27

Thanks for the interesting article.

I am doing a project that requires high speed transmission between MCU and PC.

Could you elaborate how you configured the USB CDC driver to achieve the high speed transmission?

christo
Associate III

Hi gnohiah

Sorry for the delayed answer. Find attached the project as-is. It was generated by STM32CubeMX 4.10.0 installed in Eclipse Mars Release (4.5.0). In addition you can find ab-tests-howto.pdf file with explanation how-to install and configure development environment. The binary can be uploaded and run on stm32-h405 board with USB Host connector wired.

In addition you can take a look on other discussions here:

Unfortunately, most of the details about my tests are not clear so have a luck with the staff. It would be fine to have some feedback from you.

Best regards and success

Chris

christo
Associate III

Find also attached more advanced test (btest) based on ChibiOS, running STM32-H405 board and using both synchronous and asynchronous calls to HS USB with external ULPI PHY wired to STM32F405 MCU.

Performance measured looks like:

0690X000006CuE2QAK.jpg