Page 6 of 12
Re: example interfacing a STM32F4 with libusb
Posted: Sun Jul 15, 2012 9:03 pm
by Mathias
Random info on the side: (64/4+1)*2=34 words == 136 bytes. Setting STM32_USB_OTG1_RX_FIFO_SIZE to 136 doesn't work, one additional word is needed, 140 does work...
*edit* Found this bit from the OTG_FS_DIEPTSIZx description:
XFRSIZ: Transfer size
This field contains the transfer size in bytes for the current endpoint. The core only interrupts
the application after it has exhausted the transfer size amount of data. The transfer size can
be set to the maximum packet size of the endpoint, to be interrupted at the end of each
packet.
I'm not sure if I tried that along the way...
Re: example interfacing a STM32F4 with libusb
Posted: Tue Jul 17, 2012 12:42 pm
by Mathias
Using something similar to
this I am able to push around 5250 packets per second with a txFifo of 128 (which is in words, so its 512 bytes). Decreasing the buffer to 64 still gives 3900 pps, 32 results in ~2000 pps.
While this is more then I ever was able to push, its still only 28% of what is possible. Also I'm not sure how it affects overall system performance/responsiveness.
The reference manual refers to a polling and an interrupt mode. I think I'm doing something of both. Maybe a true polling mode is what Giovanni means with a double buffered approach?
I'm not sure where to go from here. So I guess I'll leave it to the more skilled people to improve the speed.
Re: example interfacing a STM32F4 with libusb
Posted: Tue Jul 17, 2012 1:56 pm
by Giovanni
Nope, double buffering is an HW feature specific to the USB peripheral of the F103, the OTG peripheral does not have it.
I mistakenly mentioned that because I believed we were talking about the F103 USB implementation initially.
Giovanni
Re: example interfacing a STM32F4 with libusb
Posted: Thu Aug 02, 2012 9:46 pm
by kjellhar
It seems like I'm getting nowhere with this problem either. I'm giving it a rest until someone smarter than me comes along.
Giovanni: Do you have any idea if or when you are able to look into this problem. It is a bit important to me. It's only a hobby project, but it would still be nice to know if I can hope for a solution in the near future. If you (or someone else with more USB knowledge than me) look into this, I will be more than happy to participate in any discussions or testing.
Cheers,
Kjell
Re: example interfacing a STM32F4 with libusb
Posted: Fri Aug 03, 2012 7:23 am
by Giovanni
I can't promise a "when" but it is the next thing on the list after I am done with the configuration tool.
Giovanni
Re: example interfacing a STM32F4 with libusb
Posted: Fri Aug 03, 2012 7:54 am
by kjellhar
Thanks, that's more than good enough estimate for me.
Re: example interfacing a STM32F4 with libusb
Posted: Sun Aug 05, 2012 6:15 pm
by Mathias
Do you have a rough idea on what needs to be done? Or how it needs to be done? I may spend a little more time on this, but currently I have no idea what could help.
Re: example interfacing a STM32F4 with libusb
Posted: Mon Aug 06, 2012 2:57 pm
by Giovanni
Hi Mathias,
I thing you are in the right direction, it is about the TX queue etc. I still have to try so I don't know all the details. I hope to be able to work on it during my vacations in August, then I will need all the help possible with testing, I don't have an analyzer.
Giovanni
Re: example interfacing a STM32F4 with libusb
Posted: Mon Aug 06, 2012 9:30 pm
by Mathias
So if you need someone to try something in coding or just benchmarking, ping me. I don't know what you mean with the analyzer, I pushed a benchmarking client to the repository, maybe thats what you want? It compiles with: gcc benchmark.c -o bench -lusb-1.0 -lrt
Re: example interfacing a STM32F4 with libusb
Posted: Fri Aug 10, 2012 9:29 pm
by kjellhar
Giovanni wrote:Hi Mathias,
I don't have an analyzer.
Giovanni
I have access to a software based USB analyzer at work. Works pretty well. Not as good as a hardware analyzer, but it still helps a lot.