GOMspace NanoPower P31u API¶
Enums
-
enum KEPSStatus¶
EPS function return values.
Values:
-
enumerator EPS_OK¶
Requested function completed successfully.
-
enumerator EPS_ERROR¶
Generic error.
-
enumerator EPS_I2C_ERROR¶
I2C error.
-
enumerator EPS_ERROR_CONFIG¶
Configuration error.
-
enumerator EPS_ERROR_INTERNAL¶
An error was thrown by the subsystem.
-
enumerator EPS_OK¶
Functions
-
KEPSStatus k_eps_init(KEPSConf config)¶
Initialize the interface with the EPS.
- Parameters
config – [in] Interface configuration values
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
void k_eps_terminate(void)¶
Terminate the EPS interface.
-
KEPSStatus k_eps_ping(void)¶
Ping the EPS.
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_reset(void)¶
Hard reset the EPS.
Note
It will wait 400ms before re-powering
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_reboot(void)¶
Reboot the EPS (soft reset)
Note
Output power will not be affected
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_configure_system(const eps_system_config_t *config)¶
Configure the NanoPower’s system.
- Parameters
config – [in] Pointer to system configuration values
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_configure_battery(const eps_battery_config_t *config)¶
Configure the NanoPower’s battery.
Note
Configuration must be saved using k_eps_save_battery_config between 1 and 30 seconds after calling this function, otherwise the changes will be erased.
- Parameters
config – [in] Pointer to battery configuration values
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_save_battery_config(void)¶
Save the current battery configuration to EEPROM.
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_set_output(uint8_t channel_mask)¶
Turn on/off the NanoPower outputs.
Note
Cannot be used to control heaters
- Parameters
channel_mask – [in] Bitmask for output channels (MSB [X X 3.3V 3.3V 3.3V 5V 5V 5V] LSB). 0 = Off, 1 = On
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_set_single_output(uint8_t channel, uint8_t value, int16_t delay)¶
Turn on/off a single output.
- Parameters
channel – [in] Output to control. 0-5 = Output channels, 6 = BP4 heater, 7 = BP4 switch
value – [in] Desired output value. 0 = Off, 1 = On
delay – [in] Amount of time, in seconds, to wait before changing the output’s value
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_set_input_value(uint16_t in1_voltage, uint16_t in2_voltage, uint16_t in3_voltage)¶
Set photovoltaic input voltages.
Note
Only used when eps_hk_t.ppt_mode is
Fixed
- Parameters
in1_voltage – [in] Voltage value for PV1 [mV]
in2_voltage – [in] Voltage value for PV2 [mV]
in3_voltage – [in] Voltage value for PV3 [mV]
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_set_input_mode(uint8_t mode)¶
Set photovoltaic inputs’ power-point tracking mode.
- Parameters
mode – [in] PPT mode. 0 = hardware default power points, 1 = maximum power-point tracking, 2 = software-defined power points (set with k_eps_set_input_value)
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_set_heater(uint8_t cmd, uint8_t heater, uint8_t mode)¶
Control heaters.
- Parameters
cmd – [in] Heater control command (should always be
0
for now)heater – [in] Heater to control
mode – [in] State to set heater to. 0 = Off, 1 = On
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_reset_system_config(void)¶
Reset system configuration to default values.
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_reset_battery_config(void)¶
Reset battery configuration to default values.
Note
Values must be saved using k_eps_save_battery_config between 1 and 30 seconds after calling this function, otherwise the changes will be erased
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_reset_counters(void)¶
Reset system counters (boot count, watchdog reboot counts, etc)
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_get_housekeeping(eps_hk_t *buff)¶
Get system housekeeping data.
- Parameters
buff – [out] Pointer to storage structure
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_get_system_config(eps_system_config_t *buff)¶
Get system configuration values.
- Parameters
buff – [out] Pointer to storage structure
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_get_battery_config(eps_battery_config_t *buff)¶
Get battery configuration values.
- Parameters
buff – [out] Pointer to storage structure
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_get_heater(uint8_t *bp4, uint8_t *onboard)¶
Get heaters’ statuses.
- Parameters
bp4 – [out] Status of BP4 heater. 0 = Off, 1 = On
onboard – [out] Status of onboard heater. 0 = Off, 1 = On
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus k_eps_watchdog_kick(void)¶
Kick the EPS’s watchdog once.
- Returns
KEPSStatus
EPS_OK
if OK, error otherwise
-
KEPSStatus k_eps_watchdog_start(uint32_t interval)¶
Start a thread to kick the EPS’s watchdog.
Note
The watchdog kick requires a write to EEPROM, which has a limited lifespan. It is recommended that the watchdog interval be very large (ex. 48 hours)
- Parameters
interval – [in] Time to sleep in between kicks [seconds]
- Returns
KEPSStatus
EPS_OK
if OK, error otherwise
-
KEPSStatus k_eps_watchdog_stop(void)¶
Stop the watchdog thread.
- Returns
KEPSStatus
EPS_OK
if OK, error otherwise
-
KEPSStatus k_eps_passthrough(const uint8_t *tx, int tx_len, uint8_t *rx, int rx_len)¶
Pass a command packet directly through to the EPS.
Useful for executing commands which have not been implemented in this API
- Parameters
tx – [in] Pointer to command packet to send
tx_len – [in] Size of command packet
rx – [out] Pointer to storage for command response
rx_len – [in] Expected length of command response
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
KEPSStatus kprv_eps_transfer(const uint8_t *tx, int tx_len, uint8_t *rx, int rx_len)¶
Write command to EPS and read back a response.
- Parameters
tx – [in] Pointer to command packet to send
tx_len – [in] Size of command packet
rx – [out] Pointer to storage for command response
rx_len – [in] Expected length of command response
- Returns
KEPSStatus EPS_OK if OK, error otherwise
-
struct KEPSConf¶
- #include <gomspace-p31u-api.h>
Kubos -> EPS Configuration.
-
struct eps_resp_header¶
- #include <gomspace-p31u-api.h>
Response header structure.
-
struct eps_system_config_t¶
- #include <gomspace-p31u-api.h>
System configuration.
Public Members
-
uint8_t ppt_mode¶
Mode for power-point tracking [1 = Automatic maximum, 2 = Fixed].
-
uint8_t battheater_mode¶
Mode for battery heater activation [0 = Manual, 1 = Auto].
-
int8_t battheater_low¶
Turn heater on at [degC] (auto mode)
-
int8_t battheater_high¶
Turn heater off at [degC] (auto mode)
-
uint8_t output_normal_value[8]¶
Normal mode output values [0 = Off, 1 = On].
-
uint8_t output_safe_value[8]¶
Safe mode output values [0 = Off, 1 = On].
-
uint16_t output_initial_on_delay[8]¶
Default output power on delays [seconds].
-
uint16_t output_initial_off_delay[8]¶
Default output power off delays [seconds].
-
uint16_t vboost[3]¶
Fixed PPT point for boost converters [mV].
-
uint8_t ppt_mode¶
-
struct eps_battery_config_t¶
- #include <gomspace-p31u-api.h>
Battery mode configuration (Config2)
Public Members
-
uint16_t batt_maxvoltage¶
Voltage threshold to be in FULL mode.
-
uint16_t batt_safevoltage¶
Voltage threshold to trigger NORMAL -> SAFE mode.
-
uint16_t batt_criticalvoltage¶
Lowest allowable voltage (below -> CRITICAL mode)
-
uint16_t batt_normalvoltage¶
Voltage threshold to trigger SAFE -> NORMAL mode.
-
uint32_t reserved1[2]¶
Reserved.
-
uint8_t reserved2[4]¶
Reserved.
-
uint16_t batt_maxvoltage¶
-
struct eps_hk_t¶
- #include <gomspace-p31u-api.h>
P31u-8 housekeeping.
NOTE that some changes have been made from the GomSpace datasheet due to the complier mis-matches the bytes in the data structure 1) Changed counter_wdt_gnd and counter_boot from uint32_t to uint16_t 2) The attribute((packed)) attribute is removed
The data sizes at other parts of this API are changed accordingly
Public Members
-
uint16_t vboost[3]¶
Voltage of input voltage boost converters [mV].
-
uint16_t vbatt¶
Voltage of battery [mV].
-
uint16_t curin[3]¶
Input currents [mA].
-
uint16_t cursun¶
Current from boost converters [mA].
-
uint16_t cursys¶
Current out of battery [mA].
-
uint16_t reserved1¶
Reserved for future use.
-
uint16_t curout[6]¶
Output currents [mA].
-
uint8_t output[8]¶
Output statuses [0 = Off, 1 = On].
-
uint16_t output_on_delta[8]¶
Time until output power on [seconds].
-
uint16_t output_off_delta[8]¶
Time until output power off [seconds].
-
uint16_t latchup[6]¶
Number of output latch-up events.
-
uint32_t wdt_i2c_time_left¶
Time left for I2C watchdog [seconds].
-
uint32_t wdt_gnd_time_left¶
Time left for dedicated watchdog [seconds].
-
uint8_t wdt_csp_pings_left[2]¶
Pings left for CSP watchdog.
-
uint32_t counter_wdt_i2c¶
Number of I2C watchdog reboots.
-
uint16_t counter_wdt_gnd¶
Number of dedicated watchdog reboots.
-
uint32_t counter_wdt_csp[2]¶
Number of CSP watchdog reboots.
-
uint16_t counter_boot¶
Number of EPS reboots.
-
int16_t temp[6]¶
Temperatures [degC] [0 = Temp1, Temp2, Temp3, Temp4, BP4a, BP4b].
-
uint8_t boot_cause¶
Cause of last EPS reset.
-
uint8_t batt_mode¶
Mode for battery [0 = Initial, 1 = Critical, 2 = Safe, 3 = Normal, 4 = Full].
-
uint8_t ppt_mode¶
Mode of power-point tracker [1 = Automatic maximum, 2 = Fixed].
-
uint16_t reserved2¶
Reserved.
-
uint16_t vboost[3]¶