🛠 Create a Custom HID Device with Romu
Objectives
This tutorial aims to configure the Romu board to behave as a custom Human Interface Device (HID), such as a macro pad or MIDI controller. Unlike classic boards requiring cables, the Romu plugs directly into a USB Type-A port. The goal is to understand the RP2354A's hybrid architecture and exploit its security features to create passwordless authentication keys or productivity tools.
Required Material
- Romu development board (Bitmerse)
- Computer with USB Type-A port
- C/C++ development environment (Raspberry Pi RP235x SDK)
- USB-C debug cable (for initial flashing via pads)
- Soldering iron and thin wire (to connect pads if necessary)
Steps
Install the official SDK for the RP2354A. Ensure the Arm Cortex-M33 compiler is correctly configured, as the main core handles the USB stack.
- Environment Setup
git clone https://github.com/raspberrypi/pico-sdk.git
cd pico-sdk
make
Create a new project folder. Since the Romu lacks easily accessible external GPIOs, you will use the integrated buttons and RGB LED. Configure the USB descriptor to declare a generic HID device.
- HID Project Preparation
// Simplified HID descriptor structure example
const uint8_t hid_report_descriptor[] = {
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x06, // Usage (Keyboard)
0xA1, 0x01, // Collection (Application)
// ... key definitions ...
0xC0
};
Write code that reads the state of the physical buttons on the board. On press, send a specific HID frame (e.g., a key combination for a shortcut).
- Input Logic Implementation
void send_hid_report(uint8_t keycode) {
uint8_t report[8] = {0};
report[2] = keycode;
tud_hid_report(0, report, sizeof(report));
}
Compile the firmware. Since there is no standard USB-C connector for BOOTSEL mode flashing, you will likely need to use the debug pads to connect a USB-Serial adapter or use an SWD flashing tool, depending on the final board configuration.
- Compilation and Flashing
cmake ..
make
Verification
Once the firmware is loaded, insert the Romu board directly into a USB Type-A port on your computer. The operating system should detect a new HID device. Open a text editor or USB diagnostic tool to confirm that pressing the Romu buttons triggers the programmed actions (e.g., sending a letter or macro). The RGB LED should light up to indicate activity.
Going Further
Explore the RP2354A's Arm Trustzone and Secure Boot security features. You can design a security key that requires cryptographic authentication before sending HID commands, turning the Romu into a robust passwordless authentication token for sensitive environments.
Other tutorials for this board
Code examples for this board
romu-rgb-led-pwm.inoC/C++ (Pico SDK)romu-hid-keyboard-macro.inoC/C++ (TinyUSB)romu-internal-flash-storage.inoC/C++ (Pico SDK)romu-midi-controller.inoC/C++ (TinyUSB)romu-secure-boot-check.inoC/C++ (Pico SDK)romu-hid-custom-keyboard.inoC++ (Arduino)