Tuesday, November 13, 2012

Some resources for STM32 USB device programmers

UPDATE: I will collect direct links to libraries and manuals here on this post: 

Links to USB resources on STM website

Well, some of the some are not for STM32 only.

First and the best I found this tutorial - "USB in a nutshell". I just started reading it, but it lloks like it's a must for a starter like me. Check this out:

Endpoints can be described as sources or sinks of data. As the bus is host centric, endpoints occur at the end of the communications channel at the USB function. At the software layer, your device driver may send a packet to your devices EP1 for example. As the data is flowing out from the host, it will end up in the EP1 OUT buffer. Your firmware will then at its leisure read this data. If it wants to return data, the function cannot simply write to the bus as the bus is controlled by the host. Therefore it writes data to EP1 IN which sits in the buffer until such time when the host sends a IN packet to that endpoint requesting the data. Endpoints can also be seen as the interface between the hardware of the function device and the firmware running on the function device.
All devices must support endpoint zero. This is the endpoint which receives all of the devices control and status requests during enumeration and throughout the duration while the device is operational on the bus.

Isn't that crisp and clear?

Ok, going further. If you play with STM32F4-Discovery like I do, it may be a pain in the neck to find a helpful resource. E.g. you can't find USB OTG library from the board's page. You can't find it through web search either. You can't even find it with search on www.st.com website. Geee, I almost gave up on this.

Here's how to find it. Go to main page (their main page!), click "Micros and Memories", click "Microcontrollers", click "STM32 - 32 bit ARM Cortex MCU", switch to "Resources" tab, Click "Firmware" and look for "STM32F105/7, STM32F2 and STM32F4 USB on-the-go Host and device library" (the link will soon be broken - best practices from ST. Really, guys - your Digital Marketing department suck. Try to find this library with the search on your own site!).

There's even manual for this library (and a good one. I think...). I have no idea how to find it on ST website, but this time google is very useful. Here's a direct link to UM1021 User Manual.
And the last thing is HID Demonstrator. I don't know what is that exactly, I just know that this is useful and I soon will need this. So may you. Thus, a step back in resources and click "Drivers". Look for "USB HID Demonstrator release 1.0.2"

Go read guys. It's gonna take you a LOOOOT of time. But I think it's kinda worth it.

Post a Comment