CTS-SAT-1-OBC-Firmware
Loading...
Searching...
No Matches
eps_types.h
Go to the documentation of this file.
1
2#ifndef INCLUDE_GUARD__EPS_TYPES_H__
3#define INCLUDE_GUARD__EPS_TYPES_H__
4
5#include <stdint.h>
6
8static const uint8_t EPS_ACTIVE_CHANNEL_COUNT = 17;
9
11static const uint8_t EPS_MAX_ACTIVE_CHANNEL_NUMBER = 16;
12
14static const uint8_t EPS_TOTAL_CHANNEL_COUNT = 32;
15
16#pragma pack(push, 1)
17
18typedef enum {
19 EPS_CHANNEL_VBATT_STACK = 0, // CH0 (Pin H2-45 and H2-46)
20 EPS_CHANNEL_5V_STACK = 1, // CH1 (Pin H2-25 and H2-26)
21 EPS_CHANNEL_5V_CH2_UNUSED = 2, // CH2 (Pin H1-47)
22 EPS_CHANNEL_5V_CH3_UNUSED = 3, // CH3 (Pin H1-49)
23 EPS_CHANNEL_5V_MPI = 4, // CH4 (Pin H1-51)
24 EPS_CHANNEL_3V3_STACK = 5, // CH5 (Pin H2-27 and H2-28)
25 EPS_CHANNEL_3V3_CAMERA = 6, // CH6 (Pin H1-48)
26 EPS_CHANNEL_3V3_UHF_ANTENNA_DEPLOY = 7, // CH7 (Pin H1-50)
27 EPS_CHANNEL_3V3_GNSS = 8, // CH8 (Pin H1-52)
31 EPS_CHANNEL_12V_MPI = 12, // CH12 (Harness)
32 EPS_CHANNEL_12V_BOOM = 13, // CH13 (Harness)
36 EPS_CHANNEL_UNKNOWN = 255, // Unknown Channel, parsing failed, etc.
38
39
40// "Complex Datatype: VIPD" (eng)
41typedef struct {
42 int16_t voltage_mV;
43 int16_t current_mA;
44 int16_t power_cW; // centiWatts (x 10^-2 watts)
46
47// "Complex Datatype: BPD (Battery Pack Datatype)" (eng)
48typedef struct {
50 uint16_t bp_status_bitfield; // See Table 3-18 for bitfield definitions
52 int16_t battery_temperature_each_sensor_cC[3]; // centiCelsius = 1e-2 degrees C
54
55
56// "Complex Datatype: CCD (Conditioning Channel Datatype)" (eng)
57// The conditioning channel refers to the MPPT system.
65
66// "Complex Datatype: CCSD (Conditioning Channel Short Datatype)" (eng)
67// The conditioning channel refers to the MPPT system.
74
75// Command Response: 0x40: Get System Status
76typedef struct {
77 uint8_t mode; // 0=startup, 1=nominal, 2=safety, 3=emergency_low_power
78 uint8_t config_changed_since_boot; // 0=not_altered, 1=changed_since_boot
79 uint8_t reset_cause; // 0=power_on, 1=watchdog, 2=commanded, 3=control_system_reset, 4=emergency_low_power
80 uint32_t uptime_sec;
81 uint16_t error_code;
82 uint16_t rst_cnt_pwron;
83 uint16_t rst_cnt_wdg;
84 uint16_t rst_cnt_cmd;
85 uint16_t rst_cnt_mcu;
86 uint16_t rst_cnt_emlopo; // reset count due to Emergency Low Power
88 uint32_t unix_time_sec; // seconds since 1970-01-01
89 uint8_t calendar_years_since_2000; // real year = 2000 + unix_years_since_2000
91 uint8_t calendar_day;
96
97// Command Response: 0x42: Get Overcurrent Fault State
98typedef struct {
99 // Note: rx_buf[5] is a reserved/ignored value
101 uint16_t stat_ch_ext_on_bitfield; // Channels not present on our model.
103 uint16_t stat_ch_ext_overcurrent_fault_bitfield; // Channels not present on our model.
104 // Only channels 0-16 (17 ch total) are present on our model.
107
108// Command Response: 0x44: Get PBU ABF Placed State
117
118// Command Response: 0x52: Get PDU (Distribution Unit) Housekeeping Data (Eng)
119// Command Response: 0x54: Get PDU (Distribution Unit) Housekeeping Data (Running Average, Eng)
134
135// Command Response: 0x62: Get PBU (Battery Unit) Housekeeping Data (Eng)
136// Command Response: 0x64: Get PBU (Battery Unit) Housekeeping Data (Running Average, Eng)
137typedef struct {
139 int16_t temperature_mcu_cC; // centiCelsius = 1e-2 degrees C
141 uint16_t battery_pack_status_bitfield; // Table 3-18: Battery Pack Status
142
143 // Note: While the data transfer spec supports 3 battery packs, we only have 1.
144 // The in the JSON function, only the first is rendered.
147
148
149// Command Response: 0x72: Get PCU (Conditioning Unit) Housekeeping Data (Eng)
150// Command Response: 0x74: Get PCU (Conditioning Unit) Housekeeping Data (Running Average, Eng)
158
159
160
161// Command Response: 0xA2: Get PDU (Distribution Unit) Housekeeping Data (Eng)
162// Command Response: 0xA4: Get PDU (Distribution Unit) Housekeeping Data (Running Average, Eng)
187
188#pragma pack(pop)
189
190#endif /* INCLUDE_GUARD__EPS_TYPES_H__ */
EPS_CHANNEL_enum_t
Definition eps_types.h:18
@ EPS_CHANNEL_3V3_CH14_UNUSED
Definition eps_types.h:33
@ EPS_CHANNEL_5V_STACK
Definition eps_types.h:20
@ EPS_CHANNEL_5V_CH2_UNUSED
Definition eps_types.h:21
@ EPS_CHANNEL_3V3_CH15_UNUSED
Definition eps_types.h:34
@ EPS_CHANNEL_3V3_STACK
Definition eps_types.h:24
@ EPS_CHANNEL_12V_MPI
Definition eps_types.h:31
@ EPS_CHANNEL_VBATT_CH9_UNUSED
Definition eps_types.h:28
@ EPS_CHANNEL_3V3_CAMERA
Definition eps_types.h:25
@ EPS_CHANNEL_UNKNOWN
Definition eps_types.h:36
@ EPS_CHANNEL_VBATT_CH10_UNUSED
Definition eps_types.h:29
@ EPS_CHANNEL_VBATT_CH11_UNUSED
Definition eps_types.h:30
@ EPS_CHANNEL_5V_CH3_UNUSED
Definition eps_types.h:22
@ EPS_CHANNEL_3V3_GNSS
Definition eps_types.h:27
@ EPS_CHANNEL_VBATT_STACK
Definition eps_types.h:19
@ EPS_CHANNEL_5V_MPI
Definition eps_types.h:23
@ EPS_CHANNEL_12V_BOOM
Definition eps_types.h:32
@ EPS_CHANNEL_28V6_CH16_UNUSED
Definition eps_types.h:35
@ EPS_CHANNEL_3V3_UHF_ANTENNA_DEPLOY
Definition eps_types.h:26
static const uint8_t EPS_TOTAL_CHANNEL_COUNT
The number of EPS channels, including those not really present on our model.
Definition eps_types.h:14
static const uint8_t EPS_ACTIVE_CHANNEL_COUNT
The number of EPS channels.
Definition eps_types.h:8
EPS_ABF_PIN_PLACED_enum_t
Definition eps_types.h:109
@ EPS_ABF_PIN_APPLIED
Definition eps_types.h:111
@ EPS_ABF_PIN_NOT_APPLIED
Definition eps_types.h:110
static const uint8_t EPS_MAX_ACTIVE_CHANNEL_NUMBER
The highest EPS channel number, starting from 0. 16 means there are 17 channels total.
Definition eps_types.h:11
Definition eps_types.h:48
uint16_t bp_status_bitfield
Definition eps_types.h:50
int16_t cell_voltage_each_cell_mV[4]
Definition eps_types.h:51
EPS_vpid_eng_t vip_bp_input
Definition eps_types.h:49
int16_t battery_temperature_each_sensor_cC[3]
Definition eps_types.h:52
int16_t curr_in_mppt_mA
Definition eps_types.h:61
EPS_vpid_eng_t vip_cc_output
Definition eps_types.h:59
int16_t curr_ou_mppt_mA
Definition eps_types.h:63
int16_t volt_ou_mppt_mV
Definition eps_types.h:62
int16_t volt_in_mppt_mV
Definition eps_types.h:60
int16_t volt_ou_mppt_mV
Definition eps_types.h:71
int16_t curr_ou_mppt_mA
Definition eps_types.h:72
int16_t volt_in_mppt_mV
Definition eps_types.h:69
int16_t curr_in_mppt_mA
Definition eps_types.h:70
Definition eps_types.h:113
EPS_ABF_PIN_PLACED_enum_t abf_placed_1
Definition eps_types.h:115
EPS_ABF_PIN_PLACED_enum_t abf_placed_0
Definition eps_types.h:114
Definition eps_types.h:137
int16_t voltage_internal_board_supply_mV
Definition eps_types.h:138
int16_t temperature_mcu_cC
Definition eps_types.h:139
uint16_t battery_pack_status_bitfield
Definition eps_types.h:141
EPS_vpid_eng_t vip_total_input
Definition eps_types.h:140
EPS_battery_pack_datatype_eng_t battery_pack_info_each_pack[3]
Definition eps_types.h:145
Definition eps_types.h:151
EPS_conditioning_channel_datatype_eng_t conditioning_channel_info_each_channel[4]
Definition eps_types.h:156
int16_t temperature_mcu_cC
Definition eps_types.h:153
EPS_vpid_eng_t vip_total_input
Definition eps_types.h:154
int16_t voltage_internal_board_supply_mV
Definition eps_types.h:152
Definition eps_types.h:120
EPS_vpid_eng_t vip_each_voltage_domain[7]
Definition eps_types.h:131
EPS_vpid_eng_t vip_total_input
Definition eps_types.h:124
EPS_vpid_eng_t vip_each_channel[32]
Definition eps_types.h:132
uint16_t stat_ch_ext_on_bitfield
Definition eps_types.h:127
int16_t temperature_mcu_cC
Definition eps_types.h:122
int16_t voltage_internal_board_supply_mV
Definition eps_types.h:121
uint16_t stat_ch_overcurrent_fault_bitfield
Definition eps_types.h:128
uint16_t stat_ch_ext_overcurrent_fault_bitfield
Definition eps_types.h:129
uint16_t stat_ch_on_bitfield
Definition eps_types.h:126
uint16_t stat_ch_overcurrent_fault_bitfield
Definition eps_types.h:102
uint16_t overcurrent_fault_count_each_channel[32]
Definition eps_types.h:105
uint16_t stat_ch_ext_overcurrent_fault_bitfield
Definition eps_types.h:103
uint16_t stat_ch_ext_on_bitfield
Definition eps_types.h:101
uint16_t stat_ch_on_bitfield
Definition eps_types.h:100
Definition eps_types.h:163
EPS_vpid_eng_t vip_batt_input
Definition eps_types.h:168
uint16_t stat_ch_ext_overcurrent_fault_bitfield
Definition eps_types.h:185
uint16_t stat_ch_overcurrent_fault_bitfield
Definition eps_types.h:170
int16_t temperature_mcu_cC
Definition eps_types.h:165
EPS_vpid_eng_t vip_each_channel[32]
Definition eps_types.h:181
uint16_t vd1_voltage_mV
Definition eps_types.h:176
int16_t voltage_internal_board_supply_mV
Definition eps_types.h:164
uint16_t stat_ch_ext_on_bitfield
Definition eps_types.h:184
int16_t battery_temp2_cC
Definition eps_types.h:172
uint16_t vd0_voltage_mV
Definition eps_types.h:175
uint16_t stat_ch_on_bitfield
Definition eps_types.h:169
uint16_t battery_status_bitfield
Definition eps_types.h:171
int16_t battery_temp3_cC
Definition eps_types.h:173
EPS_conditioning_channel_short_datatype_eng_t conditioning_channel_info_each_channel[5]
Definition eps_types.h:182
EPS_vpid_eng_t vip_dist_input
Definition eps_types.h:167
uint16_t vd2_voltage_mV
Definition eps_types.h:177
Definition eps_types.h:76
uint8_t calendar_month
Definition eps_types.h:90
uint8_t calendar_second
Definition eps_types.h:94
uint32_t unix_time_sec
Definition eps_types.h:88
uint32_t uptime_sec
Definition eps_types.h:80
uint8_t reset_cause
Definition eps_types.h:79
uint8_t config_changed_since_boot
Definition eps_types.h:78
uint16_t rst_cnt_emlopo
Definition eps_types.h:86
uint16_t time_since_prev_cmd_sec
Definition eps_types.h:87
uint8_t calendar_day
Definition eps_types.h:91
uint16_t rst_cnt_pwron
Definition eps_types.h:82
uint8_t calendar_hour
Definition eps_types.h:92
uint8_t calendar_years_since_2000
Definition eps_types.h:89
uint8_t mode
Definition eps_types.h:77
uint16_t rst_cnt_mcu
Definition eps_types.h:85
uint16_t error_code
Definition eps_types.h:81
uint8_t calendar_minute
Definition eps_types.h:93
uint16_t rst_cnt_wdg
Definition eps_types.h:83
uint16_t rst_cnt_cmd
Definition eps_types.h:84
Definition eps_types.h:41
int16_t voltage_mV
Definition eps_types.h:42
int16_t power_cW
Definition eps_types.h:44
int16_t current_mA
Definition eps_types.h:43