Live data from Hacker News

STM32 Blue Pill as an Hid USB Keyboard

instructables.com

1–10 of 34 posts

Re: STM32 Blue Pill as an Hid USB Keyboard

#2
The F103 microcontroller on the blue pill is the epicenter of price hiking during the semiconductor shortage. I've seen prices upwards of 35 USD for each chip. It was more expensive to get one of these chip than to get a Raspberry Pi.

I think it is better to use the Nucleo series of evaluation boards from ST now as they have first party support from ST.

Re: STM32 Blue Pill as an Hid USB Keyboard

#5
post #3

Can someone explain what this is actual for? Is this just a tutorial for creating your own DIY USB client device?

It's an example using STM32CubeMx dev environment. ST supplies many examples, including this one. However, this walkthru helps beginners navigate some of the complexity in getting it running.

Re: STM32 Blue Pill as an Hid USB Keyboard

#6
post #3

Can someone explain what this is actual for? Is this just a tutorial for creating your own DIY USB client device?

Yes, it looks like it's "just" a tutorial.

As someone who recently started dabbling into MCU programming, I can tell you that a tutorial that shows you all the steps, and has an end result that works and can still be tweaked, is valuable. The DX you may be used to in modern programming is something you can only dream of in the embedded world. Every manufacturer has their own bespoke frameworks, tools, and conventions. The development loop is long: you have to build the thing, flash it to the firmware, reboot the device... You're dealing with raw bytes 99% of the time, so compiler type safety is little help in checking that your program will behave as expected and mistakes are frequent. The global state is huge, and with so little computing/memory resources, you're discouraged from introducing complex abstraction that would help clarify the code or avoid mistakes.

Re: STM32 Blue Pill as an Hid USB Keyboard

#7
post #3

Can someone explain what this is actual for? Is this just a tutorial for creating your own DIY USB client device?

Windows HID interface is very flexible IIRC, and even added I2C support to the HID module or something... in Windows 8 or so?

I don't know all the details, but as I understand it, you don't necessarily need a USB License ($5000/year membership fee) to have a microcontroller running USB-HID across Windows.

Though I haven't figured out all the details of how all the mechanics work, its still interesting to work through even the most "toy" example of the USB-HID stack.

Re: STM32 Blue Pill as an Hid USB Keyboard

#8
post #2

The F103 microcontroller on the blue pill is the epicenter of price hiking during the semiconductor shortage. I've seen prices upwards of 35 USD for each chip. It was more expensive to get one of these chip than to get a Raspberry Pi. I think it is better to use the Nucleo series of evaluation boards from ST now as they have first party support from ST.

I ordered a NUCLEO-G474RE directly from ST yesterday. I could only add one to the cart, whereas I wanted two. When I recently bought two NUCLEO-F334R8 I didn't encounter this.

So apparently there is limited stock, and someone else that wants one can get it despite me. That's fine; I'll go back later and get another. It's great to see at least one damn company thinking this way.

BTW, they're providing free shipping for a limited time!

Re: STM32 Blue Pill as an Hid USB Keyboard

#9
post #3

Can someone explain what this is actual for? Is this just a tutorial for creating your own DIY USB client device?

Windows HID interface is very flexible IIRC, and even added I2C support to the HID module or something... in Windows 8 or so? I don't know all the details, but as I understand it, you don't necessarily need a USB License ($5000/year membership fee) to have a microcontroller running USB-HID across Windows. Though I haven't figured out all the details of how all the mechanics work, its still interesting to work through…

I was very intrigued by that possibility, but it seems like the stack there is inverted from what it sounds like at first glance. It's for supporting HID devices that are connected to an I²C interface on the motherboard chipset without having to write any kernel-mode drivers. Think stuff like custom lighting or other devices built in to your system that don't need the speed to take up a whole USB endpoint.

I think if someone wanted to have a very simple interface to control I²C devices over USB, it looks like there's plenty of cheap chips around that expose an I²C bus as a simple USB serial port to your computer.

Re: STM32 Blue Pill as an Hid USB Keyboard

#10
post #4
post #3

Can someone explain what this is actual for? Is this just a tutorial for creating your own DIY USB client device?

One example might be bridging an old dumb keyboard into working as a usb keyboard.

Could it also be used to bridge a BT keyboard to USB for the semi-rare cases where having a wired keyboard is necessary (BIOS access, boot loader, login screen etc.)? I expected this type of product to exist, but couldn't really find a good one after a cursory look.
Post reply on HN