[HN Gopher] STM32 Blue Pill as an Hid USB Keyboard
___________________________________________________________________
STM32 Blue Pill as an Hid USB Keyboard
Author : thealienthing
Score : 30 points
Date : 2023-08-30 16:37 UTC (6 hours ago)
(HTM) web link (www.instructables.com)
(TXT) w3m dump (www.instructables.com)
| extraduder_ire wrote:
| Do these boards still have that design flaw that prevents them
| from working right with USB? Especially for programming.
|
| I remember replacing a resistor on one four-ish years ago, so
| that I could use it in a usb2 port. (worked fine with a usb 1.1.
| hub)
| leshow wrote:
| I've got one of these from way back and was meaning to do
| something similar in Rust. Yet another project that I just never
| got around to.
| gaudat wrote:
| 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.
| topspin wrote:
| 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!
| kevin_thibedeau wrote:
| You can purchase some of their boards via Mouser directly who
| is the one fulfilling orders on STs behalf.
| NikkiA wrote:
| Jeez, I paid 1/3 of that for my black pills, and they're
| objectively better in every metric.
| monocasa wrote:
| Those jumped up in price about the same time. Hell, I saw fly
| by night operations buying up black pill boards just to pull
| the SoCs off to sell as sketch second sourced chips.
| vbezhenar wrote:
| I can buy pill for $3 and nucleo for $50. I guess it depends on
| location, but for me nucleo is like a luxury item.
| mike_hock wrote:
| Don't the Pis still go for 100 a pop or has that finally
| normalized now?
| deepspace wrote:
| I just bought a 4G 4B for $75 Canadian. More expensive than
| before the pandemic, but not outrageous. Of course, once you
| add a case, PSU, cables, etc, you are over $100 again.
| pimlottc wrote:
| Can someone explain what this is actual for? Is this just a
| tutorial for creating your own DIY USB client device?
| thealienthing wrote:
| Yeah it's just a tutorial. I don't really have any kind of
| platform for saving links I find useful so figured I'd post it
| here to save it for myself and maybe someone else would like
| it. I expected it to be completely ignored.
| dragontamer wrote:
| 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.
| Findecanor wrote:
| Windows will try to use the VendorID/ProductID pair on the
| device to look up which driver to load, but if there isn't
| any then a regular USB-HID device will default to using the
| generic HID driver.
|
| You'd get assigned a VendorID if you have a USB license: That
| is a USB-IF thing, not a Microsoft thing. Then each licensee
| gets to assign its own ProductIDs.
|
| There is no authentication in the core USB protocol: A device
| can declare any VendorID. Major microcontroller board
| manufacturers such as Sparkfun and PJRC provide specific
| VendorID/ProductIDs to be used by DIY projects using their
| boards ... but I've seen some of those being reused by other
| boards. I have also seen the VendorID 0xf055 used by free
| open source firmware.
| veyh wrote:
| If your project is open source, you can get a PID for free.
| [1]
|
| I received one for a virtual usb keyboard [2] that I made
| to work alongside a desktop app. Having a dedicated VID/PID
| makes detecting the presence of the device easy.
|
| [1] https://pid.codes/
|
| [2] https://github.com/veyh/AutoPTT-sidekick/
| connicpu wrote:
| 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 I2C 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 I2C devices over USB, it looks like there's plenty of
| cheap chips around that expose an I2C bus as a simple USB
| serial port to your computer.
| relwin wrote:
| 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.
| uxp8u61q wrote:
| 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.
| 38 wrote:
| > The DX
|
| ?
| clamstar wrote:
| Developer Experience.
| tyingq wrote:
| One example might be bridging an old dumb keyboard into working
| as a usb keyboard.
| chem83 wrote:
| 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.
| duskwuff wrote:
| In principle, yes, but you'd need something additional to
| act as a Bluetooth host. You'd probably be better off using
| a part that can do both, like an ESP32.
| fanf2 wrote:
| I don't know of an off-the-shelf way to implement what you
| want. There's a usb-usb converter in QMK which allows you
| to add QMK features to any keyboard, but QMK does not have
| Bluetooth support. ZMK is designed for Bluetooth but
| doesn't seem to have anything like QMK's protocol
| converters (tho I might have looked in the wrong place).
|
| You might be able to DIY it with a Raspberry Pi Pico W, by
| gluing together the picow_bt_example_hid_host_demo and
| tinyusb_dev_hid_multiple_interface examples from
| https://github.com/raspberrypi/pico-examples
| sowbug wrote:
| Blue Pills and Black Pills are popular with the DIY mechanical
| keyboard crowd as the brains of a keyboard circuit. The Arduino
| Pro Micro is also popular. I imagine that nowadays people also
| use the Raspberry Pi RP2040.
|
| The common feature among these boards is that they have
| relatively full-featured USB client support in hardware. This
| is different from other hobbyist embedded boards, such as most
| Arduinos, for example, which have only a USB virtual serial
| interface via a discrete chip for the purpose of uploading and
| debugging firmware. So if you can make the board look like a
| USB keyboard, and it has enough I/O to handle a matrix of
| keyboard switches, then with the right firmware like QMK,
| you've got yourself the building blocks of a custom keyboard.
|
| _My info is stale as of the start of the pandemic, when I gave
| up my mechanical-keyboard hobby and pivoted to DSLR-based
| videoconferencing._
| the__alchemist wrote:
| Blogspam. One of many Bluepill + DIY keyboard articles.
| thealienthing wrote:
| Are howto articles considered spam? I found it useful and
| wanted to share it as well as save the link so I could find
| it later. If this post violates some code of etiquette I'll
| not do it again.
___________________________________________________________________
(page generated 2023-08-30 23:01 UTC)