530 likes | 674 Views
MAVEN Particles and Fields Operational Flight Software Code Walkthrough Instruments 1 (LPW, SEP, MAG) Peter R. Harvey. Agenda. FSW Walkthrough’s Software Architecture Module Overview Modules PWR SSR CMP LPW MAG SEP Other Walkthrough’s Operational Core Completed
E N D
MAVEN • Particles and Fields • Operational Flight Software • Code Walkthrough • Instruments 1 • (LPW, SEP, MAG) • Peter R. Harvey
Agenda • FSW Walkthrough’s • Software Architecture • Module Overview • Modules • PWR • SSR • CMP • LPW • MAG • SEP • Other Walkthrough’s • Operational Core Completed • Instruments #2 (SWEA, SWIA, STATIC) • Fault Protection
Architecture • FSW Modules - Operational Software context diagram showing each subsystem or major component
Architecture • Operational FSW Expanded Upon Boot Boot Operational
Memory Summary (@PSR) Memory has grown a bit or two
Data Processing BKG Interrupts 256 Hz Interrupt Process Distributes CPU Time per Table Basic ¼ second table repeats 4Hz CMD, PWR, HSK get 32 Hz Instruments get 8-16 Hz, etc. Implements module requirements Reconfigurable FSW measures time in each ISR FSW measures total CPU% Design for < 50% usage EXEC Loop - Up to 4 User Programs - Calculations that take > 2 milliseconds (e.g. EEPROM table checksums)
INST Manager Generic Instrument Manager Design (type1) LPW, MAG,SEP controllers Messages received and packets generated under interrupt.
INST Manager Generic Instrument Manager Design (type 2) SWEA, SWIA, STATIC controllers Messages are received under interrupt building data structures Accumulations made in foreground, and telemetry packets generated.
Modes & Enables FSW Modes Safe – Minimal Activities Allowed Normal - FLASH Memory Allowed, HV, Attenuators Engineering – EEPROM Writing Implementation All Enables are Masked by Mode Mask for Safe/Norm/Eng Mode Transitions Have Associated Mode Initialization Script
Module Overview • Generic Module Requirements • “Module_Init”: Initialize Variables and Hardware to Allow all Module Calls to Work • “Module_Cmd”: Handle Commands within one half interrupt period • “Module_Hsk”: Provide Module Housekeeping for Telemetry • Generic Examples // ============================================================ // Loader Initialization // On StartUp, we want to Dump Table[0] (EEPROM directory) // ============================================================ void LD_Init() { DumpAdr = LoadAdr = (long) TableStart[0]; DumpSize = 80; // ~ # Bytes in Table[0] DumpCtr = 255; // # of Dump packets to make } // ============================================================ // Loader Commands // ============================================================ void LD_Cmd(unsigned long cmd) {unsigned int op,dta,tbl,ofs; unsigned char *p; unsigned long dest; op = (int)(cmd>>24)&0x0F; // Op is the Command Option tbl= (int)(cmd>>20)&0x1F; // Table bits for some cmds ofs= (int)(cmd>>8 )&0x0FFF; dta= (int) cmd&0xFF; // Right Byte is Dta switch(op) { case 0: LoadAdr = (cmd>>8)&0xFFFF; // Load Byte p = (unsigned char *) LoadAdr; *p= (unsigned char) dta; break; case 1: DumpAdr = (cmd>>8)&0xFFFF; // Dump Byte(s) DumpSize = dta; DumpCtr = 255; break; // ============================================================ // EXEC Module Housekeeping // This routine formats a string of data storing them using // the input pointer and returns the string length in bytes. // ============================================================ int Read_Exec_Hsk( char *ptr ) {int n; n=0; ptr[n++] = (char) Version ; ptr[n++] = (char) Fgnd1pps ; ptr[n++] = (char) *Mode_Ptr ; ptr[n++] = (char) *Reset_Ptr; ptr[n++] = (char) (*Enable_Ptr>>8); ptr[n++] = (char) *Enable_Ptr ; ptr[n++] = (char) ErrorCode ; ptr[n++] = (char) (ErrorData>>8); ptr[n++] = (char) ErrorData ; ptr[n++] = (char) ErrorCtr ; return( n ); }
PWR Module • PWR Module • Requirements (BOOT) • Can Turn Instruments Off, but Not On • Can Close SEP1, SEP2, EUV Doors but Cannot Open Them • Requirements (OPER) • Can Turn On All instruments and use overrides • Can Directly Fire Actuators • Can Accept Actuators “Requests” and will implement asap • Control EUV Aperture • Control SEP Doors • Prohibit HV to instruments with cover ON • Will Limit Monitor Housekeeping Values • Requirements that Moved • Ramp Instrument HV Moved to SWEA, SWIA and STATIC modules
PWR Actuators Actuator Timing “Allowed” bit refers to the Fault Protection control register
PWR Limits • LIMIT Monitoring • Limit Database: • Up to 128 limit monitor records stored in EEPROM and loaded to SRAM at start up. • Can be disabled by clearing the first byte (Action code) in SRAM. • Each Element Described as 8-byte record:
PWR Limits LIMIT Monitoring
SSR Overview • SOLID STATE RECORDER Management • Requirements • Manage the Non-Volatile Memory (Flash) • Format the Flash into addressable blocks • Implement a Circular Recorder/playback system to store 30 k bps • Keep the power off when possible • Provide packets to TM module • Detailed Design • Handles Variable-size Packets • Routes packets based upon ApID and Table 4 routing information • [0] -> Waste Basket • [1] -> Real-Time Telemetry • [2] -> Archive (Flash) storage • Design changes since SwPDR • Instrument Message to Real-Time Packet Conversion (for EM I&T Tests) • Automatically Adds PAD bytes to achieve 4-byte alignment requirement
Real-Time Data Mgmt RT Data Management
Archive Data Mgmt Archive Data Management
Archive Data Mgmt Archive Data Management
Archive Data Mgmt Archive Data Management
Archive Data Storage FLASH Hardware 8 GB Capacity Each 4GB powered separately EDAC Enabled Write/Read DMA-Channel to/from SRAM Block Addressable 2^16 128KB Blocks Each Block has 2K extra bytes EDAC Bad-Block-Indicator Erase Count Write Time FSW Functions Stores/Retrieves Archive Science Blocks Circular Memory with Separate Read & Write Ptrs Playback Commanded by Block Number and Length Both Read/Write Block pointers Telemetered Ground S/W keeps Time-to-Block Number relationship FMAP of 256 provides 32 MB control FSW_020_ANALYSES.XLS FMAP : FLASH Virtual-to-Physical Memory Map
SSR FLASH Logic Read/Write/Diag Decision State D0
SSR FLASH Logic Read Logic States with Error Handling
SSR FLASH Logic Write Logic State W1 with Error Handling
SSR FLASH Logic Write Logic State W2 with Error Handling
Compression • CMP • Requirements (OPER) • Enable/Disable/Option by APID • Provide Log-Compression Count Rate Compression • 19-to-8 bit (and 3 more options) • Performed at Initial Packet Formatting • Provide “Space Particle Data Compression” (dwc’s paper) • Provide Compression on Survey and Archive data • Provide Archive compression at Downlink Time
Data Collection • Data Collection • DMA Channels are Assigned to Each Data Instrument • FSW Writes Destination Addresses into Each DMA Controller • DMA Registers are Double-Buffered to Eliminate Gaps • DMA Buffers Automatically Swap at 1 second • FSW Modules Process Messages Using Inst. Msg Headers • Data Collection Rates • Max Raw Input Rate of ~153 KB/sec (1.2 Mbps) • Vast Majority are Summing Counts
LPW Manager • LPW Management • Requirements Summary • // FSW.LPW-1 : LPW_INIT shall initialize the module and define its hardware • // initial state so the module works correctly. • // FSW.LPW-2 : LPW shall receive and execute commands to the module at up to • // 32Hz, and complete those commands in <1/10 interrupt period. • // FSW.LPW-3 : LPW shall provide housekeeping telemetry as defined in MAVEN • // PF Command/Telemetry document (N/A) • // FSW.LPW-4 : PFP FSW shall automatically download LPW configuration tables • // and set the default mode • // [a] when LPW is turned ON; • // [b] when LPW is RESET; or • // [c] when LPW fails a checksum. • // FSW.LPW-5 : PFP FSW shall control LPW Configuration Tables • // [a] providing 512 bytes per table; • // [b] providing 16 tables; • // [c] providing the ability to upload new tables. • // FSW.LPW-6 : PFP FSW shall route LPW/EUV commands from the spacecraft to • // the LPW/EUV instrument via the CDI. • // FSW.LPW-7 : PFP FSW shall provide LPW the time of the next PF 1PPS pulse. • // FSW.LPW-8 : PFP FSW shall provide a commandable periodic synchronization • // command to LPW. • Notes: • LPW-3 : FSW just passes LPW housekeeping to telemetry • LPW-4 : In a checksum mismatch, FSW restarts LPW. • LPW-7&8 are redundant as Time is the sync
LPW Messages LPW Messages Message Code Message Length CCSDS packet Packet Length (quad word multiple)
LPW Memory Instrument DMA Memory
LPW EEPROM LPW EEPROM Memory
LPW RTS LPW Relative Time Sequences RTS_LPWLOW RTS=[ "cmd.PFP_LPWTM(0)", # Rate low "cmd.RTSEND()" # RTS END command ] RTS_LPWMED RTS=[ "cmd.PFP_LPWTM(1)", # Rate medium "cmd.RTSEND()" # RTS END command ] RTS_LPWHIGH RTS=[ "cmd.PFP_LPWTM(2)", # TM Rate High "cmd.RTSEND()" # RTS END command ] RTS_LPWSTART RTS=[ "cmd.LPW_RESET()", # Reset the FPGA "cmd.PFP_RTSWAIT(4)", # Delay(1 second) "cmd.PFP_LPWLDLUT()", # Start Loading Regs&Lut "cmd.PFP_RTSWAIT(240)", # Delay(60 seconds) "cmd.PFP_RTSSTART(35)", # Start in low bit rate "cmd.RTSEND()" # RTS END command ]
LPW LM LPW Limit Monitors
LPW-EUV FP • IsEUVOpen() • FSW reads the 2-bit status of the EUV Ap • Compares that to the Open & not-Closed condition. • IsEUVAllowed() • If either “Boresightin RAM” or “Density High” ZoneAlerts, then EUV Aper is not allowed. • If user Enable is low, EUV Aper is not allowed. • ManEUVAper() • If open but not allowed, this routine starts RTS (5) • If closed but allowed, this routine starts RTS(11) • Does not matter whether LPW/EUV power is On or Off
LPW-EUV FP LPW Fault Protection """ RTS_OPENEUV.py (RTS 11) This Python module defines a dictionary that contains the commands for RTS 11. """ # Built-in Python Modules # Import statements. Always do these. from MAVEN import * from __main__ import * import maven_log log = maven_log.log() # Setup the commanding shortcut mechanism (cmd.CMDNAME(arg=value)) cmd = maven_cmd() # RTS Command List # ================ # RTS=[ "cmd.PFP_ACTMOVE(11)", # OPen EUV "cmd.RTSEND()" # RTS END command ] """ RTS_SHUTEUV.py (RTS 5) This Python module defines a dictionary that contains the commands for RTS 5. """ # Built-in Python Modules # Import statements. Always do these. from MAVEN import * from __main__ import * import maven_log log = maven_log.log() # Setup the commanding shortcut mechanism (cmd.CMDNAME(arg=value)) cmd = maven_cmd() # RTS Command List # ================ # RTS=[ "cmd.PFP_ACTMOVE(12)", # Request the EUV close "cmd.RTSEND()" # RTS END command" ]
SEP Manager SEP Management Requirements Summary // FSW.SEP-1 : SEP_INIT shall initialize the module and define its hardware initial // state so the module works correctly. // FSW.SEP-2 : SEP shall receive and execute commands to the module at up to 32Hz, // and complete those commands in <1/10 interrupt period. // FSW.SEP-3 : SEP shall provide housekeeping telemetry as defined in MAVEN PF // Command/Telemetry document // FSW.SEP-4 : PFP FSW shall load a selected SEP Instrument Energy LUT // [a] from non-volatile memory into the instrument; // [b] automatically on power-up; // [c] by ground command, and // [d] when the SEP FPGA checksum fails. // FSW.SEP-5 : PFP FSW shall provide the commanded SEP bias voltage in parameter table // FSW.SEP-6 : PFP FSW shall provide the commanded SEP threshold DAC values in the // parameter table. // FSW.SEP-7 : PFP FSW logic shall control the two SEP SMA attenuators separately // [a] when SEP atten logic is enabled; // [b] when SEP counting rates // i. exceed a programmable threshold1, move the attenuator IN; // ii. fall below programmable threshold2, move the attenuator OUT; // [c] when the attenuator is not IN because of Sun Safing; // [d] including the attenuator positions in all SEP telemetry products; // FSW.SEP-8 : Moved to HSK-5 // FSW.SEP-9 : PFP FSW shall generate Spectra Telemetry // [a] by summing the raw spectra for each detector over the // programmable accumulation interval; // [b] providing separate accumulations for Survey and Archive data // with separate accumulation intervals; // [c] telemetering the first N bins of the Survey and Archive // histograms, where N is programmable up to 256. // FSW.SEP-10 : **DELETED** Rates Telemetry // FSW.SEP-11 : PFP FSW shall generate Configuration Telemetry // [a] copying SEP configuration data to SEP HSK packets at a low duty cycle; // [b] when commanded. // FSW.SEP-12 : PFP FSW shall collect housekeeping data // [a] including noise; // [b] providing these data in packets.
SEP EEPROM LPW EEPROM Memory
SEP Hsk APID 2B, 2C
SEP Hsk APID 2B, 2C (SEP1, SEP2) Tables 22,23
SEP LM SEP Limit Monitors
IsSEP1 Allowed() SEP1 FOV1 in Sun? Yes Return( 0 ) Zone[1]=1? No SEP1 FOV2 in Sun? Yes Return( 0 ) Zone[2]=1? No User Enabled ? No Return( 0 ) Enable[1]=1? Yes If no SEP1 comm No Return( 0 ) Is Task[12] > Limit? Yes Low BiasMon => Sun Yes Return( 0 ) BiasMon > "-0.2V" OK, its allowed No Return( 1 ) SEP FP • IsSEP1Open() • FSW Selects SEP1 Door status and directly reads its status. • IsSEP1Allowed() • If either “SEP1 FOV1” or “SEP1 FOV2” ZoneAlerts, then SEP1 Door is not allowed. • If user Enable is low, SEP1 Door is not allowed. • ManSEP1Door() • If open but not allowed, this routine starts RTS[6], SEP1 Door Closure. • If closed but allowed, this routine starts RTS(11), SEP1 Door Open • If SEP is off, doors will close as a result. • Identical logic used in SEP2
MAG Manager MAG Management Requirements Summary // FSW.MAG-1 : MAG_INIT shall initialize the module and define its hardware // initial state so the module works correctly.. // FSW.MAG-2 : MAG shall receive and execute commands to the module at up to // 32Hz, and complete those commands in <1/10 interrupt period. // FSW.MAG-3 : MAG shall provide housekeeping telemetry as defined in MAVEN // PF Command/Telemetry document // FSW.MAG-4 : PFP FSW shall generate MAG Sample Telemetry from MAG raw samples // [a] by averaging 2**N raw samples together (1 to 32). // [b] Averages are done separately for X,Y,Z axes ; // [c] X,Y,Z samples shall be included in the same packet; // [d] Separate packets with separate averaging intervals // shall be made for each of the two mags; // [e] Separate packets with separate averaging intervals shall // be made for Survey and Archive data. // FSW.MAG-7 : PFP FSW shall monitor the MAG instrument range. // FSW.MAG-8 : PFP FSW will generate a MAG vector // [a] once per second // [b] as the average of the raw measurements from the selected // MAG sensors over the previous second, minus an offset vector // uplinked from the ground; // [c] using separate offset vectors for each range setting. Notes: RMS calculation was removed
MAG Housekeeping APID 26-27
MAG Housekeeping APID 26-27 Tables 16,17
MAG Telemetry APID 40-43 (Mag1/2, Survey/Archive, Uncompressed) * : Time contained in F0-F3 registers.
MAG Telemetry APID 40-43 Raw & “MAG” Compressed Packetization * : MAG Packets have a special compression format.