|LX Serial Data Format T5A
Simple packet and protocols easy to use. UART, Bluetooth, WiFi, Ethernet, etc.
- Extremely simple packet and easy to use.
- Multi channel real time stream transmission.
- High precision ( 32bit ) stream available.
- Support both Stream Mode and Non-Stream Mode.
- LXSDF T5A can be used with embedded UART(RS-232), Bluetooth, WiFi, Ethernet, etc.
- COM port auto search. ( Automatic detecting the device to communicate.)
LXSDF T5A 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). LXSDF T5A packet is so simple and small packet size. LXSDF T5A can be used in any system using uart, wifi, bluetooth and ethernet etc.
UART(com port, serial port) is the most commonly used serial communication. UART can transmit one byte sequentially, but it rarely happens that sends only one byte of data element needed in Communication in real applied process. For example, when transmitting 12 bit AD converted data, must transmit serial communication 2 bytes dividing 4 bits and 8 bits and unify them into one 12bits data in receiver. If there are various kinds of data to transmit, it is in need of packet concept. LXSDF T5A can handle several bytes as one packet, transmitting and receiving sides use the data by separating according to the standard LXSDF T5A.
Sync Bytes : the key concepts of T5A packet
LXSDF T5A packet uses initial 5 bytes for each packet transmission as “Purpose for Synchronizing Packet”. The first four bytes are allocated the fixed value 255(0xFF in hex), and fixed 254 (0xFE in hex) for fifth byte. Namely, Sync Bytes are designed only in the spots where appear 255, 255, 255, 255 and 254 sequentially in the whole packet byte arrays.
Receiving side should check each byte and extract the “Sync Bytes”, 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 packet Standard..
The following picture indicates that the orange color part in the one packet is assigned “Sync Bytes” and then a series of bytes for one packet.
T5A Packet Definitions
The table shows the definitions of T5A 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||255||SyncByte1 (Synchronization Byte 1)|
|2||255||SyncByte2 (Synchronization Byte 2)|
|3||255||SyncByte3 (Synchronization Byte 3)|
|4||254||SyncByte4 (Synchronization Byte 4)|
|5||0~254||PPD (Packet Property Data). 0~15 : Stream Mode, 16~254 : Non-Stream Mode.|
|6||0~255||PCDT (PCD Type) : Bit 2,1,0.||PBS (Packet Byte Size)|
|7||0~255||PC (Packet Count)||IID (Information ID)|
|8||0~255||PCD0 (Packet Cyclic Data 0)||.|
|9||0~255||PCD1 (Packet Cyclic Data 1)||.|
|11||0~255||PUD0 (Packet Unit Data 0)|
|12||0~255||PUD1 (Packet Unit Data 1)|
|13||0~255||PUD2 (Packet Unit Data 2)|
|14||0~255||PUD3 (Packet Unit Data 3)|
|16||0~255||PSD0 (Packet Stream Data 0) LSByte||.|
|17||0~255||PSD1 (Packet Stream Data 1)||.|
|18||0~255||PSD2 (Packet Stream Data 2)||.|
|19||0~255||PSD3 (Packet Stream Data 3) MSByte||.|
|…||…||Can be repeated above 16~20 index||.|
|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|
|5||PPD : available value 0 ~ 15||PPD : available value 16 ~ 254|
|6||PCDT : Packet Cyclic Data Type.||PBS : Packet Byte Size allocated.|
|7||PC : +1 for each packet.||IID : Information ID allocated.|
|8 ~ 10||PCD0,1,PCD SEP : PCD data is allocated each PC.||general data allocated.|
|11 ~ 15||PUD0,1,2,3, PUD SEP : Packet Unit Data.||general data allocated.|
|16 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 5( 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(PCDT) value. If PCDT is 0, PC maximum is 31.
PCD0~1, PCD SEP (Packet Cyclic Data)
Different values are allocated at each PC (Packet Count).
PUD0~3, PUD SEP (Packet Unit Data)
Allocated data is different for each product. Mainly, information data to transmit at high speed is allocated.
PSD0~3, PSD SEP (Packet Stream Data)
Mainly, multi channel stream data 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 value is always 0 for the first stage(device power ON) and though PCDT 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 time.
|PCDT||PC (Packet Count) Maximum||Data|
|0||31||Exclusive data for LXSDF T5A and general data.|
|1 ~ 7||depends on each product.|
LXSDF T2A PCD Designated Data for 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.
|PCD0,1||Com port search information||PCD0 : fixed value 110. Information for searching device using LXSDF T5A.|
|PCD0,1||LXDeviceID|| Allocated value between 256 and 65535. Unique ID for identifying the device.
PCD0 : Low Byte, PCD1 : High Byte.
|PCD0,1||ComFirmInfo1||PCD0 : Bit 7 ComFirmID, Bit6~0 : ComFirmVersion for processor 1.|
|PCD0,1||Number of channel||PCD0 : number of channel in the element PSD(Packet Stream Data).|
|PCD0,1||Number of samples||PCD0 : number of samples in the element PSD(Packet Stream Data).|
|PCD0,1||ComPath||PCD0 : Communication physical path.|
|PCD0,1||ComFirmInfo2||PCD0 : Bit 7 ComFirmID, Bit6~0 : ComFirmVersion for processor 2.|
|PCD0,1||ComFirmInfo3||PCD0 : Bit 7 ComFirmID, Bit6~0 : ComFirmVersion 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|
|64||USB LX High Speed. ( FTDI D2XX driver or FTDI VCP driver )|
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 T5A Packet Extraction : Catch Sync Bytes (it is placed in order of 255,255,255,255,254) which means packet’s start spot from byte row separates data up and then abstract data elements in the packet from
- LXSDF T5A Take elements : Get all the T5A Packet elements.
- Get device providing data : Data allocation situation depends on each device. Refer to LXSDF T5A Device Specialization Documents of the device.
COM port auto search
This explanations are for the device search in case device like PC. The PC attached device’s com port number assignment is not fixed. If connecting MCU and UART in Embedded System, it doesn’t need automatic search.
In case of device detecting COM port from host, there is case that user choose COM port to communicate in application program. This means bad products design regardless of user’s convenience. It has to be designed that the program search COM port connected with device automatically. This function can not be solved only by software. It has to set the function to search automatically in the device.
COM port searching method
In LXSDF T5A packet, “Com port search information” which is PCD0 and “LXDeviceID” which is PCD0 and PCD1 are used to find proper COM port of the product for information to use device search.
You can find the device’s COM port easily if practicing the procures as the following explanation cycling all the Com port from host in order. Open one COM port temporarily and process the data received like the following table.
|Step 1.||If sync bytes (255, 255, 255, 255, 254) is detected : It’s possible device to communicate. Goto step 2.
If sync bytes is not detected : it’s not LXSDF T5A packet. Start again opening another COM port.
|Step 2.||If PC (Packet Count ) value becomes number 31, it is sure of the device transmitting data to LXSDF T5A Format. However, it could transmit the same format data like LXSDF T5A in some products coincidentally. For occupying safely, if the PCD0 is 110, it is sure that is LXSDF T5A packet.|
|Step 3.||If device is communicated by LXSDF T5A format, the next phase is to search device to communicate. At this time, check PCD0 and PCD1 which is product’s LXDeviceID to communicate.|