|
|
@@ -1,3 +1,67 @@
|
|
|
# nano Bus
|
|
|
|
|
|
-Protocol stack for Body Area Network Modules
|
|
|
+Protocol stack for Body Area Network Modules. The nBus protocol is an application layer protocol for connecting sensor nodes to a higher-level control unit in the BAN. The main development goal is to provide a reliable and secure way for real-time monitoring and feedback of health parameters during clinical or home rehabilitation and physiotherapy.
|
|
|
+The communication is a master/slave request/response, allowing not only node addressing but also specific sensor addressing, as a communication node might consist of sensors as well as actuators. Packet structure consists of a link frame and an application packet as shown following figure.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+In a single nBus network, only one master is permitted, which sends data requests, slave commands and application error handling. The information about the target service is contained in a single function byte and supports up to 128 function codes. The MSB of the function byte is reserved for an error flag.
|
|
|
+
|
|
|
+These functions range from version information, data request, node and sensor parameter configuration to node echo, calibration, sleep and wake requests. nBus supports broadcast for the entire network (e.g. clock synchronization across nodes or calibration of all inertial sensors), broadcast for individual node elements (e.g. setting the same gain for each force sensor in a single node) and also node element uni-cast (i.e. sending data for display on an integrated display).
|
|
|
+
|
|
|
+The target element is specified in the element address byte as shown on following figure. The first three bits are used to indicate the element type with the first bit's designation as an input/output selector and two reserved for later versions. The remaining bits are used for element addressing. This way we can integrate up to 31 sensors and 31 actuators into a single node.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+The slave node listens to the master's requests and generates corresponding responses. The distinction between transmission types is made by node and element address bytes, as shown in following table, where X is in <1,127> and represents a node address. Y being an element address (Y is in range <1,31> for outputs, or Y is in <129,159> interval for inputs). Both slave and master nodes implement transmission error detection and correction. In the event of a transmission error, the node that detects the error sends a data packet with a set error flag and an error code as data. This code can be anything from a bad CRC result to an invalid parameter request.
|
|
|
+
|
|
|
+| Node address | Element address | Description |
|
|
|
+| ----------- | ----------- | ---- |
|
|
|
+| 0 | 0 | Broadcast to all nodes and elements.|
|
|
|
+| 0 | Y | Broadcast to specific elements |
|
|
|
+| X | 0 | Unicast to node, single node broadcast |
|
|
|
+| X | Y | Unicast to node element |
|
|
|
+
|
|
|
+## Supported functions
|
|
|
+In following table, the allowed values of 4rd byte (Function) is shown.
|
|
|
+
|
|
|
+|***F*** | err | NP | ~R/W | CODE ||||| Function<br/>code | Function<br/>name|Read<br/>operation|Write<br/>operation|
|
|
|
+| -- | -- | -- | -- | -- | -- | -- | -- | -- |--|--|--|--|
|
|
|
+| bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | | | | |
|
|
|
+| --- | --- | --- | --- | --- | --- | --- | --- | --- |---|---|---| --- |
|
|
|
+| | | x | | 0 | 0 | 0 | 0 | 1 | x1 |ECHO |✓|-|
|
|
|
+| | | x| | 0 | 0 | 0 | 1 | 0 | x2 |STOP | -|✓|
|
|
|
+| | | x| | 0 | 0 | 0 | 1 | 1 | x3 |START | -|✓|
|
|
|
+| | | x| | 0 | 0 | 1 | 0 | 0 | x4 |PARAM | ✓|✓|
|
|
|
+| | | x| | 0 | 0 | 1 | 0 | 1 | x5 |SENSOR_CNT | ✓|-|
|
|
|
+| | | x| | 0 | 0 | 1 | 1 | 0 | x6 |SLEEP | ✓|✓|
|
|
|
+| | | x| | 0 | 0 | 1 | 1 | 1 | x7 |WAKEUP | ✓|✓|
|
|
|
+| | | x| | 0 | 1 | 0 | 0 | 0 | x8 |CALIBRATE |-|✓|
|
|
|
+| | | x| | 0 | 1 | 0 | 0 | 1 | x9 |RESET | -|✓|
|
|
|
+| | | x| | 0 | 1 | 0 | 1 | 0 | xA |STORE | -|✓|
|
|
|
+| | | x| | 0 | 1 | 0 | 1 | 1 | xB |DATA | ✓|✓|
|
|
|
+| | | x| | 0 | 1 | 1 | 0 | 0 | xC |SYNC | -|✓|
|
|
|
+| | | x| | 0 | 1 | 1 | 0 | 1 | xD |SENSOR_TYPE | ✓|-|
|
|
|
+| | | x| | 0 | 1 | 1 | 1 | 0 | xE |INFO | ✓|-|
|
|
|
+| | | x| | 0 | 1 | 1 | 1 | 1 | xF |... | ..|..|
|
|
|
+
|
|
|
+
|
|
|
+### command INFO
|
|
|
+Allowed parameters. These data are hardcoded in specific apllication.
|
|
|
+
|
|
|
+|name|description|length|example|
|
|
|
+|--|--|--|--|
|
|
|
+|NAME|name of module|8 | |
|
|
|
+|TYPE|type of module|3? | IMU,FSR,GNS|
|
|
|
+|UUID|unique ID - generated by MCU|4B |0x12345678|
|
|
|
+|HW|Hardware version|2 | 25 (meaning: 2.5)|
|
|
|
+|SW|Software version|2 | 01 (meaning: 0.1)|
|
|
|
+
|
|
|
+### Command PARAM
|
|
|
+Sensors parameters. These data are stored in EEPROM. They can be modified.
|
|
|
+
|
|
|
+|name|description|length|example|
|
|
|
+|--|--|--|--|
|
|
|
+|SAMPLERATE|sample rate in Hz|2 | 250 (meaning: 250 Hz)|
|
|
|
+|LOW_PASS_FILTER|low pass filter (if it is supported)| 1-2 | |
|
|
|
+|FULL_SCALE|data range|1 |int8_t range |
|