Skip to content

[EN] Log Protocol

LUFT-AQUILA edited this page Nov 1, 2023 · 2 revisions

The logs recorded by TMA-1 are in a format of 16 byte Little Endian.

timestamp

This is the time elapsed in milliseconds since the TMA-1 was powered on.

level

Level value
FATAL 0
ERROR 1
WARN 2
INFO 3
DEBUG 4

source & key

The source and key identify the component that generated the log and the type of log.

Source value Key value parsed
SYS 0 SYS_SD_INIT 0
SYS_CORE_INIT 1
SYS_SERIAL_INIT 2
SYS_TELEMETRY_REMOTE 3
SYS_TELEMETRY_INIT 4
CAN_INIT 5
DIGITAL_INIT 6
ANALOG_INIT 7
PULSE_INIT 8
ACCELEROMETER_INIT 9
GPS_INIT 10
SYS_READY 11
SYS_RTC_FIX 12
SYS_SD_FAIL 13
CAN_ERR_CANERR 14
CAN_ERR_RXMSGFAIL 15
CAN_ERR_FIFOFULL 16
CAN 1 CAN MSG ID & 0xFF CAN MSG data
DIGITAL 2 DIGITAL_DATA 0 DIN0 DIN1 DIN2 DIN3
DIN4 DIN5 DIN6 DIN7
ANALOG 3 ANALOG_SYS 0 CPU_TEMP INPUT_VOLTAGE
ANALOG_DATA 1 AIN0 AIN1 AIN2 AIN3
PULSE 4 PULSE_DATA 0 PIN0 PIN1 PIN2 PIN3
ACCELEROMETER 5 ACCELEROMETER_DATA 0 x y z
GPS 6 GPS_POS 0 lat lon
GPS_VEC 1 speed course
GPS_TIME 2 utc_date utc_time

checksum

This is the checksum used to validate the log.

It is the lowest 8 bits of the sum of the remaining 15 bytes excluding itself.

value

This is a 8 byte data of the log.

SYS

SYS_SD_INIT

SD card initialization record.

value data
0 success
other FatFs FRESULT

SYS_CORE_INIT

TMA-1 core system initialization record.

value data
0 success

SYS_SERIAL_INIT

TMA-1 serial log output buffer initialization record.

value data
0 success

SYS_TELEMETRY_REMOTE

TMA-2 telemetry server connection record.

value data
0 server disconnected
1 server connected

SYS_TELEMETRY_INIT

Handshake record between STM32 and ESP32

value data
0 success
1 ESP not found
2 ESP I2C not ready
3 ESP handshake error
4 ESP handshake ruined

CAN_INIT

CAN peripheral initialization record.

value data
0 success
1 filter config fail
2 CAN start fail
3 FIFO MSG pending notification activation fail
4 FIFO full notification activation fail
5 FIFO overrun notification activation fail
6 BUSOFF notification activation fail
7 ERROR notification activation fail

DIGITAL_INIT

Digital input channel initialization record.

value data
0 success

ANALOG_INIT

Analog input channel initialization record.

value data
0 success

PULSE_INIT

Digital pulse period measurement channel initialization record.

value data
0 success

ACCELEROMETER_INIT

Accelerometer initialization record.

value data
0 success
1 error
2 busy
3 timeout

GPS_INIT

GPS module initialization record.

value data
0 success

SYS_READY

System initialization complete record.

value data
0 success

SYS_RTC_FIX

RTC time synchronization record.

byte data
#0 Year
#1 Month
#2 Date
#3 Hours
#4 Minutes
#5 Seconds
#6 source
0: UART
1: TELEMETRY

SYS_SD_FAIL

Failure record while SD card mount / open / write / sync operation.

value data
0 not specified

CAN_ERR_CANERR

CAN bus error record.

value data
0 not specified

CAN_ERR_RXMSGFAIL

CAN bus message read failure record.

value data
0 not specified

CAN_ERR_FIFOFULL

CAN bus message FIFO full error record.

value data
0 not specified

CAN

CAN message ID will be stored as a key. Since the key is 1 byte long, only the lowest 8 bits will be stored.

In short, for logs with the source as CAN, the key is CAN message ID & 0xFF.

DIGITAL

DIGITAL_DATA

This is a digital channel record generated every 100ms.

Each byte indicates the status of the corresponding channel. 0 means the channel is LOW, and 1 means it is HIGH.

byte data
#0 DIN0
#1 DIN1
#2 DIN2
#3 DIN3
#4 DIN4
#5 DIN5
#6 DIN6
#7 DIN7

ANALOG

ANALOG_SYS

A system analog voltage record. It records the core temperature and power voltage every second.

byte data
#0 ~ #1 STM32F4 core temperature * 10
#2 ~ #3 VIN voltage / 8 / 3.3 * 4096

ANALOG_DATA

This is an analog channel record generated every 100ms.

ADC resolution is 12 bits; each channel stores a value between 0 and 4095. The recorded value varies depending on the voltage divider resistors installed in the ANALOG area of the PCB. When the distributed voltage is 3.3V, it results in a recorded value of 4095.

byte data
#0 ~ #1 AIN0
#2 ~ #3 AIN1
#4 ~ #5 AIN2
#6 ~ #7 AIN3

PULSE

PULSE_DATA

This is a record for digital waveform period measurement channels. Measurement is activated every 100ms.

A log is recorded when two rising edges are detected in all four channels. The time interval between two rising edges for each channel is recorded in microseconds.

byte data
#0 ~ #1 PIN0
#2 ~ #3 PIN1
#4 ~ #5 PIN2
#6 ~ #7 PIN3

ACCELEROMETER

ACCELEROMETER_DATA

An accelerometer read record generated every 100ms.

acceleration of each axis * 4 / 512 is an actual acceleration in G unit.

byte data
#0 ~ #1 x-axis acceleration
#2 ~ #3 y-axis acceleration
#4 ~ #5 z-axis acceleration

GPS

GPS log is recorded only if valid GPS data is received. Data is received from the GPS module every 100ms.

GPS_POS

A GPS location record.

Each coordinate represents NMEA coordinates * 10000. It is equal to the value obtained by removing the decimal point from the NMEA coordinate data.

byte data
#0 ~ #3 latitude
#4 ~ #7 longitude

GPS_VEC

A GPS speed and course direction record.

byte data
#0 ~ #3 speed(knots * 100)
#4 ~ #7 course angle(to true north)

GPS_TIME

A GPS time record.

byte data
#0 ~ #3 date(mmddyy)
#4 ~ #7 time(hhmmss)