-
Notifications
You must be signed in to change notification settings - Fork 46
Message Structure
Messages are assembled from one or more packets. Here's an example of a series of packets that make up a temp basal being issued.
First packet from PDM to POD: 1f07b1eeb91f07b1ee30201a0ebee0a2d001007d01384000020002160e40000015051be550
is decoded as ID1:1f07b1ee PTYPE:PDM SEQ:25 Contents:1f07b1ee30321a0ebee0a2d001007d01384000020002160e40000015051be5 CRC:50
Then the POD acks with: 1f07b1ee5a1f07b1ee30
Second packet from PDM to POD is a CON packet 1f07b1ee9b6d0015051be56d8137f3
, which is decoded as ID1:1f07b1ee PTYPE:CON SEQ:27 CON:6d0015051be56d8137 CRC:f3
The assembled message from these two packets is thus 1f07b1ee30201a0ebee0a2d001007d01384000020002160e40000015051be56d0015051be56d8137
.
Let's break the above message down into parts:
IIIIIIII B9 BL <------------------------ Message Body -------------------------> CRC16
1f07b1ee 30 20 1a0ebee0a2d001007d01384000020002 160e40000015051be56d0015051be56d 8137
-
IIIIIIII
(Pod ID) (4 bytes):1f07b1ee
. This 32-bit ID is assigned by the PDM at startup and is then used throughout the active life of the Pod for all its subsequence communication with the PDM. This ID is programmed into both the S08 MCU on both the Pod and the PDM as a packet selector. -
B9
(1 byte):30
. Bit format: A0CCCCLL.- Bit
A
(0
) if 1 sets a 4 minute alarm in which the pod must receive a non $E command in or else the pod will fail with a $33 fault. - Bits
CCCC
(1100
) are a 4-bit message sequence # counter B9-CCCC-counter. - Bits
LL
(00
) are the top 2 bits of the 10-bit message body length.
- Bit
-
BL
(BLEN) (1 byte): (20
= 32) the 2-Bit LL value and the 8-bit BLEN value specify the total 10-bit length of the message body. - Message Body (variable, up to 1023 bytes total):
1a0ebee0a2d001007d01384000020002 160e40000015051be56d0015051be56d
. The message body consists of one or more sub-commands message or a single response message. In this example, there is actually a second16
sub-command. Each sub-command message or response has the following basic format.- The first byte (
1a
for the 1st sub-command and16
for the 2nd sub-command) indicates the type of the sub-message - The second byte (
0e
for both sub-commands in this example) is the length of the encoded sub-command (except for the1d
response)
- The first byte (
- CRC16 (2 bytes):
8137
. This is a pseudo CRC16
The length of the message type + body above is 0x20 bytes, matching the BLEN value.
Message sequence number is usually incremented by PDM and POD. But there are some cases where it is not. For example when nonce fake resync (# is the message sequence):
PDM 1a(14)->Insulin Schedule:Nonce:851072aa(-1) Type:02 Bolus CheckSum:0088/0088 Duration:01(30 minutes) FiledA:0320 UnitRate:0032(2.5U) UnitRateSchedule:0032(2.5U)
PDM 17(13)->InsulinExtra(short):Immediate
POD 06(3)->POD Error:Type:14 Nonce ErrorHx=85ab Seed request :3
PDM 1a(14)->Insulin Schedule:Seed(3)Nonce:436a5bb5(0) Type:02 Bolus CheckSum:0088/0088 Duration:01(30 minutes) FiledA:0320 UnitRate:0032(2.5U) UnitRateSchedule:0032(2.5U)
PDM 17(13)->InsulinExtra(short):Immediate
But appears also when some particular status from POD
PDM 0e(1)->Get Status type 00
POD 02(22)->Resp02:020d00001406077318117f0000117f0000195709030d
PDM 0e(1)->Get Status type 01
POD 02(19)->Resp02:01000000000000000000000000000000000000
PDM 0e(1)->Get Status type 80
POD 02(203)->Resp02:5007733172570134734401397359013c7342014172590144724301497257014c7341015172550154734101597356815c734481617356810073438005725680087343800d7355801073458015735180187346801d734f802073498025735200287344002d7351003072450035725300387243003d7251004073450045725100487344004d7250005072430055724f00587248805d73508060734a8001734e800472448009724e800c72448011724d801473438019724c801c72428021734c002472470029724f002c714900
PDM 0e(1)->Get Status type 81
POD 02(203)->Resp02:5100323172510034724400397252003c7246004173530044724800497251004c7343005173500054724680597253805c734580017254bf047247bf097254bf0c724bbf117253bf147146bf197450bf1c7247bf21734ebf247344bf2973503f2c73473f31734f3f3473493f3972513f3c73483f4172523f4473483f4973523f4c73453f5172523f5473433f5973533f5c7346bf613254bf647345bf0172548104704681097552810c7245811172538114724281197352811c7243812172568124734101297259012c734301
#9 PDM 1c(4)->CancelPOD Nonce 851072aa(-1)
#10 POD 06(3)->POD Error:Type:14 Nonce ErrorHx=85f7 Seed request :35
- PDM (0e01) (Status Request)
- POD (1d**) (Status Response)
- ACK
- PDM (0e01) (Status Request)
- POD (1d**) (Status Response)
- ACK
- PDM (1a0e) (Bolus Request)
- ACK
- CON
- POD (1d**) (Status Response)
- CON
- PDM (0e01) (Status Request)
- POD (1d**) (Status Response)
- ACK
- PDM (1a0e) (Basal Change Request)
- ACK
- CON
- POD (1d**) (Status Response)
- ACK