Spark Logic

Blue Pill USB HID game controller connection guide

Blue Pill USB HID game controller (STM32F103C8T6 Blue Pill) connection guide. Power the board from USB. Connect and test one button.

STM32F103C8T6 Blue Pill

55 contacts Current package

Spark Logic project archive· This map follows the vcc-gnd.com Blue Pill schematic dated 2016-01-26. Check the wiring and fitted parts on other Blue Pill boards.

Power the board from USB

Required

Micro-USB VBUS and H2-3 share the 5 V rail directly, with no isolation between them. The onboard RT9193-33 regulator supplies the 3.3 V rail. Leave external power headers disconnected. Check the 3.3 V rail before attaching the debug probe.

  • USB power input
    • USB host VBUS
  • USB return
    • USB host ground
  • Board logic rail
    • 3.3 V measurement point

Bench checks

  • Identify the USB power input and ground in the documentation for your PCB revision.
  • Measure roughly 3.3 V between the board logic rail and ground. Check for a short or wrong connector if the rail is low.

STM32F103C8T6 Blue Pill connector map

Connection scenarios

Connect and test one button

Configure PA0 as an input. Fit a 10 kΩ pull-up to 3.3 V and a normally-open switch from PA0 to ground. Connect the native USB port to a host and report the active-low button state through the joystick interface.

  • Logic supply
    • R1.1
  • Button sense
    • R1.2
    • Switch terminal 1
  • Return
    • Switch terminal 2
10 kΩ between Logic supply and Button senseLogic supply10 kΩButton sense

Bench checks

  • Confirm that the host enumerates a joystick. If it does not, verify USB clock, cable and D+ pull-up first.
  • Check that the host shows button press and release once for each switch cycle. Add debounce in firmware if needed.

USBComposite_stm32f1 joystick example and Blue Pill board schematic.

STM32F103C8T6 Blue Pill wiring map

External wiring example · Connect and test one button

Highlighted contacts are used in the required step or selected circuit. Select a contact to highlight its wiring nets.

Connector contacts

H1 and H2 correspond to P3 and P4, H3 to SWD P2, and H4 to Micro-USB U3. Boot contacts use the schematic’s P1 numbering.

Selected pin details

H1-1 · VB

Power · Power

Connects to VBAT. Use the specified board power connection.

STM32F103C8T6 Blue Pill connector map

Electrical limits · Pin in the reference

Models and documents

The companion shows a one-button bench circuit with the joystick class. The button GPIO and resistor are choices for this example.

STM32F103C8T6 Blue Pill
This map follows the vcc-gnd.com Blue Pill schematic dated 2016-01-26. Check the wiring and fitted parts on other Blue Pill boards.