From Swift Navigation Wiki
(Redirected from SwiftNav Binary Protocol)
Jump to: navigation, search

The Swift Navigation Binary Protocol (SBP) is a fast, simple, and minimal binary protocol for communicating with Swift devices. It is the native binary protocol used by the Piksi GPS receiver to transmit solutions, observations, status and debugging messages, as well as receive messages from the host operating system, such as differential corrections and the almanac. As such, it is an important piece of interfacing with your Piksi receiver and integrating it with other systems. A detailed datasheet describing the SBP protocol implemented with v0.21 of piksi firmware is available at:

SBP Protocol Specification

Packet Structure

As of Version 1.0, the packet consists of a 6 byte binary header section, a variable-sized payload field, and a 2 byte binary CRC value. SBP uses the CCITT CRC16 (XMODEM implementation) for error detection. It has no error correction and makes no delivery guarantees.

The full packet structure is as follows:

Field Size (Bytes) Purpose
Preamble 1 Denotes the start of frame transmission. For v1.0, always 0x55
Message Type 2 ldentifies the payload contents.
Sender 2 A unique identifier of the sending hardware. For v1.0 on Piksi, set to the 2 least significant bytes of the Piksi serial number.
Length (n) 1 Length in bytes of the Payload field
Payload n Binary data of the message, as identified by Message Type and Length. Usually contains the in-memory binary representation of a C struct (see documentation on individual message types).
CRC 2 Cyclic Redundancy Check of the packet's binary data from the Message Type up to the end of Payload (does not include the Preamble).

Message Definitions and Datasheet

SBP supports 65536 different message types identified by the msg_type field in the header. The specification provides language-agnostic specification for these messages. There are different versions of the specification. V0.53 is compatible with v0.21 of Piksi Firmware.

SBP Client Libraries

We currently support Python and C libraries for SBP, which are available online at Github:

$ git clone

The Python client is available through PyPi.

$ sudo pip install sbp

Full documentation for the libsbp Python implementation is available at:

If we don't support a client in your language of choice, language-agnostic message definitions are also available.

Receiving/transmitting SBP from your host system

Please see the Piksi Integration Tutorial for a step-by-step example of how to integrate Piksi with a host system.

Piksi Integration Tutorial

libsbp provides a portable C implementation of the SBP protocol that you can use to easily add SBP capabilities to your host system, all you need is a working C compiler for your platform.

This library has been designed to be flexible so it can be used with different hardware serial ports or any other kind of IO. All you need to do is provide a function that can read and write one or more bytes from the port where Piksi is connected.

Full documentation for the libsbp C implementation is available at: