|LX Serial Data Format T2A
Simple packet and protocols easy to use. UART, Bluetooth, WiFi, Ethernet, etc.
LXSDF T2A is a general purpose serial communication standard which is able to transmit real-time multi channel stream data and non-stream data. A typical example of multi channel stream is the time series data converted by the multi channel ADC(Analog to Digital Converter). T2A packet is so simple and small packet size. T2A can be used in any system using uart, wifi, bluetooth and ethernet etc.
- Extremely simple packet and easy to use.
- Multi channel real time stream transmission.
- Support both Stream Mode and Non-Stream Mode.
- LXSDF T2A can be used with embedded UART(RS-232), Bluetooth, WiFi, Ethernet, etic.
Sync Bytes : the core concepts of T2A packet
LXSDF T2A packet uses initial 2 bytes for each packet transmission as “Purpose for Synchronizing Packet”. The first byte is allocated the fixed value 255(0xFF in hex), and fixed 254 (0xFE in hex) for second byte. Namely, Sync Bytes are designed only in the spots where appear 255 and 254 sequentially in the whole packet byte arrays.
When transmitting the data, it always transmits the data abiding by Standard. Receiving side monitors each byte and detects Sync Byte, so it can find the starting spot of 1 packet. Once finding the starting spot, it is able to extract the data needed in the program under the TX packet Standard.
The following picture indicates that the orange color part in the first 1 packet is assigned “Sync. Bytes” and then a series of bytes for one packet.
T2A Packet Definitions
The table shows the definitions of T2A packet. Each index is one byte and transmitted in order when transmitting serial. An available value for each packet index, the terms of the packet elements.
|Index||Value||Packet Element Name for Stream Mode.||Packet Element Name for Non-Stream Mode.|
|0||255||SyncByte0 (Synchronization Byte 0)|
|1||254||SyncByte1 (Synchronization Byte 1)|
|2||0~254||PPD (Packet Property Data). 0~15 : Stream Mode, 16~254 : Non-Stream Mode.|
|3||0~254||PUD0 (Packet Unit Data 0)||PBS (Packet Byte Size)|
|4||0~255||PC (Packet Count)||IID (Information ID)|
|5||0~253||PUD 1 (Packet Unit Data 1)||.|
|6||0~255||PCD (Packet Cyclic Data)||.|
|7||0~253||CRD (Command Response Data). bit 6
PUD2 (Packet Unit Data 2). bit 5,4,3
PCDT (Packet Cyclic Data Type). bit 2,1,0
|8||0~253||PSD1 (Packet Stream Data High Byte)||.|
|9||0~255||PSD0 (Packet Stream Data Low Byte)||.|
|10||0~253||PSD1 (Packet Stream Data High Byte)||.|
|11||0~255||PSD0 (Packet Stream Data Low Byte)||.|
|N-1||0~253||PSD1 (Packet Stream Data High Byte)||.|
|N||0~255||PSD0 (Packet Stream Data Low Byte)||.|
|Common packet elements for both Stream Mode and Non-Stream Mode|
|Data placement for multi channel stream data. Freely expandable to any number of channels. The typical example of the multi channel stream data is the continuous output of a multi channel ADC(Analog to Digital Converter).|
Difference between Stream & Non-Stream Mode
|Packet Index||Stream Mode||Non-Stream Mode|
|2||PPD : available value 0 ~ 15||PPD : available value 16 ~ 254|
|3||PUD0 : general data allocated.||PBS : Packet Byte Size allocated.|
|4||PC : +1 for each packet.||IID : Information ID allocated.|
|6||PCD : PCD data is allocated each PC.||general data allocated.|
|7||PCDT : means PCD type.||general data allocated.|
|8 and over||PSD : real time stream data allocated.||general data allocated.|
Packet Byte Size
- Stream Mode : Predefined fixed value. ex. 16, 32, …, etc depends on applications. .
- Non-Stream Mode : Determined by packet index 3( PBS ) per each packet
Packet for Stream Mode
PPD (Packet Property Data)
Available 0 ~ 15 for Stream Mode.
PC (Packet Count)
+1 for every one packet transmission and start 0 again after the maximum value.
By using PC, it is necessarily used to identify the data transmitted to PCD every packet.
The maximum of PC value gets different value according to PCD Type value. If PCDT is 0, PC maximum is 31.
CRD (Command Response Data)
If the device receives the command from the other device, CRD value is reversed.
Usage – If CRD value is 1 before transmitting the order from host and the value is the same after transmitting,
the order transmission is failed. If CRD value is changed, it means the device receives the order from host
PUD 0, PUD 1, PUD 2 (Packet Unit Data)
Allocated data is different for each product. Mainly, information data to transmit at high speed is allocated.
PCDT (Packet Cyclic Data Type)
PC maximum depends on this value and data transmitted to packet cyclic data depends on PCDT value.
PCDT is always 0 for the first stage and though PCD mode value is changed into different value like
1,2,3.. on the situation, it is changed into 0 automatically by completing data transmission of the mode one
|PCDT||PC (Packet Count) Maximum||Data|
|0||31||Exclusive data for LXSDF T2A and general data.|
|1||depends on each product.|
|2||depends on each product.|
|3||depends on each product.|
|4||depends on each product.|
|5||depends on each product.|
|6||depends on each product.|
|7||depends on each product.|
LXSDF T2A Designated Data for PCD of PCDT 0.
The section from PC 0 to 19 is for transmitting product’s specialized data and the section from PC 20 to PC 31 is for system designated data. The system exclusive data is explained as below table.
|PCD||Com port search information||fixed value 109. Information for searching device using LXSDF T2A.|
|PCD||LXDeviceID||Allocated value between 1 and 255. Unique ID for identifying the device.|
|PCD||ComFirmInfo1||Firmware ID and version for processor 1.|
|PCD||Number of channel||Number of channel from stream area of packet.|
|PCD||Number of samples||Number of samples from stream area of packet.|
|PCD||ComPath||Communication physical path.|
|PCD||ComFirmInfo2||Firmware ID and version for processor 2.|
|PCD||ComFirmInfo3||Firmware ID and version for processor 3.|
ComPath is used for mark to show what physical path to transmit data. It is possible to transmit more than two communication path in one device. The host received the data refers to Compath value to check the communication path.
|ComPath Value||Communication Path|
|2||Bluetooth SPP(Serial Peripheral Profile)|
|3||Bluetooth Low Energy SPS|
Packet for Non-Stream Mode
PPD (Packet Property Data)
Available 16 ~ 254 for Non-Stream Mode.
Predefined PPD values : 32, 34, 48, 64, 128 for designated communication types.
- 32 : Data send without request result.
- 34 : Data send with request result.
- 48 : Send result in response to PPD=34
- 64 : Request data.
- 128 : Send data in response to PPD=64.
PBS (Packet Byte Size)
Packet byte size is allocated. Packet bytes size is equal to the packet index maximum – 1.
IID (Information Identification Data)
Identification number is allocated. The purpose of ID number is identifying the packet contents.
The following picture shows the whole program structure of host side.
First of all, open com port in host. After that,
- COM Read Bytes : Read bytes received from com port(UART) in order.
- LXSDF T2A Packet Extraction : Catch Sync Bytes (it is placed in order of 255,254) which means packet’s start spot from byte row separates data up and then abstract data elements in the packet from
- LXSDF T2A Take elements : Get all the T2A Packet elements.
- Get device providing data : Data allocation situation depends on each device. Refer to LXSDF T2A Device Specialization Documents of the device.