Communication with OBC
The UART_3 serial port is used to implement payload communication with OBC. The logic and structure of the communication frame are described below.
Communication frame structure
Communication between the payload and OBC is based on two types of frames: read/write frame and ACK/NACK frame. Read/write frame is used to send or request data. ACK/NACK informs about successful or unsuccessful transaction. There is also one special type of frame - log frame.
Read/write frame
# | Description | Size | Value |
1 | preambule | 5b | 0b11010 |
2 | data size | 2b | |
3 | read/write flag | 1b | 0b1-read 0b0-write |
4 | register address | 8b | |
5 | data word 1 | 16b | |
6 | data word 2 | 16b | |
7 | data word 3 | 16b | |
8 | CRC | 16b |
Data: 16b data words are sent split into 2 bytes in the following order: 1. Least significant byte 2. Most significant byte. CRC: 16b CRC word is sent split in the same way as data words. CRC is calculated from the first 8 bytes, which includes swapped bytes of data words.
ACK/NACK frame
# | Description | Size | Value |
1 | preambule | 5b | 0b10101 |
2 | data size | 2b | 00 |
3 | correct/incorrect | 1b | 0b1-ok 0b0-not |
4 | register address | 8b |
Log frame
# | Description | Size | Value |
1 | preambule | 5b | 0b11010 |
2 | data size | 2b | 0b11 |
3 | read/write flag | 1b | 0b0 |
4 | log type | 8b | 0x82-normal log / 0xF8-special log |
5 | timestamp | 16b | |
6 | data id | 16b | |
7 | data value | 16b | |
8 | CRC | 16b |
Communication commands logic
Payload commands
Name | Add | Description | Size | Values |
REG_ADD_SR_ADCS_COIL_X | 66 67 | Set PWM of coil X to a given value. | int16 | -100 to 100 |
REG_ADD_SR_ADCS_COIL_Y | 68 69 | Set PWM of coil Y to a given value. | int16 | -100 to 100 |
REG_ADD_SR_ADCS_PWM | 208 209 | Confirm setting PWM of coils X and Y to given values. | X: int8 Y: int8 | -100 to 100 -100 to 100 |
REG_ADD_SR_ADCS_STATUS | 206 | lnform payload OBC about status of SatRevolution detumbling process. | uint16 | 0 - unknown /in progress 1 - success 2 - error |
REG_ADD_ADCS_COIL X_VALUE | 160 161 | Set in manual mode PWM of coil X to a given value. | int16 | -100 to 100 |
REG_ADD_ADCS_COIL Y_VALUE | 162 163 | Set in manual mode PWM of coil Y to a given value. | int16 | -100 to 100 |
REG_ADD_ADCS_COIL Z_VALUE | 164 165 | Set in manual mode PWM of coil Z to a given value. | int16 | -100 to 100 |
REG_ADD_MODE_TIME | 180 181 | Set the current mode’s timer_1s value to a given value multiplied by the current mode’s timer_prescaler. | uint16 | |
REG_ADD_MODE | 178 | Set mode with id equal to the given value as the current mode | uint8 | 0 to 8 |
REG_ADD_MODE_NEXT | 179 | Set mode with id equal to the given value as the next mode after current. | uint8 | 0 to 9 9 - current as next |
REG_ADD_LOG1MIN_ CONFIG_ADD_REG | 184 185 | Add register of given value to the log list in 1min period log mode. | uint16 | 136 to 255 |
REG_ADD_LOG1S_ CONFIG_ADD_REG | 188 189 | Add register of given value to the log list in 1s period log mode. | uint16 | 136 to 255 |
REG_ADD_LOG200MS_ CONFIG_ADD_REG | 192 193 | Add register of given value to the log list in 200ms period log mode. | uint16 | 136 to 255 |
REG_ADD_LOG1MIN_ CONFIG_DLT_REG | 186 197 | Delete register of given value from the log list in 1min period log mode. | uint16 | 136 to 255 1 - clear list |
REG_ADD_LOG1S_ CONFIG_DLT_REG | 190 191 | Delete register of given value from the log list in 1s period log mode. | uint16 | 136 to 255 1 - clear list |
REG_ADD_LOG200MS_ CONFIG_DLT_REG | 194 195 | Delete register of given value from the log list in 200ms period log mode. | uint16 | 136 to 255 1 - clear list |
REG_ADD_STOP_LOGS | 246 247 | Stop or start logging data. | uint16 | 0 - START 1 - STOP |
REG_ADD_SPECIAL_ LOG_BUFF | 254 255 | Inform whether the special log buffer is full. If so - log to normal buffer. | uint16 | 0 - FULL 1 - NOT FULL |
Setting calibration parameters
To set any of constant parameters in the equations mentioned above, there is a need to define the address and value of the designated coefficient. This is done by writing the following registers:
REG_ADD_FLASH_CONFIG_PARAM_<ID> - ID of the parameter from the table below
REG_ADD_FLASH_CONFIG_VALUE_<1 or 2> - float value of the parameter
Param ID | Description |
0 | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 |
Logging logic
By default, payload logs data by sending log frames with log type 0x82 (normal log). There is also a second log type 0xF8 (special log) used in modes: Diagnostic, Detumbling and F.R.W. experiment. Special logs are high value data and are stored in non-shift buffer. The attached sheet describes the logged data and its frequency in every mode.
KRAKsat OBC has implemented logic, which supports the storage of various types of logs. Logs are stored in different memory spaces depending on their type and memory space availability.
Last updated