Documentation Index
Fetch the complete documentation index at: https://mintlify.com/zeroclaw-labs/zeroclaw/llms.txt
Use this file to discover all available pages before exploring further.
STM32 Nucleo Setup
STM32 Nucleo boards are ARM Cortex-M development boards from STMicroelectronics. ZeroClaw communicates with them via USB serial (ST-LINK Virtual COM Port) using a JSON protocol.Supported Boards
| Board | MCU | Flash | RAM | Status |
|---|---|---|---|---|
| Nucleo-F401RE | STM32F401RET6 | 512KB | 96KB | ✅ Primary |
| Other Nucleo | Various STM32 | Varies | Varies | 🚧 Experimental |
Nucleo-F401RE is the primary supported board. Other Nucleo boards may work with firmware modifications.
Hardware Features
- MCU: ARM Cortex-M4, 84 MHz
- GPIO: Arduino-compatible headers + Morpho connectors
- Peripherals: I2C, SPI, UART, ADC, PWM
- Debugger: Onboard ST-LINK/V2.1
- USB: Virtual COM Port (no FTDI needed)
- LED: PA5 (Arduino D13 equivalent, LD2)
- Button: PC13 (USER button)
Quick Start
1. Flash Firmware
ZeroClaw provides pre-built firmware for the Nucleo-F401RE:- Builds the firmware from
firmware/zeroclaw-nucleo/ - Flashes it via OpenOCD + ST-LINK
- Verifies the upload
2. Find Serial Port
3. Add to Configuration
4. Test Connection
Pin Mapping
Arduino Headers
Special Pins
| Function | Pin | Notes |
|---|---|---|
| User LED (LD2) | PA5 (D13) | Built-in green LED |
| User Button | PC13 | Active low |
| USART2 (Console) | PA2 (TX), PA3 (RX) | ST-LINK VCP |
| I2C1 | PB9 (SDA), PB8 (SCL) | Arduino I2C |
| SPI1 | PA7 (MOSI), PA6 (MISO), PA5 (SCK) | Arduino SPI |
Wiring Examples
External LED
Button Input
Manual Firmware Flashing
Prerequisites
Build Firmware
Flash with OpenOCD
Flash with probe-rs (Alternative)
Serial Protocol
The firmware implements a JSON-over-UART protocol:Request Format
Response Format
Supported Commands
| Command | Args | Description |
|---|---|---|
ping | None | Health check, returns “pong” |
gpio_read | {"pin": N} | Read GPIO pin (0 or 1) |
gpio_write | {"pin": N, "value": V} | Write GPIO pin (0=LOW, 1=HIGH) |
capabilities | None | Get available GPIO pins |
Testing Manually
Tools Provided
When a Nucleo board is connected, ZeroClaw exposes:| Tool | Description |
|---|---|
gpio_read | Read digital pin value |
gpio_write | Set digital pin high or low |
hardware_capabilities | Query available GPIO pins |
hardware_memory_map | Get STM32F401 memory layout |
hardware_board_info | Get board architecture and VID/PID |
Firmware Architecture
The firmware is built with:- Language: Rust (embedded, no_std)
- Framework: Embassy (async embedded)
- HAL: embassy-stm32
- Protocol: Newline-delimited JSON over USART2
- Size: ~30KB (fits easily in 512KB flash)
firmware/zeroclaw-nucleo/src/main.rs
Advanced: Custom Firmware
To add custom peripherals (I2C sensors, PWM servos, etc.):- Edit
firmware/zeroclaw-nucleo/src/main.rs - Add new commands to the
handleLinefunction - Rebuild and reflash
- Add corresponding Rust tools in
src/peripherals/serial.rs
Troubleshooting
Serial port not found
Permission denied on Linux
Firmware upload fails
No response from firmware
”Response id mismatch”
- Firmware crashed or rebooted
- Serial buffer corruption
- Try unplugging and replugging USB
Performance Notes
- GPIO speed: ~1 MHz toggle rate
- Serial latency: ~10ms round-trip
- Flash time: ~5 seconds
- Boot time: ~100ms after reset
Next Steps
Supported Boards
Compare all hardware platforms
Arduino Setup
Similar setup for Arduino boards
Hardware Architecture
Understand the peripheral system
Adding Boards
Add support for new boards