[BluePill] USB Keyboard example doesn't work

Post here first, or if you can't find a relevant section!
Post Reply
kurtzweber
Posts: 1
Joined: Sun Mar 09, 2025 4:48 pm

[BluePill] USB Keyboard example doesn't work

Post 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!
Ricardowell
Posts: 3
Joined: Mon Apr 21, 2025 6:34 am

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

Post 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.
Last edited by Ricardowell on Mon May 12, 2025 2:17 am, edited 1 time in total.
GonzoG
Posts: 498
Joined: Wed Jan 15, 2020 11:30 am
Answers: 36
Location: Prudnik, Poland

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

Post 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
Post Reply

Return to “General discussion”