KNX TinySerial 810. Communication Protocol. WEINZIERL ENGINEERING GmbH

Similar documents
CIS-331 Fall 2013 Exam 1 Name: Total of 120 Points Version 1

CIS-331 Fall 2014 Exam 1 Name: Total of 109 Points Version 1

CIS-331 Spring 2016 Exam 1 Name: Total of 109 Points Version 1

CIS-331 Exam 2 Fall 2015 Total of 105 Points Version 1

4. Specifications and Additional Information

C1098 JPEG Module User Manual

CIS-331 Exam 2 Fall 2014 Total of 105 Points. Version 1

CIS-331 Exam 2 Spring 2016 Total of 110 Points Version 1

Gateway Ascii Command Protocol

CIS-331 Final Exam Spring 2015 Total of 115 Points. Version 1

CIS-331 Final Exam Spring 2018 Total of 120 Points. Version 1

The cache is 4-way set associative, with 4-byte blocks, and 16 total lines

UNH-IOL MIPI Alliance Test Program

Communications guide. Line Distance Protection System * F1* GE Digital Energy. Title page

RS 232 PINOUTS. 1. We use RJ12 for all of our RS232 interfaces (Link-2-Modbus & Link-2-PC- Serial/RS232). The diagram below shows our pin out.

ECHO Process Instrumentation, Inc. Modbus RS485 Module. Operating Instructions. Version 1.0 June 2010

6. Specifications & Additional Information

Digital Lighting Systems, Inc.

Digital Lighting Systems, Inc. CD400-DMX DMX512 Four Channel Dimmer and Switch module

July Registration of a Cyrillic Character Set. Status of this Memo

Technical Specification. Third Party Control Protocol. AV Revolution

CIS-331 Final Exam Spring 2016 Total of 120 Points. Version 1

460 Presentation Audio Mixer

CMSC 313 Lecture 03 Multiple-byte data big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes

kdrive cross-platform component library for KNX overview and architecture WEINZIERL ENGINEERING GmbH Achatz 3 DE Burgkirchen / Alz

Triple DES and AES 192/256 Implementation Notes

Acquirer JCB EMV Test Card Set

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012

APPLESHARE PC UPDATE INTERNATIONAL SUPPORT IN APPLESHARE PC

First Data Dual Interface EMV Test Card Set. Version 1.20

CIS-331 Final Exam Fall 2015 Total of 120 Points. Version 1

First Data EMV Test Card Set. Version 1.30

DBK24. Isolated Digital Output Chassis. Overview

First Data EMV Test Card Set. Version 2.00

CDR File Information. Comments Direct PCM

DNP3 Communication User's manual

ZN-DN312XE-M Quick User Guide

One subset of FEAL, called FEAL-NX, is N round FEAL using a 128-bit key without key parity.

kdrive User Guide

Digital Lighting Systems, Inc.

First Data DCC Test Card Set. Version 1.30

LynX-10 Legacy Protocol Specification Version 1.01

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

Acquirer JCB Dual Interface EMV Test Card Set

Fundamentals of Cryptography

CSE Computer Architecture I Fall 2011 Homework 07 Memory Hierarchies Assigned: November 8, 2011, Due: November 22, 2011, Total Points: 100

CMOS TYPE CAMERA JC406M-W01

CS 537: Introduction to Operating Systems Fall 2015: Midterm Exam #1

Hash Constant C Determinants leading to collisionfree

USB-ASC232. ASCII RS-232 Controlled USB Keyboard and Mouse Cable. User Manual

ETSI TS V ( )

Digital Projector X30N/X35N

Digital Lighting Systems, Inc. PD405-DMX. Four Channel Dimmer and Switch Packs. DMX512 compatible. PD405-DMX-24DC DMX512 4 x 5 Amps Dimmer Pack

Modbus Module. Data sheet. Communication module for MULTICAL 403 and MULTICAL 603

KNX BAOS ObjectServer

TLS 1.2 Protocol Execution Transcript

Interac USA Interoperability EMV Test Card Set

Tutorial & Demo! image and audio transmission on wireless sensor networks!

Modbus Module. Data sheet. Communication module for MULTICAL 403 and MULTICAL 603

Developer Notes INSTEON Thermostat v012. Developer Notes. INSTEON Thermostat. Revision History

ASCII Code - The extended ASCII table

No Trade Secrets. Microsoft does not claim any trade secret rights in this documentation.

Here is a C function that will print a selected block of bytes from such a memory block, using an array-based view of the necessary logic:

VM7000A PAPERLESS RECORDER COMMUNICATION FUNCTION OPERATION MANUAL

B: Modbus Map and Retrieving Logs

VM7000A PAPERLESS RECORDER COMMUNICATION FUNCTION OPERATION MANUAL

Secret Key Systems (block encoding) Encrypting a small block of text (say 64 bits) General considerations for cipher design:

ENGI 8868/9877 Computer and Communications Security III. BLOCK CIPHERS. Symmetric Key Cryptography. insecure channel

YHY502CTG++ DATASHEET MHz RFID Mifare Read/Write Module. YHY502CTG++ Datasheet Revision 2.0 Oct, 2009 Page 1 of 21

10. RS-232C communication

OOstaExcel.ir. J. Abbasi Syooki. HTML Number. Device Control 1 (oft. XON) Device Control 3 (oft. Negative Acknowledgement

ID: Cookbook: urldownload.jbs Time: 23:23:00 Date: 11/01/2018 Version:

Modbus Register Map: InRow ACRD60x / ACRC60x

KRAMER ELECTRONICS LTD. USER MANUAL MODEL: VA-8xl 8-Channel Balanced Stereo Audio Amplifier. P/N: Rev 1

Register Map: Ecoflair Indirect Air Economizer

HDV100A3 Command Response Protocol

Systems/DBG Debugger Version 2.20

6.1 Font Types. Font Types

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, SPRING 2013

Micro Module Shutter. Micro Module Shutter

CSE Computer Architecture I Fall 2009 Homework 08 Pipelined Processors and Multi-core Programming Assigned: Due: Problem 1: (10 points)

TEST DVD-VIDEO/ DVD-ROM For Checking DVD Players, DVD Recorders and DVD Drives TDH-940

PCL ISO 8859/5 Latin/Cyrillic

Enhanced Play Fair Cipher

FieldServer Driver FS Heatcraft-Smart Controller II

SwitchLinc 2-Wire Dimmer (RF Only) (2474DWH - Dev 0x01 / Sub 0x24)

EDITION : 02/01/07 DN

[MS-FSSHTTPD]: Binary Data Format for File Synchronization via SOAP. Intellectual Property Rights Notice for Open Specifications Documentation

Serial Communication Control Interface User s Manual

CSCI 454/554 Computer and Network Security. Topic 3.1 Secret Key Cryptography Algorithms

! ' ,-. +) +))+, /+*, 2 01/)*,, 01/)*, + 01/+*, ) 054 +) +++++))+, ) 05,-. /,*+), 01/-*+) + 01/.*+)

SPAREPARTSCATALOG: CONNECTORS SPARE CONNECTORS KTM ART.-NR.: 3CM EN

M-BUS Standard acc. EN AE.05:04.01: Protocol Specification

Problem 3. (12 points):

AIT 682: Network and Systems Security

Scan Results - ( Essentials - Onsharp )

INNOVATIVE TECHNOLOGY LTD CC2. Communications Protocol Manual GA863. Issue version Page 1 of 108

ID: Cookbook: browseurl.jbs Time: 19:37:50 Date: 11/05/2018 Version:

Course Contents. The TCP/IP protocol Stack

KNX over IP. New Solutions for KNX Installations

Transcription:

WEINZIERL ENGINEERING GmbH KNX TinySerial 810 Communication Protocol WEINZIERL ENGINEERING GmbH Bahnhofstr. 6 DE-84558 Tyrlaching GERMAY Tel. +49 8623 / 987 98-03 Fax +49 8623 / 987 98-09 E-Mail: info@weinzierl.de Web: www.weinzierl.de WEINZIERL ENGINEERING GmbH Page 1/22

Document history Document status Date Editor First draft 2011-10-20 K. Ströber Review K. Ströber, 2011-10-20 F.Häusl Review, Release 2011-10-24 J. Richards Added telegram format and send/receive description 2011-11-18 Th. Weinzierl Added kdrive implementation aspects J. Richards WEINZIERL ENGINEERING GmbH Page 2/22

Content 1. APPLICATION AREA... 4 2. PROTOCOL... 4 2.1. GENERAL... 4 2.2. CONFIGURATION PROCEDURE... 4 2.3. PROPERTY VALUE... 6 2.3.1. NON-SELECTIVE IACK... 6 3. COMMUNICATION PARAMETERS OF THE SERIAL INTERFACE... 7 4. COMMUNICATION MECHANISMS... 7 FORMAT OF THE KNX TELEGRAM... 7 GROUP VALUE WRITE... 9 GROUP VALUE READ... 9 SEND STATE MACHINE... 10 SENDING TO KNX BUS... 10 RECEIVING FROM KNX BUS... 11 CODING OF CONTROL CHARACTERS... 12 5. SOFTWARE SUPPORT... 19 KDRIVE TINYSERIAL IMPLEMENTATION... 19 OPEN... 19 RESET... 19 SET PROPERTIES... 20 RX THREAD... 20 GET CONNECTION STATE... 20 WAIT TELEGRAM... 20 BUILD FRAME... 22 CALCULATE CHECKSUM... 22 WEINZIERL ENGINEERING GmbH Page 3/22

1. Application area The KNX Tiny Serial Interface 810 offers a simple connection to the KNX Bus Twisted Pair including galvanic isolation. The connection is via UART (3-5V). The communication is based on a modified TP-UART Protocol without realtime requirements to the host. The Tiny Serial Interface is ideally suited for connecting KNX Devices running Linux, Windows CE and Android, among others. A Cross Platform SDK is also available to integrate Tiny Serial into your application. 2. Protocol 2.1. General The KNX Tiny Serial, described in this document, is based on the TP- UART Protocol with the following modifications: - Configurable IndividualAddress - Configurable Acknowledge-Handling according to KNX specification This document describes only the modifications to the TP-UART protocol. 2.2. Configuration procedure The configuration procedure begins after the restart of the KNX Tiny Serial. When the KNX Tiny Serial is ready to operate, it sends the service UART_Reset.ind to the host processor. At this point the standard Acknowledge handling is active. Optionally the host processor can send its own "individual address" and switch on the non-selective "Acknowledge-Handling". This mode can be activated only if the "individual address" has previously been successfully set. The current state can be requested by the host processor with service U_ReadProperty.req. WEINZIERL ENGINEERING GmbH Page 4/22

WEINZIERL ENGINEERING GmbH Page 5/22

2.3. Property value Bit# Meaning 7 0 6 0 5 0 4 0 3 0 2 0 1 0 0 0 = non-selective IACK disabled 1 = non-selective IACK enabled Figure 2: Description of Property-bit field 2.3.1. Non-selective IACK - The non-selective-iack flag is inactive after restart. It can be activated by the host processor. - Before activating this flag of the KNX Tiny Serial, it must be ensured that the Individual address has been set. - The host processor can read the current state of this flag.if the flag is set, the KNX Tiny Serial confirms all group telegrams, all broadcast messages and all individually addressed telegrams to its own address. WEINZIERL ENGINEERING GmbH Page 6/22

3. Communication parameters of the serial interface The serial interface to the host controller is used with the following settings: Parameter Value Comments Baud Rate 19200 baud Start-Bits 1 active = low Data-Bits 8 (LSB first) active = low Parity-Bit 1 (even parity) active = low Stop-Bits 1 Idle-Level High 4. Communication mechanisms Format of the KNX telegram The following table shows the coding of KNX standard telegrams for group data: Octet Number Octet Name Bit usage (MSB -> LSB) Octet 0 Control Field frame type std. = 0 0 Repeat flag, rep = 0 1 Priority, low: 11b Priority, low: 11b 0 0 Octet 1 Src. addr high area address area address area address area address line address line address line address line address WEINZIERL ENGINEERING GmbH Page 7/22

Octet 2 Src. addr low device address Octet 3 Dest. addr high group / ind. address Octet 4 Dest. addr low group / ind. address Octet 5 DAF/LSDU/Length DAF, group = 1 Hop count, std = 6d Hop count, std = 6d Hop count, std = 6d Length, Octet 7.. Length, Octet 7.. Length, Octet 7.. Length, Octet 7.. Octet 6 TPCI/APCI TPCI TPCI TPCI TPCI TPCI TPCI APCI APCI Octet 7 APCI/data APCI APCI APCI or data APCI or data APCI or data APCI or data APCI or data APCI or data Octet 8..21 Octet 22 data Check octet ---------------------------------------------------------------- TPCI code for group data: 000000b GroupData APCI codes for group data: 0000b GroupValue_Read 0001b GroupValue_Response 0010b GroupValue_Write If the GroupData is less than or equal to 6 bits it is coupled with the APCI and the data field is empty. The check octet is an bitwise exor over all preceding octets. WEINZIERL ENGINEERING GmbH Page 8/22

Group Value Write Sends a GroupValue_Write telegram on the bus. Group Value Read Sends a GroupValue_Read telegram on the bus and waits for at least one GroupValue_Response telegrams. WEINZIERL ENGINEERING GmbH Page 9/22

Send State Machine The send state machine waits for a L_DATA confirm (LazyConfirm is a kdrive SDK property and should be ignored for the purposes of TinySerial). Sending to KNX bus In sending direction each octet to be sent on the bus is preceded by a control character U_L_Data with the corresponding index. The last octet is the checksum and is preceded by an U_L_DataEnd character with the right index. After the reception of the correct checksum the TinySerial starts to send the telegram on the bus as soon as the bus is free. During the send process each character on the bus is sent to the host. Repetitions will be sent automatically on the bus if required (Busy or NAK or no ACK). WEINZIERL ENGINEERING GmbH Page 10/22

Channel 1: KNX bus signal (AC part) Channel 2: Send signal (host to TinySerial) Channel 3: Receive signal (TinySerial to host) Example (Switch on a light) Host to TinySerial (in hex) 80 BC 81 11 82 01 83 12 84 34 85 E1 86 00 87 81 48 15 On Bus (in hex) BC 11 01 12 34 E1 00 81 15 Source address: 0x1101 (individual) Destination address: 0x1234 (group) Receiving from KNX bus In receiving direction each octet received from the bus is transferred immediately to the host without additional control codes. WEINZIERL ENGINEERING GmbH Page 11/22

Channel 1: KNX bus signal (AC part) Channel 2: Send signal (host to TinySerial) Channel 3: Receive signal (TinySerial to host) Coding of control characters The table below shows all the services that are exchanged between the communication partners. The middle column of the table contains the Control Field. Services from UART UART_Reset.ind 03 UART_State.ind no error 07 00 Services To UART 01 U_Reset.request 02 U_State.request 04 05 06 08 U_Control.req repeater not present 09 U_Control.req repeater present 0A U_Control.req is repeater WEINZIERL ENGINEERING GmbH Page 12/22

L_DATA.conf negative confirm 0B NACK UART_State.ind Services from UART Busmonitor only mode 0C 0D 0E 0F Services To UART L_LONG_DATA.request system, repeated 10 U_AckInformation not addressed 11 U_AckInformation ack 12 U_AckInformation invalid 13 U_AckInformation busy L_LONG_DATA.request high, repeated 14 U_AckInformation invalid 15 U_AckInformation n_ack 16 U_AckInformation invalid UART_State.ind 17 U_AckInformation invalid L_LONG_DATA.request alarm, repeated 18 UART_Properties.ind data 1A U_ReadProperties.req L_LONG_DATA.request normal, repeated 19 1B 1C 1D 1E U_Write.req IndividualAddress Low UART_State.ind 1F U_Write.req IndividualAddress High UART_State.ind 27 Button_Pressed.ind UART_State.ind L_LONG_DATA.request system, not repeated 30 20 21 22 U_Write.req SetProperties(xx) 23 24 25 26 28 29 2A LED_off.req 2B LED_on.req 2C 2D 2E 2F 31 32 WEINZIERL ENGINEERING GmbH Page 13/22

L_LONG_DATA.request high, not repeated 34 UART_State.ind 37 L_LONG_DATA.request alarm, not repeated 38 Services from UART L_LONG_DATA.request normal, not repeated UART_State.ind 33 35 36 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 Services To UART UART_State.ind 47 U_L_DataEnd index 7 48 U_L_DataEnd index 8 49 U_L_DataEnd index 9 4A U_L_DataEnd index 10 4B U_L_DataEnd index 11 4C U_L_DataEnd index 12 4D U_L_DataEnd index 13 4E U_L_DataEnd index 14 UART_State.ind 4F U_L_DataEnd index 15 50 U_L_DataEnd index 16 51 U_L_DataEnd index 17 52 U_L_DataEnd index 18 53 U_L_DataEnd index 19 54 U_L_DataEnd index 20 55 U_L_DataEnd index 21 56 U_L_DataEnd index 22 UART_State.ind 57 U_L_DataEnd index 23 58 U_L_DataEnd index 24 59 U_L_DataEnd index 25 5A U_L_DataEnd index 26 5B U_L_DataEnd index 27 WEINZIERL ENGINEERING GmbH Page 14/22

5C U_L_DataEnd index 28 5D U_L_DataEnd index 29 5E U_L_DataEnd index 30 UART_State.ind 5F U_L_DataEnd index 31 Services from UART 60 U_L_DataEnd index 32 61 U_L_DataEnd index 33 Services To UART 62 U_L_DataEnd index 34 63 U_L_DataEnd index 35 64 U_L_DataEnd index 36 65 U_L_DataEnd index 37 66 U_L_DataEnd index 38 UART_State.ind 67 U_L_DataEnd index 39 68 U_L_DataEnd index 40 69 U_L_DataEnd index 41 6A U_L_DataEnd index 42 6B U_L_DataEnd index 43 6C U_L_DataEnd index 44 6D U_L_DataEnd index 45 6E U_L_DataEnd index 46 UART_State.ind 6F U_L_DataEnd index 47 70 U_L_DataEnd index 48 71 U_L_DataEnd index 49 72 U_L_DataEnd index 50 73 U_L_DataEnd index 51 74 U_L_DataEnd index 52 75 U_L_DataEnd index 53 76 U_L_DataEnd index 54 UART_State.ind 77 U_L_DataEnd index 55 78 U_L_DataEnd index 56 79 U_L_DataEnd index 57 7A U_L_DataEnd index 58 7B U_L_DataEnd index 59 7C U_L_DataEnd index 60 7D U_L_DataEnd index 61 7E U_L_DataEnd index 62 UART_State.ind 7F U_L_DataEnd index 63 80 U_L_Data index 0 81 U_L_Data index 1 82 U_L_Data index 2 83 U_L_Data index 3 84 U_L_Data index 4 WEINZIERL ENGINEERING GmbH Page 15/22

85 U_L_Data index 5 86 U_L_Data index 6 UART_State.ind 87 U_L_Data index 7 Services from UART 88 U_L_Data index 8 89 U_L_Data index 9 8A U_L_Data index 10 Services To UART L_DATA.conf positiv confirm 8B U_L_Data index 11 8C U_L_Data index 12 8D U_L_Data index 13 8E U_L_Data index 14 UART_State.ind 8F U_L_Data index 15 L_DATA.request system, repeated 90 U_L_Data index 16 91 U_L_Data index 17 92 U_L_Data index 18 93 U_L_Data index 19 L_DATA.request high, repeated 94 U_L_Data index 20 95 U_L_Data index 21 96 U_L_Data index 22 UART_State.ind 97 U_L_Data index 23 L_DATA.request alarm, repeated 98 U_L_Data index 24 99 U_L_Data index 25 9A U_L_Data index 26 9B U_L_Data index 27 L_DATA.request normal, repeated 9C U_L_Data index 28 9D U_L_Data index 29 9E U_L_Data index 30 UART_State.ind 9F U_L_Data index 31 A0 U_L_Data index 32 A1 U_L_Data index 33 A2 U_L_Data index 34 A3 U_L_Data index 35 A4 U_L_Data index 36 A5 U_L_Data index 37 A6 U_L_Data index 38 UART_State.ind A7 U_L_Data index 39 A8 U_L_Data index 40 A9 U_L_Data index 41 AA U_L_Data index 42 AB U_L_Data index 43 AC U_L_Data index 44 AD U_L_Data index 45 WEINZIERL ENGINEERING GmbH Page 16/22

AE U_L_Data index 46 UART_State.ind AF U_L_Data index 47 L_DATA.request system, not repeated B0 U_L_Data index 48 Services from UART B1 U_L_Data index 49 B2 U_L_Data index 50 B3 U_L_Data index 51 Services To UART L_DATA.request high, not repeated B4 U_L_Data index 52 B5 U_L_Data index 53 B6 U_L_Data index 54 UART_State.ind B7 U_L_Data index 55 L_DATA.request alarm, not repeated B8 U_L_Data index 56 B9 U_L_Data index 57 BA U_L_Data index 58 BB U_L_Data index 59 L_DATA.request normal, not repeated BC U_L_Data index 60 UART_State.ind BUSY UART_State.ind ACK UART_State.ind Busmonitor only Busmonitor only mode mode BD U_L_Data index 61 BE U_L_Data index 62 BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 WEINZIERL ENGINEERING GmbH Page 17/22

UART_State.ind Services from UART D5 D6 D7 D8 D9 DA DB DC DD DE UART_State.ind SC, RE, PE, TW DF E0 E1 E2 E3 E4 E5 E6 UART_State.ind SC, RE, TE E7 E8 E9 EA EB EC ED EE UART_State.ind SC, RE, TE, TW EF L_POLL_DATA.req system F0 F1 F2 F3 F4 F5 F6 UART_State.ind SC, RE, TE, PE F7 F8 F9 FA FB FC FD Services To UART WEINZIERL ENGINEERING GmbH Page 18/22

FE UART_State.ind SC, RE, TE, PE, TW FF 5. Software support To use the KNX TinySerial Interface together with an operating system like Linux or Windows we recommend the kdriveexpress SDK. It is a crossplatform implementation to access the KNX system via different hardware interfaces. See www.weinzierl.de for more information. kdrive TinySerial Implementation The kdrive TinySerial class is a C++ implementation of the TP-UART protocol described above. It communicates with the TinySerial module and offers an application interface via Common EMI (External Messaging Interface). The following outlines the operation and design of the TinySerialPort class. Open The following functions are performed on open: Open the Serial Port (19200, 8E1, No flow control) Reset the controller (5s timeout) see Reset. If reset is successful, sets the controller properties. See Set Properties. If reset is not successful, throws an Exception (open failed). Starts the receive thread. Reset To reset the TinySerial module we send U_Reset.request and wait for the reset indication U_Reset.ind. If we send the reset request and receive anything other than the reset indication we immediately resend the reset request again. That is, if there is traffic on the bus we continue to hit the TinySerial module with a reset WEINZIERL ENGINEERING GmbH Page 19/22

request until we directly receive a reset indication. In this way we can be somewhat certain that the response is a valid response. If we accept other bytes before we find the response we can t be certain that it is a response or part of a telegram sequence. Set Properties In set properties we simply write the individual address. To do this, we first disable non-selective IACK, then write the individual address, then enable non-selective IACK. Send U_Write.req 0x22 plus data 0x00 (disable IACK) Send U_Write.req 0x1F plus high byte of individual address Send U_Write.req 0x1E plus low byte of individual address Send U_Write.req 0x22 plus data 0x01 (enable IACK) Rx Thread The receive thread waits for telegram frames from the TinySerial module. See Wait Telegram. Once a valid KNX telegram is received it is added to a receive queue (where it is then routed to a packet notification mechanism). The rx thread also implements a receive timeout. If the timeout elapses it sends a connection state request to get the state of the bus, see Get Connection State. Get Connection State To determine the connection state, that is, whether the TP_UART is connected to the KNX bus, we send the U_State.request. If the response is not zero we set the connection state to connected, otherwise disconnected. Wait Telegram Wait telegram waits for a single character from the TinySerial module. If it does not receive a character within the timeout period (500ms) it simply returns. Once it receives a byte it checks to see if it is one of the following: WEINZIERL ENGINEERING GmbH Page 20/22

Reset Indication UART_Reset.ind : set controller properties, see Set Properties Long Data L_LONG_DATA.request There are System, Alarm, High and Normal priorities and repeated or not-repeated which means there are 8 different long data bytes that we have to check. We differentiate between repeated and not-repeated. If it is repeated we receive it but discard it. We still receive it to ensure that our framing (state machine) is correct, that is, once we have received the repeated frame we know that we expect that start of the next frame. To receive a long data frame we use the following algorithm: receive 7 bytes. These are: extended control frame (1 byte), src address (2 bytes), dest (2 bytes) length (1 byte) and apci (1 byte). From these bytes we can determine the expected length of the remainder of the frame by reading the length. We the read length bytes. Once we have these bytes we the read the single checksum byte, build the complete frame, see Build Frame, and calculate the checksum, see Calculate Checksum. If any of the above steps fail, we disregard the frame and return. Data L_DATA.request. Like the long data, there are 8 different types with 4 priorities and repeated/not-repeated combinations. The procedure is the same however the initial encoding format that we expect is as follows: // src address (2 bytes), dest (2 bytes) address type/length (1 byte) and apci (1 byte). Once we receive the 6 bytes we can determine the length of the remaining data. This is determined from the address type / length byte (the lower 4 bits), i.e. addresstypelength & 0x0F. We follow the same procedure as the long frames, receive data (i.e. calculated length), receive checksum byte, build the complete frame see Build Frame, and calculate checksum, see Calculate Checksum. Confirm L_DATA.conf. Indicates we have received a positive confirm from the transmission of a previous telegram. When we send a telegram we wait WEINZIERL ENGINEERING GmbH Page 21/22

for this confirm byte. That is, we use thread synchronization (an event) to wait on the confirm byte in the rx thread. Build Frame To build the complete frame we start with a L_DATA_Ind (0x29). We then add the control byte that we received from the TinySerial in WaitTelegram. This is one of the long data or data bytes, with the priority and repeated states. We then append the header frame (used to get the remaining length) and then the remaining data bytes (length). The checksum is not appended to the frame. Calculate Checksum unsigned char cs = 0xFF; std::vector<unsigned char>::const_iterator iter = frame.begin() + 1; std::vector<unsigned char>::const_iterator end = frame.end(); for (; iter!= end; ++iter) { cs ^= *iter; } cs ^= checksum; return!cs? true : false; WEINZIERL ENGINEERING GmbH Page 22/22