|
CTS-SAT-1-OBC-Firmware
|
#include "telecommands/obc_systems_telecommand_defs.h"#include "obc_systems/obc_temperature_sensor.h"#include "obc_systems/adc_vbat_monitor.h"#include "debug_tools/debug_uart.h"#include "stm32l4xx_hal_rcc.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <inttypes.h>
Functions | |
| uint8_t | TCMDEXEC_obc_read_temperature_complex (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len) |
| Reads the temperature from the STDS75DS2F and stores it in the provided variable temperature. Temperature range is -55 to 125 degrees celsius with +/- 3 degrees celsius accuracy over the whole range. | |
| uint8_t | TCMDEXEC_obc_read_temperature (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len) |
| Reads the temperature from the STDS75DS2F in centi-Celsius. | |
| uint8_t | TCMDEXEC_obc_adc_read_vbat_voltage (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len) |
| Read the battery voltage using the ADC. Returns the result in mV. Voltage divider ratio is already applied. | |
| static uint8_t | SystemClock_Config_with_hse (void) |
| This is a version of the SystemClock_Config function in main.c, generated with the HSE SYSCLK config. | |
| static HAL_StatusTypeDef | MX_TIM6_Init_with_new_25MHz_speed (void) |
| TIM6 Initialization Function. | |
| uint8_t | TCMDEXEC_obc_set_stm32_sysclk_to_hse (const char *args_str, char *response_output_buf, uint16_t response_output_buf_len) |
| Change the STM32 SYSCLK clock from the HSI to the HSE. | |
Variables | |
| TIM_HandleTypeDef | htim6 |
|
static |
TIM6 Initialization Function.
Re-init the TIM6 timer with a period of 1ms, with the new 25MHz clock.
This is a version of the MX_TIM6_Init function in main.c, with the Prescaler line changed.

|
static |
This is a version of the SystemClock_Config function in main.c, generated with the HSE SYSCLK config.
Configure the main internal regulator output voltage
Initializes the RCC Oscillators according to the specified parameters in the RCC_OscInitTypeDef structure.
Initializes the CPU, AHB and APB buses clocks


| uint8_t TCMDEXEC_obc_adc_read_vbat_voltage | ( | const char * | args_str, |
| char * | response_output_buf, | ||
| uint16_t | response_output_buf_len ) |
Read the battery voltage using the ADC. Returns the result in mV. Voltage divider ratio is already applied.
| args_str | No arguments. |

| uint8_t TCMDEXEC_obc_read_temperature | ( | const char * | args_str, |
| char * | response_output_buf, | ||
| uint16_t | response_output_buf_len ) |
Reads the temperature from the STDS75DS2F in centi-Celsius.

| uint8_t TCMDEXEC_obc_read_temperature_complex | ( | const char * | args_str, |
| char * | response_output_buf, | ||
| uint16_t | response_output_buf_len ) |
Reads the temperature from the STDS75DS2F and stores it in the provided variable temperature. Temperature range is -55 to 125 degrees celsius with +/- 3 degrees celsius accuracy over the whole range.
| args_str |
|

| uint8_t TCMDEXEC_obc_set_stm32_sysclk_to_hse | ( | const char * | args_str, |
| char * | response_output_buf, | ||
| uint16_t | response_output_buf_len ) |
Change the STM32 SYSCLK clock from the HSI to the HSE.
| args_str | No arguments. |
On bootup, the OBC will use the HSI as its clock, as the HSE may have a PCB design defect, where the output capacitance of the HSE clock is too high. Running this command will switch the SYSCLK from the High-Speed Internal (HSI) at 16 MHz to the probably-fine-but-maybe-questionable High-Speed External (HSE) clock at 25 MHz. The main benefit is that the HSE clock is a Temperature-Compensated Crystal Oscillator (TXCO), and thus maintains the system clock much more reliably.

|
extern |