Page 1 of 1

[BluePill] USB Keyboard example doesn't work

Posted: Mon Mar 10, 2025 11:30 am
by kurtzweber
Hi

I'm trying to make the USB Keyboard example work with a BluePill board but I'm facing some issues.

First of all, I'm not using any bootloaders (I read that they can cause some issues in this scenario), I'm uploading the sketch using a serial adapter connected to pin A9 and A10 and "STM32CubeProgrammer (serial)" as programmer.

I also enabled "HID Keyboard and mouse" in the USB support menu.

The "KeyboardMessage.ino" sketch compiles and uploads to the board, but when I connect the board to my laptop, only a "STM Serial" device appears (with a yellow question mark):

Image

Can you help?

An additional question: my project should act as a USB gamepad... is there a library to implement such a HID device or am I forced at the moment to stay with keyboard or mouse?

Thanks!

Re: [BluePill] USB Keyboard example doesn't work

Posted: Thu May 08, 2025 2:22 am
by Ricardowell
kurtzweber wrote: Mon Mar 10, 2025 11:30 am Hi

I'm trying to make the USB Keyboard example work with a BluePill board but I'm facing some issues.

First of all, I'm not using any bootloaders (I read that they can cause some issues in this scenario), I'm uploading the sketch using a serial adapter connected to pin A9 and A10 and "STM32CubeProgrammer (serial)" as programmer.

I also enabled "HID Keyboard and mouse" in the USB support menu.

The "KeyboardMessage.ino" sketch compiles and uploads to the board, but when I connect the board to my laptop, only a "STM Serial" device appears (with a yellow question mark doodle jump online):

Image

Can you help?

An additional question: my project should act as a USB gamepad... is there a library to implement such a HID device or am I forced at the moment to stay with keyboard or mouse?

Thanks!
Hey! I ran into something similar on my BluePill—getting only "STM Serial" usually means it's not switching to USB HID mode properly. A few things to check:

Make sure your board has the correct 1.5k pull-up resistor on PA12 (some clones don't).

Double-check that you're using a board with the USB lines actually connected (not all BluePills are wired for USB).

Try flashing via ST-Link instead of serial to rule out bootloader quirks entirely.

Re: [BluePill] USB Keyboard example doesn't work

Posted: Thu May 08, 2025 10:37 am
by GonzoG
There's no HID joystick library for stm32duino. There is one for arduino boards with ATMega32U (micro, leonardo and clones):
https://github.com/MHeironimus/ArduinoJoystickLibrary
and a fork of it with force feedback support:
https://github.com/YukMingLaw/ArduinoJo ... FFBLibrary