Serial-Port – protocols for serial design commands and data

I need (design?) a protocol for communication between a microprocessor-driven data logger and a PC (or similar) via a serial connection. There is no control line, equipment / The only way the PC can know that they are connected is the data they receive. The connection may be broken and re-established at any time. The serial connection is full duplex. (8N1)

The problem is to use What type of data packet, handshake code or similar. The capabilities of the microprocessor are very limited, so the protocol needs to be as simple as possible. But the data logger will have many functions, such as scheduling records, downloading logs, setting sampling rates, etc., these functions It may be active at the same time.

My bloated version will look like this: For data loggers and PCs, the fixed packet size is 16 bytes, with a simple 1-byte checksum, It may be the 0x00 byte at the beginning/end to simplify the identification of the data packet. One byte represents the data type in the data packet (command/setting/log data/real-time feed value, etc.). For synchronization, the only one can be sent by the PC “Hello/reset” packet (for example all zeros), and then return to the device to detect the packet to confirm synchronization.

I appreciate any comments on this method, and welcome any other suggestions as well as general Sexual opinion.

Observation: I think I have to do it myself, because I need to be as lightweight as possible. I will get some bits and pieces from the protocol suggested in the answer, and some others I found… Slip,
PPP and HLDC.

Microcontroller Interconnect Network (MIN) is for this purpose And designed: a tiny 8-bit microcontroller to communicate with other products.

The code is MIT licensed, and there are embedded C and Python implementations:

https: //github.com/min-protocol/min

I need (design?) a data logger and a PC ( Or similar). Without a control line, the only way devices/PCs can know that they are connected is the data they receive. The connection may be broken and re-established at any time. The serial connection is full duplex. (8N1 )

The question is what type of packet, handshake code or similar to use. The capabilities of the microprocessor are very limited, so the protocol needs to be as simple as possible. But the data logger will have many features , Such as scheduling records, downloading logs, setting sampling rates, etc., these functions may be active at the same time.

My bloat The bloated version will look like this: For data loggers and PCs, the fixed data packet size is 16 bytes, with a simple 1-byte checksum, which may be 0x00 bytes at the beginning/end to simplify the data packet Identification, one byte represents the data type in the data packet (command/setting/log data/real-time feed value, etc.). For synchronization, a unique “hello/reset” data packet (such as all zeros) can be sent by the PC, and then returned The device detects the packet to confirm synchronization.

I appreciate any comments on this method, and welcome any other suggestions and general comments.

Observation: I think I I have to do it myself, because I need to be as lightweight as possible. I will get some bits and pieces from the protocol suggested in the answer, and some others I found… Slip,
PPP and HLDC.

The Microcontroller Interconnect Network (MIN) is designed for this purpose: a miniature 8-bit microcontroller communicates with other products.

Code It is MIT licensed, and there are embedded C and Python implementations:

https://github.com/min-protocol/min

Leave a Comment

Your email address will not be published.