STM32F4 / H7 with HS USB over ULPI Interface (USB3300)

Hello,

i am looking for information about using the STM32F4/H7 with HS USB over the ULPI interface. One the the recommended chips is the usb3300.
The hardware is finished.
Do i need librarys?
Are there examples how to transfer data over HS USB to the PC and back?
What is the proggramming interface on the PC side? I think, Virtual comport will not work. Examples?

Any help with examples, links or explanation will be fine.

Thanks al lot in advance.
Ulrich

Are you working with an Arduino core and the hardware won’t interface / work with the libraries there? Then better create an issue there.

For USB, you always need libraries unless you want to implement major parts of the USB protocol. The safest bet is probably STM32 HAL as it supports your MCUs including USB HS. STM32CubeMX can generate the basic code for you.

I agree that a virtual COM port is not the best option. The Windows drivers seem to contain a lot of code to control the bandwidth in order to prevent data loss on the serial lines. As a result, they are not that useful for speed beyond a few mega bits.

Since you will use USB HS, you probably want to transfer a sizeable amount of data. So you have to implement USB bulk endpoints, likely one for each direction. This isn’t too difficult. There are several tutorials, e.g.:

https://medium.com/@manuel.bl/usb-for-microcontrollers-part-1-basic-usb-concepts-519a33372cc9

The tutorial focuses on libopencm3 code but the linked GitHub repository contains STM32 HAL code as well. (libopencm3 does not support USB HS.)

For working with Windows, you should implement the WCID extension (also shown in the tutorial). It ensures that Windows automatically loads the WinUSB drivers.

From Windows, you can access the USB device with a variety of APIs and programming languages. The tutorial shows how it do it using Python.

@maxgerhardt
Yes, i am using the arduino core. I can not tell you wether it works or not. i can compile and upload it without errors with “-D PIO_FRAMEWORK_ARDUINO_USB_HIGHSPEED” in platform.ini.
But how to transfer the data? it is not Serial over usb at the stm32 side and not VCP at the PC side.

@manuelbl
Thank you manuelbl. Your contribution following the link is very interessting with a lot of information. It helps me to understand the abstract functionality of USB, but i am not able to apply it it to my current project.
I am hoping to find some small working examples which i can extend to my needs. I suppose never getting ready working through all the information and build it from scratch.

I have started with the Arduino core, because there are a lot of information and examples. Switching to another platform is an additional afford, which i would like to avoid. I have tried STM Cube for example. The GUI is a little bit “not as i would expect that it should be”, but after a while it works. But it is realy difficult to find examples.

For my opinion is it difficult to find entry examples for special purposes. There are hundreds of examples for spi I2C and serial transfer, some displays and sensors etc, but not for my current problem or the extended use of timers.

Thank you
Ulrich

You haven’t told much about the requirements of your product/project. Since you have designed for high-speed USB (instead of for the simpler full-speed USB), I assume that the higher speed and throughput is needed. Likely, USB is only part of the solution and the other parts involve SPI, ADC, DAC etc. with a similar data throughput. If so, trivial blocking Arduino code won’t be sufficient. Instead, a more sophisticated approach with DMA and interrupts is needed to achieve the desired throughput.

Furthermore, your requirements are beyond USB CDC ACM (serial communication over USB). Thus, you need to go with a so called vendor-specific USB protocal. Again, this is an area that isn’t well support by the Arduino framework.

I guess you need to familiarize yourself with STM32 HAL. You can either use STM32 HAL only, or in combination with the Arduino framework (as the core for STM32 is based on STM32 HAL).

The current project is 2 or more channel high speed, high resolution ADC over SPI. I (want to) use the CPU version for checking the ADC system (funktionality, quality noise) and as a middle speed ADC Sytem. My workaround for now is a bit banged FT232H in FT245 Style aynchronous FIFO Interface. That works fine but the USB HS interface would be the best (integrated) solution.
The final version will use a FPGA for maximum performance. Thats the current work.
But a HS USB with the faster STM32 would be often a nice to have feature. I don’t want to develope a lot of different pcbs for each project. My approach is to put the HS and FS interface on the pcb ( and mybe the external network phy) and leave free the unnecessary ports.

I will have a look at the stm32 HAL.

Thank you
Ulrich