Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADCS commissioning #215

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c7bda96
fix numbers of telecommand args
DeemDeem52 Oct 5, 2024
9777f58
snprintf doesn't support floats
DeemDeem52 Oct 5, 2024
de7b504
Updated flash driver and littlefs helper to use NAND memory module (M…
KaleF07 Oct 6, 2024
6266845
Create Current ACP Status commands
DeemDeem52 Oct 9, 2024
c437f7f
Create Current ADCS State 1 command
DeemDeem52 Oct 9, 2024
1e7cffe
Create commissioning structs
DeemDeem52 Oct 14, 2024
b7e8868
Create Raw Star Tracker command
DeemDeem52 Oct 16, 2024
aaf6668
Create Save Image command
DeemDeem52 Oct 16, 2024
1d7b353
Create TCMDEXEC_adcs_request_commissioning_telemetry
DeemDeem52 Oct 19, 2024
e8eecb4
Minor change: lowercase function names
DeemDeem52 Oct 19, 2024
16a5bd4
Merge branch 'main' into nadeem-adcs-commissioning
DeemDeem52 Oct 19, 2024
5050a52
Create delayed and repeated telecommand functions
DeemDeem52 Oct 23, 2024
900081a
minor bugfix
DeemDeem52 Oct 26, 2024
6e7e0d2
ADCS Unix time telecommands
DeemDeem52 Oct 30, 2024
9db0127
Create SD Log Config commands
DeemDeem52 Nov 2, 2024
ebd7516
Update request_commissioning_telemetry with SD logger command
DeemDeem52 Nov 6, 2024
bafd10d
Update printing doubles to JSON
DeemDeem52 Nov 20, 2024
4f750eb
Double-to-string unit test
DeemDeem52 Nov 20, 2024
6a3589c
minor bugfix
DeemDeem52 Nov 23, 2024
bd60831
Merge branch 'main' into nadeem-adcs-commissioning
DeemDeem52 Nov 27, 2024
7f948c6
minor comment change
DeemDeem52 Nov 27, 2024
e465327
documentation change
DeemDeem52 Nov 27, 2024
68f3d37
timekeeping and float bugfixes
DeemDeem52 Dec 7, 2024
1778f36
minor docs changes
DeemDeem52 Dec 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/00_Getting_Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ Follow through this guide, and follow through the rest of the numbered guides in
### Troubleshooting

1. Check that your MicroUSB cable supports data transfer. Many MicroUSB cables are power-only.
2. Disable your antivirus if it starts removing the compiler.
3. Use the Ctrl+Shift+P command palate to run "STM32: Install all the build tools ...".
2. The dev-board has two connectors on it, only one of which (the CN1 connector) can be used to plug in the MicroUSB cable. Ensure that you are using the correct connector.
3. Disable your antivirus if it starts removing the compiler.
4. Use the Ctrl+Shift+P command palate to run "STM32: Install all the build tools ...".
5. The OBC has two USB connectors which are required for uploading code (the ST-Link) and communicating with a computer (the umbilical). Ensure the correct one(s) are connected to your computer when testing with the OBC.


## Testing and Debugging the Firmware
Expand Down
2 changes: 1 addition & 1 deletion docs/40_Logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The logging system on this satellite is rather simple: call the `LOG_message(...

## How to use `LOG_message(...)`

YOU, a developer, must be use the `LOG_message(...)` function. Here's how:
YOU, a developer, must use the `LOG_message(...)` function. Here's how:

1. In just about every `.c` file, include: `#include "log/log.h"`
2. Call `LOG_message(...)` with the message you want to log with the relevant subsystem, log severity, which sinks (`LOG_SINK_ALL` by default), a message, and any printf-like arguments for format strings in the message:
Expand Down
67 changes: 66 additions & 1 deletion firmware/Core/Inc/adcs_drivers/adcs_command_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static const uint8_t ADCS_TELEMETRY_CUBEACP_CURRENT_ADCS_STATE_2 = 224;
static const uint8_t ADCS_TELEMETRY_CUBEACP_JPG_CONVERSION_PROGRESS = 133;
static const uint8_t ADCS_TELEMETRY_CUBEACP_CUBEACP_STATE = 135;
static const uint8_t ADCS_TELEMETRY_CUBEACP_ADCS_EXECUTION_TIMES = 196;
static const uint8_t ADCS_TELEMETRY_CUBEACP_ACP_EXECUTION_STATE = 220;
static const uint8_t ADCS_TELEMETRY_CUBEACP_EXECUTION_STATE = 220;
static const uint8_t ADCS_TELEMETRY_CUBEACP_IMAGE_CAPTURE_AND_SAVE_STATUS = 233;
static const uint8_t ADCS_TELEMETRY_CUBEACP_MAGNETIC_FIELD_VECTOR = 151;
static const uint8_t ADCS_TELEMETRY_CUBEACP_COARSE_SUN_VECTOR = 152;
Expand Down Expand Up @@ -223,4 +223,69 @@ static const uint8_t ADCS_COMMAND_BOOTLOADER_RUN_PROGRAM = 101;
static const uint8_t ADCS_COMMAND_BOOTLOADER_READ_INFO = 102;
static const uint8_t ADCS_COMMAND_BOOTLOADER_COPY_TO_FLASH = 103;

// SD Log Bit Masks - Section 8 Table 216 of Firmware Manual
static const uint8_t ADCS_SD_LOG_MASK_COMMUNICATION_STATUS[10] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_EDAC_ERROR_COUNTERS[10] = {0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_LAST_LOGGED_EVENT[10] = {0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_SRAM_LATCHUP_COUNTERS[10] = {0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_MAGNETORQUER_COMMAND[10] = {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_WHEEL_SPEED_COMMANDS[10] = {0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_MAGNETIC_FIELD_VECTOR[10] = {0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_COARSE_SUN_VECTOR[10] = {0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_FINE_SUN_VECTOR[10] = {0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_NADIR_VECTOR[10] = {0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_RATE_SENSOR_RATES[10] = {0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_WHEEL_SPEED[10] = {0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_STAR_1_BODY_VECTOR[10] = {0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_STAR_1_ORBIT_VECTOR[10] = {0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_STAR_2_BODY_VECTOR[10] = {0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_STAR_2_ORBIT_VECTOR[10] = {0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_STAR_3_BODY_VECTOR[10] = {0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_STAR_3_ORBIT_VECTOR[10] = {0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_CUBESENSE1_CURRENT_MEASUREMENTS[10] = {0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_CUBECONTROL_CURRENT_MEASUREMENTS[10] = {0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_WHEEL_CURRENTS[10] = {0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_ADCS_MISC_CURRENT_MEASUREMENTS[10] = {0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_ADCS_TEMPERATURES[10] = {0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_RATE_SENSOR_TEMPERATURES[10] = {0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_CURRENT_ADCS_STATE[10] = {0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_ESTIMATED_ATTITUDE_ANGLES[10] = {0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_ESTIMATED_QUATERNION[10] = {0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_ESTIMATED_ANGULAR_RATES[10] = {0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_SATELLITE_POSITION_ECI[10] = {0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_SATELLITE_VELOCITY_ECI[10] = {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_SATELLITE_POSITION_LLH[10] = {0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_ECEF_POSITION[10] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_IGRF_MODELLED_MAGNETIC_FIELD_VECTOR[10] = {0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_MODELLED_SUN_VECTOR[10] = {0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_ESTIMATED_GYRO_BIAS[10] = {0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_ESTIMATION_INNOVATION_VECTOR[10] = {0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_QUATERNION_ERROR_VECTOR[10] = {0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_QUATERNION_COVARIANCE[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_ANGULAR_RATE_COVARIANCE[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_RAW_GPS_STATUS[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_RAW_GPS_TIME[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_RAW_GPS_X[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_RAW_GPS_Y[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_RAW_GPS_Z[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_RAW_CAM2_SENSOR[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_RAW_CAM1_SENSOR[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_RAW_CSS_1_TO_6[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_RAW_CSS_7_TO_10[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_RAW_MAGNETOMETER[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_STAR_PERFORMANCE1[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_STAR_MAGNITUDE[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_STAR_1_RAW_DATA[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_STAR_2_RAW_DATA[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_STAR_3_RAW_DATA[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_STAR_TIMING[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_SECONDARY_MAGNETOMETER_RAW_MEASUREMENTS[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_FINE_ESTIMATED_ANGULAR_RATES[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_RAW_RATE_SENSOR[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_CURRENT_ADCS_STATE_2[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_CUBESTAR_ESTIMATED_RATES[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_CUBESTAR_ESTIMATED_QUATERNION[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_STAR_PERFORMANCE2[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00};
static const uint8_t ADCS_SD_LOG_MASK_CUBESENSE2_CURRENT_MEASUREMENTS[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00};

#endif /* INC_ADCS_COMMAND_IDS_H_ */
9 changes: 9 additions & 0 deletions firmware/Core/Inc/adcs_drivers/adcs_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,14 @@ uint8_t ADCS_get_raw_gps_x(ADCS_raw_gps_struct_t *output_struct);
uint8_t ADCS_get_raw_gps_y(ADCS_raw_gps_struct_t *output_struct);
uint8_t ADCS_get_raw_gps_z(ADCS_raw_gps_struct_t *output_struct);
uint8_t ADCS_get_measurements(ADCS_measurements_struct_t *output_struct);
uint8_t ADCS_get_acp_execution_state(ADCS_acp_execution_state_struct_t *output_struct);
uint8_t ADCS_get_current_state_1(ADCS_current_state_1_struct_t *output_struct);
uint8_t ADCS_get_raw_star_tracker_data(ADCS_raw_star_tracker_struct_t *output_struct);
uint8_t ADCS_save_image_to_sd(ADCS_camera_select_enum_t camera_select, ADCS_image_size_enum_t image_size);
uint8_t ADCS_get_current_unix_time();
uint8_t ADCS_synchronise_unix_time();
uint8_t ADCS_set_sd_log_config(uint8_t which_log, const uint8_t **log_array, uint8_t log_array_size, uint16_t log_period, ADCS_sd_log_destination_enum_t which_sd);
uint8_t ADCS_get_sd_log_config(uint8_t which_log, ADCS_sd_log_config_struct* config);


#endif /* INC_ADCS_COMMANDS_H_ */
2 changes: 2 additions & 0 deletions firmware/Core/Inc/adcs_drivers/adcs_internal_drivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ static const uint16_t ADCS_PROCESSED_TIMEOUT = 1000;
// byte transforms
uint8_t ADCS_convert_uint16_to_reversed_uint8_array_members(uint8_t *array, uint16_t value, uint16_t index);
uint8_t ADCS_convert_uint32_to_reversed_uint8_array_members(uint8_t *array, uint32_t value, uint16_t index);
uint8_t ADCS_convert_double_to_string(double input, uint8_t precision, char* output_string, uint16_t str_len);
uint8_t ADCS_combine_sd_log_bitmasks(const uint8_t **array_in, const uint8_t array_in_size, uint8_t *array_out);

// TC/TLM functions (basic communication)
uint8_t ADCS_i2c_send_command_and_check(uint8_t id, uint8_t* data, uint32_t data_length, uint8_t include_checksum);
Expand Down
Loading
Loading