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