SCU Control Structure - Geowissenschaften/EXCISS GitHub Wiki
During boot phase, Raspberry Pi starts 2 scripts (from /etc/rc.local):
-
PI_shutdown_IO
Daemon that allows MCU to shutdown Raspberry Pi via GPIO- Triggered by HIGH signal on PIN/GPIO
- Default: Pin 36 / GPIO 16
-
SCU_launch_mission
Script that performs all SCU tasks in sequence- Performs sequence detailed below
Main routine SCU_launch_mission
SCU_launch_mission is a wrapper script that sets up the environment and calls the following sub-scripts to perform its tasks. Everytime this script is invoked, the unique SCU cycle number is incremented. The cycle number is referenced in log files, file names, and directory structures.
Global variables
The following global variables are defined and used by SCU_launch_mission:
- Global environment variables defined by SCU_launch_mission:
- SCU_HOME
Home directory of SCU environment, default location: /opt/MLU/SCU - SCU_CYCLE
Unique number of current invocation (integer counter; 0:=undefined)
- SCU_HOME
SCU_launch_mission tasks
The following scripts are called by SCU_launch_mission to perform specific tasks.
As a last step RPi is shut down (via SCU_keepalive script) and a wakeup time is set (via SCU_wakeup script) for the next restart of the SCU.
-
SCU_setup
Verifies, corrects and initializes the SCU environment- Mounts USB flash memory USB_A, USB_B, and USB_X.
- Checks/Sets permissions on files and directories
- Increments the SCU cycle counter
- Sets the system clock to date and time of RTC via MCU
- Clean up left overs from any previous experiments
-
SCU_update
Performs updates of O/S, SCU programs and science profiles- Looks for and applies patches in ${SCU_HOME}/USB_X/TO_SPACE/updates
-
SCU_experiment_main
Performs the science experiment utilizing sensors and actuators of SCU, MCU, and SEU-
Performs next science experiment profile in queue
using charger, shaker, LED lights, ignition, and camera -
Calls SCU_experiment_pre and SCU_experiment_post before and after execution
-
SCU_experiment_pre
Optional custom script run before the main script- Executes commands before SCU_experiment_main starts
-
SCU_experiment_post
Optional custom script run after the main script- Executes commands after SCU_experiment_main completes
-
-
SCU_process_data
Backup experiment data and extract data for transfer via downlink- Processes and selects data to be returned via downlink
- Copies data and log files to USB_A, USB_B, and USB_X flash memory. Files to transfer from ISS back to ground are located in ${SCU_HOME}/USB_X/FROM_SPACE
-
SCU_status_report
Create status report of system and experiment data for downlink- Gathers statistical data of system and science experiment
Tools and libraries
The following tools and low level functions (libraries) are available and used by the scripts:
-
MCU_message
Communicate with MCU- Interfaces with devices controlled by MCU (RTC/charger/shaker/LEDs/ignition)
-
PI_generate_load
Generate load on Raspberry Pi for CPU temperature evaluation and perfomance analysis- Generates definable CPU load by performing calculations
-
SCU_cycle
Reports or increments the SCU cycle number.- Reports current SCU cycle number from SCU_cycle_number.cf
- Increments SCU cycle number in SCU_cycle_number.cf
- Refreshes cycle number from all available sources
- Updates SCU_cycle_increment.log
-
USB_memory
Mounts or unmounts USB flash memory and reports device status.- Mounts or unmounts USB flash memory on ${SCU_HOME}/USB_? mount points
- Discovers and formats USB flash memory
- Reports status of known USB flash memories and file systems
- Synchronizes USB_A und USB_B flash memory
- Exports data from USB_A/USB_B to USB_X for downlink
The following scripts are subject to change: {TODO}
-
RTC_date
Set or read RTC connected to MCU{TODO} setRtc.py
-
Update_RTC
Update RTC of MCU if <CCYYMMDD_hhmmss>_date_time_update.cf is present in folder ${SCU_HOME}/TO_ISS/update using RTC_date{TODO} evaluate_NASA_ISS_time.py
-
Serial_read_cmd
Read from serial port{TODO} readSerialCmd.py - maybe combine serial read and write into one script?
-
Serial_send_cmd
Write to serial port{TODO} sendSerialCmd.py - maybe combine serial read and write into one script?
Science experiment commands
The MLU_* commands (plus SCU_keepalive and SCU_wakeup) may be used in the science experiment profiles: {TODO}
-
MLU_battery
Query battery voltage and capacity from MCU -
MLU_camera
Take still image or video with camera of SEU directly connected to SCU{TODO} mission_cam_cmd.py
-
MLU_capacitor
Charge capacitor or query the current status -
MLU_frame
Return frame status (USB power online|offline, time till next transfer) -
MLU_ignition
Request ignition -
MLU_LED
Control front and back LEDs of SEU via MCU -
MLU_shaker
Control vibration motor of SEU via MCU{TODO} exciss_rappel.py
-
SCU_keepalive
Set or update keepalive timeout of SCU on MCU -
SCU_wakeup
Set or update time to restart SCU on MCU