Home $5K RTOS Bundle Technical Support The Blunk Difference Contact Us


Serial Packet Protocol Stack

Blunk Microsystems’ TargetSPP is a packet-oriented protocol for transferring data over point-to-point connections. Borrowing algorithms from LAPB and TCP, it provides automatic flow control and data reliability.


  • A full selective repeat ARQ (Automatic Repeat Request) protocol implementation.

  • Easy-to-use API for configuring, making, collecting statistics on, and closing connections, waiting for all-acknowledged condition, and sending and receiving data frames whose size ranges from zero to the compile-time configured maximum frame size.

  • Sliding window acknowledgments (like TCP and LAPB), so packet flow continues while acknowledgments for earlier sent packets are pending. The window size is set at compile-time to 1, 2, 4, or 8 packets.

  • Ensures reliable data transfer via positive acknowledgement of received packets and automatic resends - after timer expiration - of unacknowledged frames.

  • Gaps in the received frame number sequence are reported automatically, triggering immediate resends, providing fast recovery from dropped packets, without waiting for expiration of the resend timer.

  • The resend timer and delayed acknowledgment timer values are updated automatically using Karn's algorithm, like TCP.

  • The space for new receive packets (receive window size) is reported with every acknowledgment and is used for flow control. If an application stops reading data, its receive window can close. For quick data flow resumption, 1) if it has unsent data, the sender sends periodic probes to learn when the window has re-opened and 2) the receiver sends automatic window advertisements when its receive window opens.

  • Negative acknowledgment (NAK) frames report if a received packet has errors, triggering a fast resend before timer expiration. This is critical for fast recovery if there is only one data frame to send, meaning automatic gap reporting will not be triggered.

  • Configuration parameters include initial values for the resend and delayed acknowledgment timeouts, receive window size, and whether SYN frames (for creating a new connection) are actively transmitted or merely listened for. These parameters are set independently for each end of a connection.

  • TargetSPP uses a connection number in its headers to support detection and rejection of spurious packets from old connections.

  • Supports UDP and UART connections. Includes a SLIP-like framing and CRC layer for UART connections, with a simple driver interface, and a Sockets API layer for UDP connections.

  • Statistics are maintained on number of connections/reconnections, frames sent, resent, received, etc. These values may be read and/or printed to stdout with sppStats().

  • A compile-time option promotes all errors to fatal errors that call exit(). This helps catch simple programming errors at beginning of development that can otherwise waste time.

  • The following events are optionally reported via a user-supplied callback function: connection occurred, disconnect occurred, all sent data has been acknowledged, and data frame arrived.

  • Includes protocol decoder. If enabled at compile-time, a summary of every frame (SYN, ACK, NAK, I-Frame, or RST) transmitted or received is either printed to stdout as the protocol stack runs or logged for later print out.

  • Optional application data decoding during SPP protocol decoding. If provided, a user-supplied callback function is invoked for each data packet, with a pointer to the application data start.

  • Currently, the maximum flow control window is eight packets, the packet sequence number modulus is 32, and the connection number modulus is 8. Custom TargetSPP configurations are available from Blunk Microsystems.

  • Source code is 100% ANSI C and has been tested using GNU GCC and PC-lint.

  • Developed using TargetOS™, Blunk Microsystems’ full-featured royalty-free real time operating system. Easily ported to other operating systems or used in non-RTOS polling mode.

  • Royalty-free. Includes complete source code, a sample application, sample UDP and UART drivers, user’s manual, and one year of technical support. Electronic delivery via FTP account.