Tiny protocol
0.9.3
Tiny communication protocol for microcontrollers
|
This is Tiny protocol implementation for microcontrollers (Arduino, Stellaris).
This protocol is intended to be used in low-memory systems, like microcontrollers (Stellaris, Arduino). It is also can be compiled for desktop Linux systems, and it is possible to build it for Windows.
Library API supports C-Style functions - the basic API, and C++ API, which provides high level easy to use classes. Please refer to documentation. Basically TinyProto library provides 4 different protocol implementations:
Tiny HDLC protocol API functions This is basis, which all other protocols implementations are built on top of. Hdlc api provides basic input/output operations, like FCS, escape sequencies, etc. There is no C++ wrappers for it.
Tiny light protocol API functions This is simple protocol, based on HDLC api. It simplifies sending and receiving messages on small controllers, and at the same time it has low memory consumption (800 bytes of flash). But, be careful since light version doesn't have any confirmation from remote side.
Tiny Half Duplex API functions This is simple implementation with ACK from remote side. It needs a little more memory than light version, but it is good still for small microcontrollers. The disadvantages of hd protocol is: it doesn't use official HDLC frame format, each frame being sent must be confirmed before sending next frame. This can cause slow down in communication.
Tiny Full Duplex API functions This is the heaviest protocol implementation in the library. For atmega controllers it requires 7KiB of flash, and at least 700 bytes to operation with 64-byte length frames. Unlike hd version, fd version of protocol is faster, as it doesn't wait for confirmation before sending next frame (thanks to window, specified in HDLC specs). Fd version of protocol uses official HDLC frame format, and implements U-frames (SABM,UA), S-frames (RR,REJ), I-frames.
HDLC frame format:
8 any len None/8/16/32 8 | 7E | DATA | FCS | 7E |
Full duplex hdlc uses standard hdlc frame format:
8 ADDR CONTROL any len None/8/16/32 8 | 7E | FF | hdlc ctl | USER DATA | FCS | 7E |
Tiny HDLC protocol API functions needs 3 callback functions, defined by a user (you may use any function names you need).
HDLC callbacks:
All higher level protocols (Tiny light protocol API functions, Tiny Half Duplex API functions, Tiny Full Duplex API functions) needs 4 callback functions, defined by a user: read_func_cb() is added. The list of callbacks:
Unlike HDLC implementation, higher level protocols use different approach. They control both TX and RX channels, for example, to transparently send ACK frames, etc. That's why higher level protocols need to read_func_cb to be defined: