Skip to content
Joe Moran edited this page Dec 18, 2018 · 7 revisions

This page describes the different layers of the protocol stack from top to bottom.

Operations

The PDM and Pod use a request-response protocol, where the PDM sends a message containing commands to the Pod, and the Pod sends a message back containing a response. One high-level operation (e.g. pairing, status, bolus) may use a single request/response or multiple request/response pairs. Examples of the messages that make up a high-level operation are at Message sequences.

Command / Response

A single command or response inside a message is called a "sub-message" or "sub-command".

Each sub-message has the form:

  • 1 byte mtype. The type of the sub-message.
  • 1 byte mlen. Length of the sub-message except for mtype=$1D which is the only command/response without a length.
  • mlen bytes: Body of the sub-message.

The meaning of the sub-message depends on the mtype. For details, see Message Types.

Message Level

One or more sub-messages are packaged into a message, which is exchanged between the two devices.

A message consists of:

  • 4 byte address. This is usually the same as the hardware-level connection ID, but can be different during startup.
  • 1 byte "B9": A0CCCCLL, where C bits are a 4-bit message sequence counter, LL are the top 2 bits of message length, and the A bit which sets a 4 minute alarm in which the pod must receive a command other than $E in or else the pod will fail with a $33 fault.
  • 1 byte BLEN: The LL bits from the B9 byte along with BLEN form a 10-bit message length
  • length bytes: One or more sub-messages, concatenated together.
  • 2 byte CRC-16. This covers the 6 header bytes and length message bytes, the whole message except the CRC-16.

Note that you can determine if a message contains more than one sub-command by comparing the message length with the command length. In practice, mtype=$1A is the only command that is followed by a sub-command within a single message.

Packet level

A message is broken into 31-byte chunks and transmitted as packets.

A packet consists of 32 bytes:

  • 1 byte type/seq: TTTSSSSS. TTT is packet type and SSSSS is a sequence number.
  • 31 bytes of data.

The type is POD (111) for a packet from the Pod, PDM (101) for a packet from the PDM, CON (100) for a continuation packet, and ACK (010) for an acknowledgement packet.

The type and sequence numbers are used by the receiver to re-assemble data chunks into a message (example) even if packets are lost and need to be retransmitted.

ACK or Response with a packet from the other device (acts also as an implicit ACK) should be done in 30 milliseconds.

The packet and message layers roughly correspond to the transport and network layers in the OSI model.

Hardware

The chip hardware sends packets at the link layer over RF:

In the OSI model, this is the data link layer, transmitting frames.

The RF transmission

The physical RF layer is described at RF Modulation.

Clone this wiki locally