Skip to content

feat(daplink_bridge): Add firmware version query command. #242

Description

@nedseb

Description

Add a command to query the DAPLink firmware version from the STM32F103 via I2C. This allows the MicroPython driver to detect which firmware features are available (e.g. config zone commands require a specific firmware version).

Note: this issue originally targeted daplink_flash. Since then, the bridge layer has been factored out and all "bridge-level" DAPLink commands (WHO_AM_I, config zone, …) live in daplink_bridge. The version query belongs there too.

Proposed approach

Firmware side (steamicc/DAPLink)

Add a new I2C command FIRMWARE_VERSION (0x02) that returns the version as 3 bytes:

Command Code Parameters Response Description
Firmware version 0x02 NONE 3 bytes Returns major, minor, patch as 3 bytes

The version is defined as a constant in the firmware and incremented with each release. 0x01 is already taken by WHO_AM_I, 0x02 is currently free (see lib/daplink_bridge/daplink_bridge/const.py).

MicroPython side

Add a firmware_version() method to DaplinkBridge:

def firmware_version(self):
    """Return the DAPLink firmware version as a (major, minor, patch) tuple."""
    data = self._read_reg(CMD_FIRMWARE_VERSION, 3)
    return (data[0], data[1], data[2])

Add the matching constant to daplink_bridge/const.py:

CMD_FIRMWARE_VERSION = const(0x02)

Use cases

  • Skip hardware tests that require config zone if firmware is too old
  • Display firmware version in diagnostic scripts
  • Warn users when a firmware update is needed

Related

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions