devicesdk flash
Flash firmware to Raspberry Pi Pico
Note: Flashing is typically one-time per device. After initial flashing, updates are delivered over-the-air (OTA). Only major firmware upgrades may need a repeat flash, and even those are optional unless you want the new firmware capabilities.
Usage
devicesdk flash [flags]
Flags
--timeout <seconds>- Wait timeout for BOOTSEL mode (default: 30)--device-id <id>- Provision with specific device ID
Description
Flashes the DeviceSDK firmware to your Raspberry Pi Pico, including:
- WebSocket client
- Device credentials
- Hardware abstraction layer
- Automatic reconnection logic
Supported Hardware
Currently supported:
- Raspberry Pi Pico W
- Raspberry Pi Pico 2W
Coming soon:
- ESP32 series
- Additional RP2040 boards
Flashing Process
- Put device in BOOTSEL mode (see below)
- Run
devicesdk flash - CLI detects device and begins flashing
- Wait for completion (30-60 seconds)
- Device reboots and connects
BOOTSEL Mode
To enter BOOTSEL mode:
- Disconnect the Pico from USB
- Hold the BOOTSEL button
- Connect USB while holding button
- Release button
The Pico appears as a USB drive named “RPI-RP2”.
Examples
Flash device:
devicesdk flash
Flash with specific device ID:
devicesdk flash --device-id my-sensor-001
Custom timeout:
devicesdk flash --timeout 60
Device Credentials
The firmware is flashed with embedded credentials that:
- Authenticate with DeviceSDK
- Associate with your project
- Enable secure communication
Credentials are unique per device and stored securely in flash memory.
After Flashing
Once flashed:
- Device reboots automatically
- Connects to DeviceSDK
- Runs your deployed code
- Appears in dashboard as online
WiFi Configuration
For Pico W, configure WiFi after flashing:
- Device creates a WiFi access point
- Connect to
DeviceSDK-XXXX - Open browser to configure
- Enter your WiFi credentials
- Device reconnects with your network
Or configure programmatically in your device code.
Firmware Updates
To update firmware on an already-flashed device:
- Enter BOOTSEL mode again
- Run
devicesdk flash - New firmware is written
Existing credentials are preserved unless you specify a new device ID.
Troubleshooting
Device not detected?
Ensure BOOTSEL mode is active. The Pico should appear as a USB drive.
Flashing fails?
- Check USB cable (must support data, not power-only)
- Try a different USB port
- Ensure no other programs are accessing the drive
Device won’t connect after flashing?
- Check WiFi configuration (Pico W)
- Verify device appears in dashboard
- Check device logs for errors
Timeout waiting for device?
Increase timeout:
devicesdk flash --timeout 120
Multiple Devices
Flash multiple devices by running the command for each device:
devicesdk flash --device-id sensor-1
# Wait for completion, switch device
devicesdk flash --device-id sensor-2
# Repeat...
CI/CD
Flashing requires physical hardware connection and cannot be automated in CI/CD. Flash devices manually during provisioning.
Related Commands
- devicesdk deploy - Deploy code to flashed devices
Hardware Guide
Need help with hardware setup? See: