I need (to design?) A protocol for communication between a microprocessor data logger and a PC (or similar) via a serial connection. There will be no control lines, the only way the device / PC can know if they are connected from the data they receive. The connection can be broken and restored at any time. The serial connection is full duplex. (8n1)
The problem is which types of packages to use, handshake codes or similar. The microprocessor is extremely limited in capabilities, so the protocol should be as simple as possible. But the data logger will have a number of functions, such as scheduling logging, loading logs, setting the sampling rate, etc., which can be active at the same time.
My bloated version will look like this: for a data logger and for a PC, a fixed packet size is 16 bytes with a simple verification amount of 1 byte, possibly 0x00 bytes at the beginning / end to simplify packet recognition and one byte indicating the type of data in the packet (command / parameters / log data / real-time values, etc.). For synchronization, a unique "hello / reset" package (total zero) can be sent to the PC, which, after detection by the device, is returned to confirm synchronization.
I would appreciate any comments on this approach and welcome any other suggestions, as well as general comments.
Observations: I think I will have to fold myself, since I need it to be as light as possible. I will take pieces from the protocols suggested in the answers, as well as some others that I found ... Slip , PPP and HLDC .
Jodes source share