From 80ee1005eb4476bcff121db5d4f5fffb251da2c8 Mon Sep 17 00:00:00 2001 From: glopesdev Date: Tue, 18 Nov 2025 13:48:20 +0000 Subject: [PATCH 01/17] Ensure consistent terminology with binary protocol --- Device.md | 150 +++++++++++++++++++++++++++--------------------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/Device.md b/Device.md index 0f81eef..c145ef1 100644 --- a/Device.md +++ b/Device.md @@ -10,40 +10,40 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S ## Device Interface -All device functionality provided to the host under the Harp protocol, including device configuration, is specified using a standardized device interface. The device interface is composed of a collection of hardware registers. Each register is defined by a unique memory location, which can be accessed for reading and writing. These memory locations can be tied to hardware-related functionality, such that changing the value of the register can directly change the operation of the device. +All Device functionality, including device configuration, SHOULD be provided to the Controller using the [Harp Binary Protocol](BinaryProtocol-8bit.md), and documented using a standardized Device Interface. The Device Interface is described by a collection of hardware registers. Each register is defined by a unique memory location, which can be accessed for reading and writing. These memory locations can be tied to hardware-related functionality, such that changing the value of the register can directly change the operation of the Device. For example, a register can be used to configure device properties such as sampling frequency, operation mode, input / output routing, and other device-specific parameters. A register can also be used to control specific functionality, such as toggling digital output lines, starting and stopping pulse trains, or moving a motor. -Each register in the device interface is assigned a unique zero-based address, and a payload type describing the format of the data stored in the register. Registers can be read-only or allow both reading and writing. +Each register in the Device Interface is assigned a unique zero-based address, and a payload type describing the format of the data stored in the register. Registers can be read-only or allow both reading and writing. -Except for [Optional or Deprecated registers](#optional-or-deprecated-registers), whose behavior is clarified below, all registers and functionality specified in this document MUST be implemented for a device to be declared compliant with this specification. +Except for [Optional or Deprecated registers](#optional-or-deprecated-registers), whose behavior is clarified below, all registers and functionality specified in this document MUST be implemented by a Device complying with this specification. ## Application Registers -All registers pertaining to the hardware-specific operation of a device are application registers. Every application register MUST have an address equal to, or greater than, 32. The address, payload type, and naming of application registers is left to the device developer, as it will always be specific to each device. +All registers pertaining to the hardware-specific operation of the Device are application registers. Every application register MUST have an address equal to, or greater than, 32. The address, payload type, and naming of application registers is left to the device developer, as it will always be specific to each Device. ## Optional and Deprecated Registers -Some registers are marked as **Optional** or **Deprecated** in the [Core Registers](#core-registers) table, and their functionality MAY not be fully implemented in all devices. However, all optional or deprecated registers MUST implement `Read` commands by sending a reply to the host with the specified default value. Moreover, they MUST be included as part of the [`R_OPERATION_CTRL`](#r_operation_ctrl-u8--operation-mode-configuration) register dump. +Some registers are marked as **Optional** or **Deprecated** in the [Core Registers](#core-registers) table, and their functionality MAY not be fully implemented by the Device. However, all optional or deprecated registers MUST reply to `Read` requests by sending a message to the Controller with the specified default value. Moreover, they MUST be included as part of the [`R_OPERATION_CTRL`](#r_operation_ctrl-u8--operation-mode-configuration) register dump. -For any writeable optional or deprecated registers whose function is not implemented, the device MUST always return a `Write` reply payload containing the register default value, to indicate the `Write` command had no effect. The device SHOULD NOT crash or enter an undefined state when a write command is sent to an optional or deprecated unimplemented register. +For any writeable optional or deprecated registers whose function is not implemented, the Device MUST always return a `Write` reply payload containing the register default value, to indicate the `Write` request had no effect. The Device SHOULD NOT crash or enter an undefined state when a `Write` request is sent to an optional or deprecated unimplemented register. In most cases, the default value of an optional or deprecated register SHOULD be `0` (Zero). Other values MAY be allowed, in which case they MUST be explicitly documented and justified on a per-register basis. ## Operation Mode -The following Harp device operation modes MUST be implemented: +The following Device operation modes MUST be implemented: -- `Standby:` The device MUST reply to host commands. All `Event` messages are disabled and MUST NOT be sent to the host. -- `Active:` The device MUST reply to host commands. All `Event` messages are enabled and SHOULD be sent to the host following the device specification. +- `Standby:` The Device MUST reply to Controller requests. All `Event` messages are disabled and MUST NOT be sent to the Controller. +- `Active:` The Device MUST reply to Controller requests. All `Event` messages are enabled and SHOULD be sent to the Controller following the Device specification. -Harp devices SHOULD continuously check if communication with the host is active and healthy. This status check will be largely dependent on the transport layer implementing the Harp protocol between host and device. Each implementation SHOULD clearly distinguish between `Connected` and `NotConnected` states, and it is up to the developer to decide how to implement this status check. When the device transitions to the `NotConnected` state, it MUST immediately enter `Standby` and stop transmission of further `Event` messages. +The Device SHOULD continuously check if communication with the Controller is active and healthy. This status check will be largely dependent on the transport layer implementing the Harp communication protocol between Controller and Device. Each implementation SHOULD clearly distinguish between `Connected` and `NotConnected` states, and it is up to the developer to decide how to implement this status check. When the Device transitions to the `NotConnected` state, it MUST immediately enter `Standby` and stop transmission of further `Event` messages. -As an application example, devices using USB as the transport layer MAY poll for an active USB connection by checking that the state of the DTR pin is `HIGH`. Once the DTR pin is brought `LOW` it SHOULD be assumed that the host closed the connection and the device MUST enter `Standby`. In this case, the host is responsible for setting the state of the DTR line when opening or closing a new connection. +As an application example, a Device using USB as the transport layer MAY poll for an active USB connection by checking that the state of the DTR pin is `HIGH`. Once the DTR pin is brought `LOW` it SHOULD be assumed that the Controller closed the connection and the Device MUST enter `Standby`. In this case, the Controller is responsible for setting the state of the DTR line when opening or closing a new connection. ## Core Registers -All Harp devices MUST implement the set of common core registers below. These reserved registers are used to identify the device, the version of various components, determine the current operation mode, and other common operations. +The following set of Device core registers MUST be implemented. These reserved registers are used to identify the Device, the version of various components, determine the current Device operation mode, and other common operations. |**Name**|**Volatile**|**Read Only**|**Type**|**Add.**|**Default**|**Brief Description**|**Necessity**| | :- | :-: | :-: | :-: | :-: | :-: | :- | :-: | @@ -59,16 +59,16 @@ All Harp devices MUST implement the set of common core registers below. These re |[`R_TIMESTAMP_MICRO`](#r_timestamp_micro-u16--system-timestamp-microseconds)|Yes|Yes|U16|009|0|System timestamp: microseconds|Required| |[`R_OPERATION_CTRL`](#r_operation_ctrl-u8--operation-mode-configuration)|No|No|U8|010|b)|Configuration of the operation mode|Required| |[`R_RESET_DEV`](#r_reset_dev-u8--reset-device-and-save-non-volatile-registers)|No|No|U8|011|b)|Reset device and save non-volatile registers|Optional| -|[`R_DEVICE_NAME`](#r_device_name-25-bytes--human-readable-device-name)|No|No|U8|012|b)|Human-readable name of the device|Optional| -|[`R_SERIAL_NUMBER`](#r_serial_number-u16--device-serial-number)|No|No|U16|013|b)|Unique serial number of the device|Deprecated| +|[`R_DEVICE_NAME`](#r_device_name-25-bytes--human-readable-device-name)|No|No|U8|012|b)|Human-readable device name|Optional| +|[`R_SERIAL_NUMBER`](#r_serial_number-u16--device-serial-number)|No|No|U16|013|b)|Unique serial number of the Device|Deprecated| |[`R_CLOCK_CONFIG`](#r_clock_config-u8--synchronization-clock-configuration)|No|No|U8|014|b)|Synchronization clock configuration|Optional| |[`R_TIMESTAMP_OFFSET`](#r_timestamp_offset-u8--clock-calibration-offset)|No|No|U8|015|b)|Configures an offset for Timestamp updates|Deprecated| |[`R_UID`](#r_uid-16-bytes--unique-identifier)|No|Yes|U8|016|b)|Stores a unique identifier (UID) |Optional| |[`R_TAG`](#r_tag-8-bytes--firmware-tag)|-|Yes|U8|017|b)|Firmware tag|Optional| -|[`R_HEARTBEAT`](#r_heartbeat-u16--heartbeat-register-reporting-the-current-status-of-the-device)|Yes|Yes|U16|018|b)|Monitors the state of the device|Required| -|[`R_VERSION`](#r_version-u8--semantic-version-information)|-|Yes|U8|019|a)|Semantic version information for the device|Required| +|[`R_HEARTBEAT`](#r_heartbeat-u16--heartbeat-register-reporting-the-current-status-of-the-device)|Yes|Yes|U16|018|b)|Monitors the state of the Device|Required| +|[`R_VERSION`](#r_version-u8--semantic-version-information)|-|Yes|U8|019|a)|Semantic version information for the Device|Required| -||a) These values MUST be stored during the firmware build process and are persistent, i.e. they SHALL NOT be changeable by the host.
b) Check register notes on the specific register explanation | +||a) These values MUST be stored during the firmware build process and are persistent, i.e. they SHALL NOT be changeable by the Controller.
b) Check register notes on the specific register explanation | | :- | :- | -### **`R_WHO_AM_I` (U16) – Who Am I** +### **`R_WHO_AM_I` (U16) – Product identifier** Address: `000` @@ -233,7 +233,7 @@ b) `Standby` and `Active` modes are mandatory. `Speed` mode is deprecated. > > The Device MUST reply with `Error` in case this operation mode is not supported. -* **HEARTBEAT_EN [Bit 2]:** If this bit is set, the Device MUST send an `Event` message every second with the contents of [`R_HEARTBEAT`](#r_heartbeat-u16--heartbeat-register-reporting-the-current-status-of-the-device). This allows the Controller to check the status of the Device periodically. If the `ALIVE_EN` bit is also set, this bit has precedence and the Device must send `R_HEARTBEAT` periodically instead of `R_TIMESTAMP_SECOND`. +* **HEARTBEAT_EN [Bit 2]:** If this bit is set, the Device MUST send an `Event` message every second with the contents of [`R_HEARTBEAT`](#r_heartbeat-u16--device-status-information). This allows the Controller to check the status of the Device periodically. If the `ALIVE_EN` bit is also set, this bit has precedence and the Device must send `R_HEARTBEAT` periodically instead of `R_TIMESTAMP_SECOND`. * **DUMP [Bit 3]:** If this bit is set on a `Write` request, the Device SHALL send a sequence of `Read` messages to the Controller, one per register, with the current contents of all core and application registers. These messages MUST be sent following the `Write` reply to the request from the Controller. When sending a reply to a `Read` request, the Device MUST clear this bit in the message payload. * **MUTE_RPL [Bit 4]:** If this bit is set, the Device SHALL NOT send any messages in reply to a request from the Controller. * **VISUAL_EN [Bit 5]:** If this bit is set, any visual indicators, typically LEDs, available on the Device SHOULD be enabled. Otherwise, if the bit is cleared, all visual indicators SHOULD be turned off. @@ -436,7 +436,7 @@ An array of 8 bytes that can be used to store a tag for a specific firmware buil If not implemented, the Device MUST return a default value of `0` (Zero) for all bytes. -### **`R_HEARTBEAT` (U16) – Heartbeat register reporting the current status of the device** +### **`R_HEARTBEAT` (U16) – Device status information** Address: `018` @@ -471,7 +471,7 @@ This register is read-only and used to provide status information about the Devi * **IS_SYNCHRONIZED [Bit 1]:** If this bit is set, the Device MUST be synchronized with an external Harp clock generator. If the Device is itself a clock generator (see [`R_CLOCK_CONFIG`](#r_clock_config-u8--synchronization-clock-configuration) bit `CLK_GEN`), this bit MUST always be set. -### **`R_VERSION` (U8) – Semantic version information** +### **`R_VERSION` (U8) – Device version information** Address: `019` @@ -512,7 +512,7 @@ gantt - :d4, after sdk_id, 32 ``` -The bytes in this register specify the [semantic version](https://semver.org/) of different Device components. Each component version is made up of three bytes, following the order `major`, `minor`, `patch`. The register also includes a unique identifier of the core microcontroller SDK and a hash digest of the interface schema file describing the Device Interface. +The bytes in this register specify the [semantic version](https://semver.org/) of the components making up the Device. Each component version is made up of three bytes, following the order `major`, `minor`, `patch`. The register also includes a unique identifier of the core microcontroller SDK and a hash digest of the interface schema file describing the Device Interface. * **PROTOCOL:** The semantic version of the Harp protocol implemented by the Device. @@ -532,7 +532,7 @@ The following registers are deprecated and their functionality SHOULD NOT be imp > [!WARNING] > -> This register is deprecated in favor of [`R_VERSION`](#r_version-u8--semantic-version-information). The value of this register MUST be equal to the major `HARDWARE` version in `R_VERSION`. +> This register is deprecated in favor of [`R_VERSION`](#r_version-u8--device-version-information). The value of this register MUST be equal to the major `HARDWARE` version in `R_VERSION`. Address: `001` @@ -562,7 +562,7 @@ Specifies the major hardware version number. The value of this register is persi > [!WARNING] > -> This register is deprecated in favor of [`R_VERSION`](#r_version-u8--semantic-version-information). The value of this register MUST be equal to the minor `HARDWARE` version in `R_VERSION`. +> This register is deprecated in favor of [`R_VERSION`](#r_version-u8--device-version-information). The value of this register MUST be equal to the minor `HARDWARE` version in `R_VERSION`. Address: `002` @@ -588,7 +588,7 @@ gantt Specifies the minor hardware version number. The value of this register is persistent and MUST NOT be changeable by the Controller. -### **`R_ASSEMBLY_VERSION` (U8) – Version of the Assembled Components** +### **`R_ASSEMBLY_VERSION` (U8) – Version of Assembled Components** > [!WARNING] > @@ -622,7 +622,7 @@ Specifies the version number of the assembled components. The value of this regi > [!WARNING] > -> This register is deprecated in favor of [`R_VERSION`](#r_version-u8--semantic-version-information). The value of this register MUST be equal to the major `PROTOCOL` version in `R_VERSION`. +> This register is deprecated in favor of [`R_VERSION`](#r_version-u8--device-version-information). The value of this register MUST be equal to the major `PROTOCOL` version in `R_VERSION`. Address: `004` @@ -652,7 +652,7 @@ Contains the major version of the Harp protocol specification. The value of this > [!WARNING] > -> This register is deprecated in favor of [`R_VERSION`](#r_version-u8--semantic-version-information). The value of this register MUST be equal to the minor `PROTOCOL` version in `R_VERSION`. +> This register is deprecated in favor of [`R_VERSION`](#r_version-u8--device-version-information). The value of this register MUST be equal to the minor `PROTOCOL` version in `R_VERSION`. Address: `005` @@ -682,7 +682,7 @@ Contains the minor version of the Harp Protocol specification. The value of this > [!WARNING] > -> This register is deprecated in favor of [`R_VERSION`](#r_version-u8--semantic-version-information). The value of this register MUST be equal to the major `FIRMWARE` version in `R_VERSION`. +> This register is deprecated in favor of [`R_VERSION`](#r_version-u8--device-version-information). The value of this register MUST be equal to the major `FIRMWARE` version in `R_VERSION`. Address: `006` @@ -712,7 +712,7 @@ Contains the major firmware version number. The value of this register is persis > [!WARNING] > -> This register is deprecated in favor of [`R_VERSION`](#r_version-u8--semantic-version-information). The value of this register MUST be equal to the minor `FIRMWARE` version in `R_VERSION`. +> This register is deprecated in favor of [`R_VERSION`](#r_version-u8--device-version-information). The value of this register MUST be equal to the minor `FIRMWARE` version in `R_VERSION`. ```mermaid --- From c7931dacdff45f5fa9f94825772e39b6ecbbd6fe Mon Sep 17 00:00:00 2001 From: glopesdev Date: Thu, 27 Nov 2025 21:23:49 +0000 Subject: [PATCH 06/17] Ensure R_WHO_AM_I spec is consistent with core.yml --- Device.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Device.md b/Device.md index c777a6c..144b02a 100644 --- a/Device.md +++ b/Device.md @@ -76,7 +76,7 @@ Tables can be generated here https://www.tablesgenerator.com/html_tables Mermaid plots can be generated here: https://mermaid.live/ ---> -### **`R_WHO_AM_I` (U16) – Product identifier** +### **`R_WHO_AM_I` (U16) – Device Identity Class** Address: `000` @@ -101,7 +101,7 @@ gantt 0 :d1, 0, 2 ``` -Specifies the product identifier of the Device. The list of reserved device product identifiers can be found at [harp-tech/whoami](https://github.com/harp-tech/whoami). To reserve specific identifiers for your project or company, please follow the instructions in that repository. If the Device does not have a pre-allocated identifier, this register MUST be set to its default value of `0` (Zero). +Specifies the identity class of the Device. The list of reserved device product identifiers can be found at [harp-tech/whoami](https://github.com/harp-tech/whoami). To reserve specific identifiers for your project or company, please follow the instructions in that repository. If the Device does not have a pre-allocated identifier, this register MUST be set to its default value of `0` (Zero). ### **`R_TIMESTAMP_SECOND` (U32) – System timestamp (seconds)** From 750e34dd133f4bbb36982977418e8bd1234ff814 Mon Sep 17 00:00:00 2001 From: glopesdev Date: Thu, 27 Nov 2025 21:38:55 +0000 Subject: [PATCH 07/17] Clarify alternative to ALIVE_EN bit --- Device.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Device.md b/Device.md index 144b02a..f962594 100644 --- a/Device.md +++ b/Device.md @@ -248,7 +248,7 @@ b) `Standby` and `Active` modes are mandatory. `Speed` mode is deprecated. | 1 | Speed Mode. | | 0.1 | A critical error occurred. Only a hardware reset or a new power up can remove the Device from this Mode. | -* **ALIVE_EN [Bit 7]:** If this bit is set, the Device SHOULD send an `Event` message every second with the contents of [`R_TIMESTAMP_SECOND`](#r_timestamp_second-u32--system-timestamp-seconds). This allows the Controller to check the status of the Device periodically. This feature is deprecated and may be removed from future protocol versions. +* **ALIVE_EN [Bit 7]:** If this bit is set, the Device SHOULD send an `Event` message every second with the contents of [`R_TIMESTAMP_SECOND`](#r_timestamp_second-u32--system-timestamp-seconds). This feature has been deprecated and may be removed from future protocol versions. The Controller should set the `HEARTBEAT_EN` bit and monitor [`R_HEARTBEAT`](#r_heartbeat-u16--device-status-information) instead for periodically checking the status of the Device. ### **`R_RESET_DEV` (U8) – Reset device and save non-volatile registers** From 813e7f003cf4a39da1a6f5ea335fb3d5b1429c2f Mon Sep 17 00:00:00 2001 From: glopesdev Date: Thu, 27 Nov 2025 21:41:11 +0000 Subject: [PATCH 08/17] Clarify that the R_HEARTBEAT event is mandatory --- Device.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Device.md b/Device.md index f962594..5921c05 100644 --- a/Device.md +++ b/Device.md @@ -465,7 +465,7 @@ gantt - :d6, after bit1, 3 ``` -This register is read-only and used to provide status information about the Device. Any changes to the below bits are controlled by the Device and sent to the Controller through a periodic `Event` message. If periodic reporting is enabled by setting [`R_OPERATION_CTRL`](#r_operation_ctrl-u8--operation-mode-configuration) bit `HEARTBEAT_EN`, the event will be periodically emitted at a rate of 1 Hz, in sync with updates to the [`R_TIMESTAMP_SECOND`](#r_timestamp_second-u32--system-timestamp-seconds) register. +This register is read-only and used to provide status information about the Device. Any changes to the below bits are controlled by the Device and sent to the Controller through a periodic `Event` message. If periodic reporting is enabled by setting [`R_OPERATION_CTRL`](#r_operation_ctrl-u8--operation-mode-configuration) bit `HEARTBEAT_EN`, the Device MUST emit a periodic event on this register at a rate of 1 Hz, in sync with updates to the [`R_TIMESTAMP_SECOND`](#r_timestamp_second-u32--system-timestamp-seconds) register. * **IS_ACTIVE [Bit 0]:** If this bit is set, the Device MUST be in `Active` mode. The bit must be cleared if the Device is in any other mode (see [Operation Mode](#operation-mode) for information on available device modes). From ff5c4f0492785aac654b5ebe16b0e0820ada488b Mon Sep 17 00:00:00 2001 From: glopesdev Date: Thu, 27 Nov 2025 21:44:08 +0000 Subject: [PATCH 09/17] Fix register link --- Device.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Device.md b/Device.md index 5921c05..a57bb92 100644 --- a/Device.md +++ b/Device.md @@ -47,7 +47,7 @@ The following set of Device core registers MUST be implemented. These reserved r |**Name**|**Volatile**|**Read Only**|**Type**|**Add.**|**Default**|**Brief Description**|**Necessity**| | :- | :-: | :-: | :-: | :-: | :-: | :- | :-: | -|[`R_WHO_AM_I`](#r_who_am_i-u16--product-identifier)|-|Yes|U16|000|a)|Product identifier|Required| +|[`R_WHO_AM_I`](#r_who_am_i-u16--device-identity-class)|-|Yes|U16|000|a)|Product identifier|Required| |[`R_HW_VERSION_H`](#r_hw_version_h-u8--major-hardware-version)|-|Yes|U8|001|a)|Major Hardware version|Deprecated| |[`R_HW_VERSION_L`](#r_hw_version_l-u8--minor-hardware-version)|-|Yes|U8|002|a)|Minor Hardware version|Deprecated| |[`R_ASSEMBLY_VERSION`](#r_assembly_version-u8--version-of-assembled-components)|-|Yes|U8|003|a)|Version of assembled components|Deprecated| From 7e9df0041dfd30016e411b4db1ca7ae64297a9a0 Mon Sep 17 00:00:00 2001 From: glopesdev Date: Thu, 27 Nov 2025 21:53:46 +0000 Subject: [PATCH 10/17] Minor wording improvement --- Device.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Device.md b/Device.md index a57bb92..c59c871 100644 --- a/Device.md +++ b/Device.md @@ -68,7 +68,7 @@ The following set of Device core registers MUST be implemented. These reserved r |[`R_HEARTBEAT`](#r_heartbeat-u16--device-status-information)|Yes|Yes|U16|018|b)|Monitors device status|Required| |[`R_VERSION`](#r_version-u8--device-version-information)|-|Yes|U8|019|a)|Device version information|Required| -||a) These values MUST be stored during the firmware build process and are persistent, i.e. they SHALL NOT be changeable by the Controller.
b) Check register notes on the specific register explanation | +||a) These values MUST be stored during the firmware build process and are persistent, i.e. they SHALL NOT be changeable by the Controller.
b) Check notes on the specific register specification. | | :- | :- |