2018-01-20 05:55 AM
I need to develop an isochronous type USB firmware to transmit real time data to computer, but I dont know where to start. My question is What book/article/blog is enough to read to start developing a usb firmware over stm32
P.S: I'm not really familiar with USB specifications. But I want to know what is really required to learn to develop a new firmware. I know there are documents about usb specifications but I think those are overkill as some functions are already handled by hardware and HAL
#usb #stm32Solved! Go to Solution.
2018-01-21 01:49 AM
Then an UVC class device might be the way to go. By googling i found this
. I never tried it, but it seems to have an UVC class with isochronous transfer. Maybe try that?2018-01-20 06:33 AM
USB can be very tricky to comprehend. A good place to start is
http://www.beyondlogic.org/usbnutshell/usb1.shtml#Introduction
. Apart from that you could read USB specification, but that is not so light reading. There is no, to my knowledge easy tutorial for the USB for the beginners. The best thing to do is just take some basic USB code and debug it.Unlike UART or SPI or CAN, the USB has a lot of things on the low level that need to be done just to send a couple of bytes of data. Fortunately some of them are generated by CubeMX automatically.
There a few key parts of USB protocol.
1. USB Descriptors - these are data structures that describe how the device is implemented (how many interfaces it has, how many configurations, USB classes of the interfaces, etc.)
2. Endpoints - these are virtual channels for sending and receiving data to and from the device. Depending on the class of the device there can be 1 or more endpoints assigned to it.
3. Device classes - There are some standard device classes such as Mass Storage, CDC (Virtual Com Port), Audio Class etc., that help the host to find appropriate driver and in most cases the host can just use the generic driver, ie. the Mass Storage Class device can be automatically recognized and used without any special driver
4. Host driver - Every device should have compatible driver on the host side, which can be problem when writing your own device class
That being said, why do you need isochronous device? Unless you are making a Video or Audio device, thera are nott many host drivers that support isochronous transfer which means you would need to write your own host driver.
My suggestion is to start small with CDC class driver generated from cube and continue from there.
Regards
2018-01-20 06:57 AM
It is a multi-faceted problem. It is important to understand the protocol and expectations first. Application to a specific architecture will make a lot more sense in that context.
Jan Axelson has written numerous books on the topic, and might provide an overview from which you can expand on.
My approach to these things is to read/skim multiple perspectives, and then triangulate. Then walk the code examples and if the behaviour expressed doesn't make sense go back to the books and get a better understanding. Look also at Linux USB stack and drivers to understand how the OS expects USB devices to behave and present data/descriptors.
2018-01-20 07:52 AM
Referring to the
Turvey.Clive.002
suggestion to start with the Linux.Some time ago when I started playing with USB I used the following lib:
I used it for Linux to connect USB temperature sensor.
2018-01-20 10:26 AM
Thanks for reply.
Yes, as you may have suggested I am developing a Video device which in a part of it is required to send a stream of video to computer. At the moment this requirement is implemented using CDC, but this class is not suitable as it is based on bulk transfers.
So, I think that I have to develop a class as CubeMX does not provide it.
2018-01-20 10:30 AM
is it possible to use libusb to write a new computer side firmware/driver to make CDC suitable for Video streaming application?
2018-01-20 10:34 AM
Have a look at OpenMV
2018-01-20 11:34 AM
openMV uses CDC over USB-FS which is not a big deal (I already have implemented that). The problem is using CDC over USB-HS when it streams 50 fps uncompressed data (each frame is about 200KB in grayscale and 400KB in YCrCb format.)
2018-01-21 01:49 AM
Then an UVC class device might be the way to go. By googling i found this
. I never tried it, but it seems to have an UVC class with isochronous transfer. Maybe try that?