From a612a48fe2d2c8185c8ec482cf3af8c5c3a74627 Mon Sep 17 00:00:00 2001 From: "david.maul" <david.maul@informatik.hs-fulda.de> Date: Fri, 14 Feb 2025 16:34:30 +0100 Subject: [PATCH] docs: add documentation for gpio protocol --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/README.md b/README.md index 4d9e4cd..85ca02c 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 -- GitLab