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.


T5A Packet

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.

Table. LXSDF T5A Packet Definitions.
 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) LSByte  .
 9  0~255  PCD1 (Packet Cyclic Data 1) MSByte  .
 10  0~253  PCD SEP   reserved.
 11  0~255  PUD0 (Packet Unit Data 0) LSByte
 12  0~255  PUD1 (Packet Unit Data 1)
 13  0~255  PUD2 (Packet Unit Data 2)
 14  0~255  PUD3 (Packet Unit Data 3) MSByte
 15  0~253  PUD SEP  reserved.
 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  .
 20  0~253  PSD SEP  .
 …  …  Can be repeated above 16~20 index  .
 Color  Description
 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 6( 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.

 Table. PCD Designated Data of PCDT 0
 PCD0,1[PC]  Item  Description
 PCD0,1[31]  Com port search information PCD0[31] :  fixed value 110. Information for searching device using LXSDF T5A.
 PCD0,1[30]  LXDeviceID  Allocated value between 256 and 65535. Unique ID for identifying the device.

PCD0[30] : Low Byte, PCD1[30] : High Byte.

 PCD0,1[29]  ComFirmInfo1 PCD0[29] : Bit 7  ComFirmID, Bit6~0 : ComFirmVersion for processor 1.
 PCD0,1[28]  Number of channel PCD0[28] : number of channel in the element PSD(Packet Stream Data).
 PCD0,1[27]  Number of samples PCD0[27] : number of samples in the element PSD(Packet Stream Data).
 PCD0,1[26]  ComPath PCD0[26] :  Communication physical path.
 PCD0,1[25]  ComFirmInfo2 PCD0[25] : Bit 7  ComFirmID, Bit6~0 : ComFirmVersion for processor 2.
 PCD0,1[24]  ComFirmInfo3 PCD0[25] : Bit 7  ComFirmID, Bit6~0 : ComFirmVersion for processor 3.
 PCD0,1[23]  –  – reserved
 PCD0,1[22]  –  – reserved
 PCD0,1[21]  –  – reserved
 PCD0,1[20]  –  – reserved


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
 0  UART
 2  Bluetooth SPP(Serial Peripheral Profile)
 3  Bluetooth Low Energy SPS ( DIALOG )
 4  Bluetooth Low Energy NUS ( NORDIC )
 5  Bluetooth Low Energy HID
 32  USB HID
 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 plus 1.


IID (Information Identification Data)

Identification number is allocated. The purpose of  ID number is identifying the packet contents.


Code Example

Packet detection and save to array PACKET_NS_T5A[100] from serial received non-stream LXSDF T5A.

LXSDF T5A Non Stream example codes.
feature : Parsing and After processing for each PPD value. 

byte_now : One byte per call

uint8_t PACKET_NS_T5A[100]; // array for gathering the received bytes. 

void Proc_NS_T5A(uint8_t byte_data)
  int ppd = Parsing_NS_T5A(byte_data);

  if(ppd == -1) return ; // not completed packet

    case 128:  // response from the opposite for this request 64
            //do something

    case 64:  // request 64 from the opposite, should response 128
            //do something

    case 34: // request 34 from the opposite, shoulde response 48
            //do something

    case 32: // request 32 from the opposite. no need to response tx.
            //do something


byte_now : One byte per call

-1 : when packet not complete
PPD : when packet completed
int Parsing_NS_T5A(uint8_t byte_now)

  static uint8_t byte_prev8[8]    = {0};   // for accumulateing the byte_now
  static uint8_t sync_after       = 0;	// marking 1 when T5A SyncBytes detected
  static uint32_t PacketIndex_T5A = 0;  // LXSDF T5A Packet Index

  /// fast shifting the byte_prev8 and then put the byte_now.
  memmove(byte_prev8+1, byte_prev8,7); //byte_prev8 array shift  i.e byte_prev8[7] = byte_prev8[6];, [6] = [5], ... [1] = [0]
  byte_prev8[0] = byte_now; //

  ///Check T5A SyncBytes
  if((byte_prev8[7] == 0xFF) && (byte_prev8[6] == 0xFF) && (byte_prev8[5] == 0xFF) && (byte_prev8[4] == 0xFF) && (byte_prev8[3] == 0xFE)   )  // SyncBytes Detected
      sync_after = 1; // mark SyncBytes detected.

      PacketIndex_T5A = 6;

      PACKET_NS_T5A[5] =  byte_prev8[2]; // PPD
      PACKET_NS_T5A[6] =  byte_prev8[1]; // PBS

  if(sync_after == 0) return -1; // not detected SyncBytes.

  PacketIndex_T5A ++;

  //in this point  PacketIndex_T5A is 7

  PACKET_NS_T5A[PacketIndex_T5A] = byte_now;

  ///Check One Packet Completed . when (PacketIndex_T5A+1) is equal to PBS(PACKET_NS_T5A[6]) 
  if((PacketIndex_T5A+1) == PACKET_NS_T5A[6])
      sync_after = 0 ; // init sync_after.

      return PACKET_NS_T5A[5]; // return PPD

  return -1 ;


Programming Guide


The following picture shows the whole program structure of host side.

First of all, open com port in host. After that,

  1. COM Read Bytes : Read bytes received from com port(UART) in order.
  2. 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
  3. LXSDF T5A Take elements : Get all the T5A Packet elements.
  4. 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[31] and  “LXDeviceID” which is  PCD0[30] and PCD1[30] 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.

 Flow Chart  Steps.  Description
 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[31] 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[30] and PCD1[30] which is product’s LXDeviceID to communicate.



LXSDF T5A Document.

 LXE8. LXSDF T5A Communicaton Standard download or view online.

Suggest Edit