ChibiOS/testhal/STM32F4xx/USB_CDC

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
indigos
Posts: 14
Joined: Sat Jun 02, 2012 10:46 am

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Post 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.
Attachments
dump.zip
(2.44 KiB) Downloaded 456 times
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Post 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
MartinP
Posts: 35
Joined: Mon Apr 02, 2012 11:54 am

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Post by Giovanni »

The USB-related files are going to be not compilable for a while in the repository.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Post 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
User avatar
Badger
Posts: 346
Joined: Mon Apr 18, 2011 6:07 pm

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Post 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
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Post 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
indigos
Posts: 14
Joined: Sat Jun 02, 2012 10:46 am

Re: ChibiOS/testhal/STM32F4xx/USB_CDC

Post 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.
Post Reply