diff --git a/README.md b/README.md index 4d9e4cd84a06eaff8921117c56c4bb7b8181864c..85ca02cdf5d326661fb921a6dff0bc7ca2730e82 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,49 @@ When `data_t` is copied, it checkes if the pointer to the measurements array is If both applies, it also copies the data from the array pointer to the kernel space. ### GPIO interface + +#### Physical Layer +The protocol implements unidirectional serial communication over GPIO with the following characteristics: +- Transmission rate: 9600 baud (104.17 microseconds per bit) +- Signal levels: + - Logical 0: GPIO Low + - Logical 1: GPIO High +- Pin configuration: GPIO 575 as output + +#### Bit Transmission +Bit transmission follows the UART-8N1 compatible format: +1. Start bit: Logical 0 (Low) +2. 8 data bits in LSB-first order +3. Stop bit: Logical 1 (High) +4. No parity checking +5. No flow control + +#### Packet Structure +A complete data `packet_t` consists of a header, variable measurement payload, and a CRC32 checksum field: + +#### Header (3 Bytes) +1. Magic Number (1 byte) + - Fixed value: 0xAA + - Used for packet detection and synchronization +2. Sender ID (1 byte) + - Identifies the sender +3. Measurement Count (1 byte) + - Number of subsequent measurements + - Maximum value: 16 (MAX_MEASUREMENTS) + +#### Measurement Payload (10 bytes per measurement) +For each `measurement_t`, the following fields are transmitted: +1. Measurement Data (8 bytes) + - 64-bit measurement value + - The data is packed as a c-style union +2. Measurement Type (1 byte) + - Data type of the measurement + - The following data types are available for a measurement: INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, FLOAT32, FLOAT64 + +3. Measurement ID (1 byte) + - Unique identifier for the measurement + +#### Trailer (4 bytes) +- CRC32 checksum +- Calculated over all preceding packet fields +- Uses the Linux standard CRC32 algorithm