Browse over 10,000 Electronics Projects using the Page Numbering provided at the bottom of each Page.

USB HID device development on the STM32 F042

USB HID device development on the STM32 F042

Previous Page <<1 of 9
Use your ← → (arrow) keys to browse

The STM23 F042 series is ST’s cheapest route into USB device programming for the F0 series of STM32 microcontrollers. In hacker-friendly units of one you can buy an STM32F042F6P6 (48Mhz, 32Kb flash, 6Kb SRAM, TSSOP20) for £1.47 at Farnell today.

STM32F042 TSSOP20 0.65mm pitch package

If you need more IO pins then there are QFP and QFN (curse them!) packages available but you’re stuck with 32Kb flash and 6Kb SRAM memory limitations. If you need more of those resources then you’ll have to step up to something like the F072 range.

The footprint for ST’s QFN 28 is pictured above. Not an easy one to work with, and not just because of the usual difficulties with seeing what you’re doing and subsequently have done but also because ST have shrunk the size of the corner pads to make the package even smaller. Always use ST’s official PCB footprint for this package and don’t use a generic QFN-28. Better still, save yourself a headache and don’t use a QFN at all!


USB on the STM32F042F6P6

In my last article I presented a simple development board for the F6P6 TSSOP20 variant of the F042 and since then I’ve been using it to develop a USB custom HID device. It all went well and so I thought I’d explain how I did it and hopefully you can pick up some design, implementation and debugging tips for your own project.

My miniature development board


USB is an absolulely maahoosive protocol, definitely the largest that I’ve ever seen and far more than one person can fit in their brain and still have room for anything else. The way to tackle it is to understand the high level design and which of the many sub-protocols is applicable to you and then learn that sub-protocol along with the initial device enumeration stage. If you can do that then you’ll know enough to create a reliable USB device of your own.

The best technical online guide that I’ve found is USB in a nutshell. Calling it a nutshell is a bit of a stretch of the imagination but it is well written and makes a great read if you got some time to spare.

In the rest of this article I’m going to refer to endpoints, descriptors, hosts and devices so if you’re not familiar with these terms then I recommend that you visit the USB in a nutshell pages and brush up on those USB basics.

Previous Page <<1 of 9
Use your ← → (arrow) keys to browse