Skip to content

Protocol specifications

vNimych edited this page Jan 8, 2021 · 2 revisions

Protocol specifications


In order not to reinvent the "wheel", the UBX protocol was taken as basis and simplified for the current requirements:

  • simplicity

  • scalability

  • short messages to minimize air latency

In protocol not included ACK and NAK - since this is an overhead in time, if the parcel was not received by the ground station, it's okay, we will received the next message, but will not waste time transmitting package: "success received"

It consists of six blocks, as shown in the picture

Where:

  1. Sync char 1 byte - 0x24 (always all frame starts with this byte)
  2. Type 1 byte - message type, see this table for details
  3. Message ID 1 byte - specify message id, see this table for details
  4. Payload len 1 byte - payload len
  5. Payload - the payload message (max 59 byte)*
  6. CRC 1 byte - crc 8 it should be calculated as shown in the picture

* FiFo SX1276 buffer size is 64 bytes to minimize latency, limit for size of payload (59 bytes), this size limit may be removed, after latency test


Message types table

Name Type Description
Set 0x01 Configure parameter in AirUnit
Request 0x02 Request parameter from AirUnit
Response 0x03 Parameter response from AirUnit
Beacons 0x04 Periodic beacons messages from AirUnit
Control 0x05 Control of executive devices in the rocket - rudders, ignition, engine, parachute ejection, etc.

*Status this table - in progress


Message ID table

Name Type Message ID Description and structure payload message
GPS Beacons
Response
0x01 GPS Navigation messages: Position, Speed, Time, Heading, DOP, Satellite Status, RTC Status
*for payload details, see struct "GPS"
GPS Request 0x01 For request GPS message from AirUnit, need send in payload 1 byte - 0xFF
GPS Set 0x01 Set period beacon for GPS messages in ms - 2 byte
(if value 0x0000 not send beacon)
IMU Beacons
Response
0x02 Inertial Measurement Unit: accelerometer, gyroscope, pressure sensor
*for payload details, see struct "IMU"
IMU Request 0x02 For request IMU message from AirUnit, need send in payload 1 byte - 0xFF
IMU Set 0x02 Set period beacon for IMU messages in ms - 2 byte
(if value 0x0000 not send beacon)
INF Beacons
Response
0x03 Information Messages: Error, Warning, Notice
*for payload details, see struct "INF"
INF Set 0x03 Set level information messagings: Error, Warning, Notice
INF Request 0x03 For request INF message from AirUnit, need send in payload 1 byte - 0xFF
MON Request 0x04 For request MON message from AirUnit, need send in payload 1 byte - 0xFF
MON Response 0x04 Monitoring Messages: Communication Status, CPU Load, Stack Usage, Task Status
*for payload details, see struct "MON"
POW Beacons
Response
0x05 Information about: Battery voltage, temperature board, power status
*for payload details, see struct "POW"
POW Request 0x05 For request POW message from AirUnit, need send in payload 1 byte - 0xFF
POW Set 0x05 Set period beacon for POW messages
(if value 0x0000 not send beacon)

*Status this table - in progress


The binary payload for “GPS”

message shall be the following structure, payload len 38 byte

typedef struct __attribute__((__packed__)){
      TimeStamp_t time_stamp;
      float latitude;
      float longitude;
      float gps_speed;
      float hdop;
      float pdop;
      float vdop;
      uint8_t sats;
      uint8_t fix_quality;
      uint8_t fix_type;
      GPS_time_t time;
      GPS_date_t date;
  
} GPS_Data_t;

Where time_stamp - time device or booting time-stamp, if RTC not configured may be need to change this value to msg counter

typedef struct __attribute__((__packed__)){
    uint8_t hour;
    uint8_t minute;
    uint8_t second;
    uint16_t msec;
} TimeStamp_t;

Where time - GPS time, and date - GPS date

typedef struct __attribute__((__packed__)){
      uint8_t hours;
      uint8_t minutes;
      uint8_t seconds;
    
} GPS_time_t;
typedef struct __attribute__((__packed__)){
      uint8_t day;
      uint8_t month;
      uint8_t year;
    
} GPS_date_t;

The binary payload for “IMU”

message shall be the following structure, payload len 19 byte

typedef struct __attribute__((__packed__)){
    TimeStamp_t time_stamp;
    int16_t acc[3];
    int16_t gyro[3];
    uint16_t pressure;
} IMU_Data_t;

Where time_stamp - time device or booting time-stamp, if RTC not configured may be need to change this value to msg counter

typedef struct __attribute__((__packed__)){
    uint8_t hour;
    uint8_t minute;
    uint8_t second;
    uint16_t msec;
} TimeStamp_t;

The binary payload for “INF”
typedef struct __attribute__((__packed__)){
    uint8_t type_msg;
    uint8_t msg_len;
    uint8_t *msg;
} INF_Data_t;

Where
type_msg - type information message

  • 0x01 - Error
  • 0x02 - Warning
  • 0x03 - Notice

msg_len - len message msg - message


The binary payload for “MON”
typedef struct __attribute__((__packed__)){
    int8_t RSSI;
    int8_t SNR;
    uint16_t system_status;
    uint8_t cpu_load;
} MON_Data_t;

Where
RSSI - signal level of the last received message
SNR - signal-to-noise ratio
system_status - board status
0x00 - No errors

0xXX need to complete the list of system errors

cpu_load CPU load in present


The binary payload for “POW”
typedef struct __attribute__((__packed__)){
    float vbat;
    float vbat_backup;
    float vbat_rtc;
    float temperature;
    uint8_t power_status;
} POW_Data_t;

Where
vbat - main battery voltage in volts

vbat_backup - back up battery voltage in volts

vbat_rtc - RTC battery voltage in volts

temperature - board temperature in celsius

power_status - power status *need to complete the list of power status