Almabraxas/2/Transmission frame format
Encoding
The frame is fixed size with a length of 50 characters. This seems to be the biggest possible message for 1 billing unit with my Iridium provider.
Binary coding is not used, so I don't need to use CTS / DTS lines on the modem without doing anything special.
Since the frame is fixed size, there's no need for an initial synchronization symbol (like start bit in UART or $ in GPRS sentences): if the frame is less than 50 characters, something was missed.
Numbers are encoded in groups of 6 bits, least significant group first, encoded with a radix-64 using characters 0-9 then a-z then A-Z then - and _. So for example, for a 2-digit (radix 64) number, decimal 0 is encoded as 00, 1 is 10 (least significant first), 9 is encoded as 90, 10 as a0, 63 as _0 and 64 as 01. Note that the coding allows for 6 bits for each radix 64 digit (thus 4096 values for a 2-digits number, 262144 for 3-digits, and so on).
I'm trying to have "natural" values to save some computing of scale, so for example heading goes from 0 to 3600 (in 1/10th of degrees), instead going to the full 4095.
Since not everything I want to transmit fits into the frame with the selected coding scheme, the less important data (number of error messages from GPS and modem for example), are transmitted in a rotating manner. The "]" field is a bitfield and allows for discriminating the differents cases, according to the tables below. Also note that MSB of this field is a one bit flag indicating that logging on the SD card in running.
The frame
Index in frame | Field size | Field name | Expected range | Description |
---|---|---|---|---|
1 | 1 | N | 0-63 | Incrémental message number (cycling on 64 positions) reset on computer reset |
2 | 5 | CCCCC | 0-2^30-1 (~sometimes in 2034) | Absolute clock: Number of secs since January 1 2000 à 00h00:00. NB: the GPS is the clock source |
7 | 3 | UUU | 0-262143 | Uptime in sec (teensy clock) |
10 | 3 | MMM | 0-262143 | Free memory (bytes) |
13 | 4 | LLLL | -90-+90 with mapped in 2^24 | Latitude (range allow for 1 mm precision) |
17 | 4 | llll | -180-+180 mapped in 2^24 | Latitude (range allow for 2 mm precision) |
21 | 2 | VV | 0-4095 (0V-40.95V) | |
23 | 3 | PPP | 0-262143 | Barometric pressure (Pa) |
26 | 3 | AAA | 0-262143 | GPS altitude (meter) |
29 | 2 | TT | -220+XXX | Temperature (OAT) in 10th of celsius degree, starting at -220 (that is 0 = -22.0) |
31 | 2 | tt | -220+XXX | board temperature in 10th of celsius degree, starting at -220 (that is 0 = -100.0) |
33 | 2 | ss | 0-4095 | GPS ground speed in knots |
35 | 2 | hh | 0-3600 (degree / 10) | (last) GPS heading |
37 | 2 | SS | Servo position | |
39 | 1 | [ | 0-31+MSB | MSB = SD card logging ok |
If ]&0xf == 0, the rest of the fields are as follows
Index in frame | Field size | Field name | Expected range | Description |
---|---|---|---|---|
40 | 2 | ww | 0-4095 | No of current waypoint |
42 | 4 | xxxx | -90-+90 with mapped in 2^24 | Next waypoint latitude |
46 | 4 | yyyy | -180-+180 mapped in 2^24 | Next waypoint longitude |
If ]&0xf == 1, the rest of the fields are as follows
Index in frame | Field size | Field name | Expected range | Description |
---|---|---|---|---|
40 | 3 | ggg | 0-262143 | Nbr of messages from GPS |
43 | 3 | iii | 0-262143 | GPS GRMC messages with status void |
If ]&0xf == 2, the rest of the fields are as follows
Index in frame | Field size | Field name | Expected range | Description |
---|---|---|---|---|
40 | 3 | eee | 0-262143 | Nbr of ko messages from GPS |
43 | 3 | fff | 0-262143 | Number of ERROR from satellite modem |