Zephyr RTOS application implementing the Memfault Diagnostic Service (MDS) protocol over USB HID for nRF52840.
- USB HID interface for MDS protocol communication
- Memfault diagnostics data collection and streaming
- Configurable heartbeat metrics (10s for testing, 1h default for production)
- Support for all MDS protocol reports:
- Supported Features (0x01)
- Device Identifier (0x02)
- Data URI (0x03)
- Authorization (0x04)
- Stream Control (0x05)
- Stream Data (0x06)
- Board: nRF52840 DK (nrf52840dk/nrf52840)
- USB: VID 0x2fe3 (Zephyr Project), PID 0x0007
- Python 3.10 or newer
- Zephyr SDK installed
- nRF52840 DK hardware
git clone <repository-url>
cd mds-over-hid-apppython3 -m venv .venv
source .venv/bin/activatepip install westThis pulls Zephyr RTOS, nRF SDK, and all dependencies (this may take several minutes):
west init -l app
west updatepip install -r zephyr/scripts/requirements.txtCopy the template configuration and add your Memfault project key:
cp app/prj.conf.template app/prj.conf
# Edit app/prj.conf and replace YOUR_PROJECT_KEY_HERE with your actual keyGet your project key from https://app.memfault.com/ → Settings → General
cd app
west build -b nrf52840dk/nrf52840Connect your nRF52840 DK via USB and flash:
west flashKey configuration options in app/prj.conf:
CONFIG_MEMFAULT_NCS_PROJECT_KEY: Your Memfault project key (required)CONFIG_MEMFAULT_NCS_DEVICE_ID: Unique device identifierCONFIG_MEMFAULT_METRICS_HEARTBEAT_INTERVAL_SECS: Metrics collection interval (10s for testing)
This device implements the MDS protocol over USB HID. The host can:
- Query device information via Feature Reports (IDs 1-4)
- Enable/disable streaming via Stream Control (ID 5)
- Receive diagnostic data chunks via Stream Data (ID 6)
The application uses Memfault SDK integration for NCS. Diagnostic data is automatically collected and queued for transmission when streaming is enabled by the host.