STM32F407 + USB + ULPI Interface
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: STM32F407 + USB + ULPI Interface
Hi,
I found that the HW FIFO multiplier greatly affects performance, in structure USBEndpointConfig it is usually 2, you should try 4 or even 8. For CDC applications it is not a problem because there is plenty FIFO RAM available.
Giovanni
I found that the HW FIFO multiplier greatly affects performance, in structure USBEndpointConfig it is usually 2, you should try 4 or even 8. For CDC applications it is not a problem because there is plenty FIFO RAM available.
Giovanni
Re: STM32F407 + USB + ULPI Interface
I try it increasing USBEndpointConfig.in_multiplier for USB FS/HS data endpoints only from 2 (default) to 4 and 8.
In both cases (4 and 8) USB HS throughput increases from ~5 to ~7.4 MBps when connected to Linux on a20-Lime2-SOM.
When USB HS was connected to i7 PC with Windows 7 throughput increases from ~2 to ~2.5 MBps (or ~25%).
Unfortunately, connection for both USB FS and HS become unstable and even Linux on a20-Lime2-SOM hangs (no such behavior till now).
Regarding STM32F405/7 Data Sheet: Combined Rx and Tx FIFO size is 320 × 35 bits / 1 Kbit × 35 for OTG-FS/HS respectively.
Can this strange behavior be explained by having 2 CDC devices (on USB FS and HS) and 512 bytes USB HS packet size in my case?
Chris
In both cases (4 and 8) USB HS throughput increases from ~5 to ~7.4 MBps when connected to Linux on a20-Lime2-SOM.
When USB HS was connected to i7 PC with Windows 7 throughput increases from ~2 to ~2.5 MBps (or ~25%).
Unfortunately, connection for both USB FS and HS become unstable and even Linux on a20-Lime2-SOM hangs (no such behavior till now).
Regarding STM32F405/7 Data Sheet: Combined Rx and Tx FIFO size is 320 × 35 bits / 1 Kbit × 35 for OTG-FS/HS respectively.
Can this strange behavior be explained by having 2 CDC devices (on USB FS and HS) and 512 bytes USB HS packet size in my case?
Chris
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: STM32F407 + USB + ULPI Interface
You can't have a queue of x4 or x8 if your packet size is 512, there is not enough RAM. You should get an assertion because that. Could you try with smaller packets and longer FIFOs? 64x4 is working for me.
I fixed a regression that could cause instability, it caused SV#8 errors because a change in ST header files, make sure to updated to the latest revision.
Giovanni
I fixed a regression that could cause instability, it caused SV#8 errors because a change in ST header files, make sure to updated to the latest revision.
Giovanni
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: STM32F407 + USB + ULPI Interface
Using the linear API (the new synchronous variant of it) I am seeing 16MB/s+ by transmitting blocks of 1KB, the rate really improves using even larger blocks.
See the demo \testhal\STM32\STM32F7xx\USB_RAW
It is still work in progress, it is still buggy and not optimized.
Giovanni
See the demo \testhal\STM32\STM32F7xx\USB_RAW
It is still work in progress, it is still buggy and not optimized.
Giovanni
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: STM32F407 + USB + ULPI Interface
It is stable now, there was a problem on USB reconnection.
Giovanni
Giovanni
- DeusExMachina
- Posts: 223
- Joined: Tue Apr 03, 2012 5:08 am
- Has thanked: 3 times
- Been thanked: 3 times
Re: STM32F407 + USB + ULPI Interface
chradev wrote:I try it increasing USBEndpointConfig.in_multiplier for USB FS/HS data endpoints only from 2 (default) to 4 and 8.
In both cases (4 and 8) USB HS throughput increases from ~5 to ~7.4 MBps when connected to Linux on a20-Lime2-SOM.
When USB HS was connected to i7 PC with Windows 7 throughput increases from ~2 to ~2.5 MBps (or ~25%).
Unfortunately, connection for both USB FS and HS become unstable and even Linux on a20-Lime2-SOM hangs (no such behavior till now).
Regarding STM32F405/7 Data Sheet: Combined Rx and Tx FIFO size is 320 × 35 bits / 1 Kbit × 35 for OTG-FS/HS respectively.
Can this strange behavior be explained by having 2 CDC devices (on USB FS and HS) and 512 bytes USB HS packet size in my case?
Chris
chradev, could you please share your project for 405? I failed with porting F7 demo to F407. Maybe it's a board issue, and I need to check it.
Re: STM32F407 + USB + ULPI Interface
I have already do that in my previous post. You can download it following the link:
http://forum.chibios.org/phpbb/download/file.php?id=933
Regards
Chris
http://forum.chibios.org/phpbb/download/file.php?id=933
Regards
Chris
- DeusExMachina
- Posts: 223
- Joined: Tue Apr 03, 2012 5:08 am
- Has thanked: 3 times
- Been thanked: 3 times
- DeusExMachina
- Posts: 223
- Joined: Tue Apr 03, 2012 5:08 am
- Has thanked: 3 times
- Been thanked: 3 times
Re: STM32F407 + USB + ULPI Interface
I use ulpi and Chibios 16.1.1 stable
I was able to run several USB examples on my board, including testhal demo. But I have a problem - periodically (but really often) I have a trouble
this is called from endpoint setup usb.c 765 (_usb_ep0setup)
previously in _usb_isr_invoke_setup_cb() usb.c 410 (otg_epout_handler)
otg_epout_handler() usb_ldd.c 609 (usb_lld_serve_interrupt)
My hardware setup is similar, the only difference that I run MCU on 48 MHz. What could go wrong?
I was able to run several USB examples on my board, including testhal demo. But I have a problem - periodically (but really often) I have a trouble
Code: Select all
osalDbgAssert(!usbGetTransmitStatusI(usbp, ep), "already transmitting");
this is called from endpoint setup usb.c 765 (_usb_ep0setup)
previously in _usb_isr_invoke_setup_cb() usb.c 410 (otg_epout_handler)
otg_epout_handler() usb_ldd.c 609 (usb_lld_serve_interrupt)
My hardware setup is similar, the only difference that I run MCU on 48 MHz. What could go wrong?
- DeusExMachina
- Posts: 223
- Joined: Tue Apr 03, 2012 5:08 am
- Has thanked: 3 times
- Been thanked: 3 times
Re: STM32F407 + USB + ULPI Interface
Maybe someone can share a basic example of HID device using HS ULPI? (Sounds ridiculous, but I really need it) 