Page 2 of 4

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Sun Jun 03, 2012 9:08 pm
by indigos
If you use Linux you can try with Wireshark and usbmon http://wiki.wireshark.org/CaptureSetup/USB
I have attached my trace, my I have a problem to capture all data, so it's no good.

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Sun Jun 03, 2012 9:13 pm
by Giovanni
Thanks both,

I have an hint now, apparently after the first IN transaction the driver is unable to perform more so the enumeration does not proceed.

Giovanni

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Tue Jun 05, 2012 9:09 pm
by MartinP
Hi Giovanni,

There is a working usb-cdc example for stm32f4 here (svn): https://www.das-labor.org/svn/microcontroller/src-stm32f4xx/serialUSB
it is based on the stm32 library (I used the STM32_USB-Host-Device_Lib_V2.1.0) and it works on my discovery board
unfortunately I failed to migrate it to chibios :(
perhaps it helps you ....

Martin

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Tue Jun 05, 2012 9:32 pm
by Giovanni
Hi Martin,

The native driver for F4/F2/F107 is beginning to work thanks to the logs and some debugging help from Erik, now it enumerates, it should not take much longer. It is missing support for the "packet mode".

I am evaluating changes to the serial_usb driver in order to make the "packet mode" no more required, it adds too much complexity in any USB implementation. I like simple things.

Giovanni

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Sat Jun 09, 2012 10:20 am
by Giovanni
Hi,

The driver currently in the trunk enumerates and is functional but it still does not support the "packet mode". Packet mode is required for the Serial over USB driver.

After thinking about how to improve the USB subsystem my current idea is the following:
1) Remove the packet mode entirely.
2) Change the USB high level API to be able to read/write also in I/O queues instead just linear buffers.

The advantages are the following:
1) The Serial_USB driver would be simplified, the USB driver would do the queue work in its own optimized way.
2) The application will be able to read/write to queues even if an USB transaction is still ongoing, the two things would proceed in parallel (queues being filled/emptied at the same time).
3) Working with queues is best for streaming-like USB application (audio, video, serial etc) where one don't want to be bothered by callbacks and buffering.
4) Transaction-oriented application (mass storage) would still have the current buffer-oriented API.

Giovanni

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Sun Jun 10, 2012 5:32 pm
by Giovanni
The USB-related files are going to be not compilable for a while in the repository.

Giovanni

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Mon Jun 11, 2012 8:49 pm
by Giovanni
The driver is complete and kinda work, it receives keystrokes from the terminal but it doesn't output anything, I'll do some debug tomorrow in the evening, tired now.

Giovanni

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Mon Jun 11, 2012 8:54 pm
by Badger
Hi Giovanni,

thank you for your hard work on this driver! I am very much looking forward to being able to leave my serial to usb cable at home and just use the serial_usb driver :D

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Tue Jun 12, 2012 3:09 pm
by Giovanni
Hi,

The driver is now apparently working, please test :-)

It is still not optimized, there are several things I wish to improve, like the ugly FIFO<->queue copy routines, if you have ideas on how do those better please suggest.

I still have to test the scenario where the SerialUSB queues are multiples than one packet size, that scenario should improve the throughput, the thread should be able to read/write data while a transaction is in progress.

In the weekend I will do some extra testing and improvements, traces could help.

Giovanni

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Posted: Tue Jun 12, 2012 7:29 pm
by indigos
Hi Giovanni,

thank you for your work!!!
Works, but there is a problem when I detach and attach usb cable, usb device is enumarated but read and write in serial usb doesn't work. After reset work again correctly. I'm testing in linux OS.