MPSoC Overhaul #296

Merged
muellerr merged 18 commits from mpsoc-overhaul into main 2024-05-06 14:18:04 +02:00
7 changed files with 160 additions and 119 deletions

View File

@ -10,6 +10,10 @@ list yields a list of all related PRs for each release.
# [unreleased]
# [v7.0.0] 2024-04-25
- Reworked PLOC MPSoC commanding to be inline with OBSW update.
## Fixed
- GNSS commands working again (again).

View File

@ -128,14 +128,15 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
11506;0x2cf2;DEPL_SA1_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h
11507;0x2cf3;DEPL_SA2_GPIO_SWTICH_OFF_FAILED;HIGH;No description;mission/SolarArrayDeploymentHandler.h
11508;0x2cf4;AUTONOMOUS_DEPLOYMENT_COMPLETED;INFO;No description;mission/SolarArrayDeploymentHandler.h
11601;0x2d51;MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC crc failure in telemetry packet;linux/payload/PlocMpsocHandler.h
11602;0x2d52;ACK_FAILURE;LOW;PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/PlocMpsocHandler.h
11603;0x2d53;EXE_FAILURE;LOW;PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/PlocMpsocHandler.h
11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/payload/PlocMpsocHandler.h
11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/payload/PlocMpsocHandler.h
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/payload/PlocMpsocHandler.h
11607;0x2d57;SUPV_NOT_ON;LOW;SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition.;linux/payload/PlocMpsocHandler.h
11608;0x2d58;SUPV_REPLY_TIMEOUT;LOW;No description;linux/payload/PlocMpsocHandler.h
11601;0x2d51;MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC crc failure in telemetry packet;linux/payload/plocMpsocHelpers.h
11602;0x2d52;ACK_FAILURE;LOW;PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/plocMpsocHelpers.h
11603;0x2d53;EXE_FAILURE;LOW;PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field;linux/payload/plocMpsocHelpers.h
11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/payload/plocMpsocHelpers.h
11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/payload/plocMpsocHelpers.h
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/payload/plocMpsocHelpers.h
11607;0x2d57;SUPV_NOT_ON;LOW;SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition.;linux/payload/plocMpsocHelpers.h
11608;0x2d58;SUPV_REPLY_TIMEOUT;LOW;SUPV reply timeout.;linux/payload/plocMpsocHelpers.h
11609;0x2d59;CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE;LOW;Camera must be commanded on first.;linux/payload/plocMpsocHelpers.h
11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
128 11506 0x2cf2 DEPL_SA1_GPIO_SWTICH_OFF_FAILED HIGH No description mission/SolarArrayDeploymentHandler.h
129 11507 0x2cf3 DEPL_SA2_GPIO_SWTICH_OFF_FAILED HIGH No description mission/SolarArrayDeploymentHandler.h
130 11508 0x2cf4 AUTONOMOUS_DEPLOYMENT_COMPLETED INFO No description mission/SolarArrayDeploymentHandler.h
131 11601 0x2d51 MEMORY_READ_RPT_CRC_FAILURE LOW PLOC crc failure in telemetry packet linux/payload/PlocMpsocHandler.h linux/payload/plocMpsocHelpers.h
132 11602 0x2d52 ACK_FAILURE LOW PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field linux/payload/PlocMpsocHandler.h linux/payload/plocMpsocHelpers.h
133 11603 0x2d53 EXE_FAILURE LOW PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field linux/payload/PlocMpsocHandler.h linux/payload/plocMpsocHelpers.h
134 11604 0x2d54 MPSOC_HANDLER_CRC_FAILURE LOW PLOC reply has invalid crc linux/payload/PlocMpsocHandler.h linux/payload/plocMpsocHelpers.h
135 11605 0x2d55 MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH LOW Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count linux/payload/PlocMpsocHandler.h linux/payload/plocMpsocHelpers.h
136 11606 0x2d56 MPSOC_SHUTDOWN_FAILED HIGH Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor. linux/payload/PlocMpsocHandler.h linux/payload/plocMpsocHelpers.h
137 11607 0x2d57 SUPV_NOT_ON LOW SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition. linux/payload/PlocMpsocHandler.h linux/payload/plocMpsocHelpers.h
138 11608 0x2d58 SUPV_REPLY_TIMEOUT LOW No description SUPV reply timeout. linux/payload/PlocMpsocHandler.h linux/payload/plocMpsocHelpers.h
139 11609 0x2d59 CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE LOW Camera must be commanded on first. linux/payload/plocMpsocHelpers.h
140 11701 0x2db5 SELF_TEST_I2C_FAILURE LOW Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/acs/ImtqHandler.h
141 11702 0x2db6 SELF_TEST_SPI_FAILURE LOW Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/acs/ImtqHandler.h
142 11703 0x2db7 SELF_TEST_ADC_FAILURE LOW Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA mission/acs/ImtqHandler.h

View File

@ -56,6 +56,7 @@
0x44330015;PLOC_MPSOC_HANDLER
0x44330016;PLOC_SUPERVISOR_HANDLER
0x44330017;PLOC_SUPERVISOR_HELPER
0x44330018;PLOC_MPSOC_COMMUNICATION
0x44330032;SCEX
0x444100A2;SOLAR_ARRAY_DEPL_HANDLER
0x444100A4;HEATER_HANDLER

1 0x00005060 P60DOCK_TEST_TASK
56 0x44330015 PLOC_MPSOC_HANDLER
57 0x44330016 PLOC_SUPERVISOR_HANDLER
58 0x44330017 PLOC_SUPERVISOR_HELPER
59 0x44330018 PLOC_MPSOC_COMMUNICATION
60 0x44330032 SCEX
61 0x444100A2 SOLAR_ARRAY_DEPL_HANDLER
62 0x444100A4 HEATER_HANDLER

View File

@ -561,16 +561,17 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x67a2;SADPL_MainSwitchTimeoutFailure;No description;162;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
0x67a3;SADPL_SwitchingDeplSa1Failed;No description;163;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
0x67a4;SADPL_SwitchingDeplSa2Failed;No description;164;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
0x68a0;MPSOCRTVIF_CrcFailure;Space Packet received from PLOC has invalid CRC;160;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a1;MPSOCRTVIF_ReceivedAckFailure;Received ACK failure reply from PLOC;161;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a2;MPSOCRTVIF_ReceivedExeFailure;Received execution failure reply from PLOC;162;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a3;MPSOCRTVIF_InvalidApid;Received space packet with invalid APID from PLOC;163;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a4;MPSOCRTVIF_InvalidLength;Received command with invalid length;164;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a5;MPSOCRTVIF_FilenameTooLong;Filename of file in OBC filesystem is too long;165;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a6;MPSOCRTVIF_MpsocHelperExecuting;MPSoC helper is currently executing a command;166;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a7;MPSOCRTVIF_MpsocFilenameTooLong;Filename of MPSoC file is to long (max. 256 bytes);167;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a8;MPSOCRTVIF_InvalidParameter;Command has invalid parameter;168;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x68a9;MPSOCRTVIF_NameTooLong;Received command has file string with invalid length;169;MPSOC_RETURN_VALUES_IF;linux/payload/mpsocRetvals.h
0x6810;MPSOCRTVIF_CommandTimeout;Command has timed out.;16;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
0x68a0;MPSOCRTVIF_CrcFailure;Space Packet received from PLOC has invalid CRC;160;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
0x68a1;MPSOCRTVIF_ReceivedAckFailure;Received ACK failure reply from PLOC;161;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
0x68a2;MPSOCRTVIF_ReceivedExeFailure;Received execution failure reply from PLOC;162;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
0x68a3;MPSOCRTVIF_InvalidApid;Received space packet with invalid APID from PLOC;163;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
0x68a4;MPSOCRTVIF_InvalidLength;Received command with invalid length;164;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
0x68a5;MPSOCRTVIF_FilenameTooLong;Filename of file in OBC filesystem is too long;165;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
0x68a6;MPSOCRTVIF_MpsocHelperExecuting;MPSoC helper is currently executing a command;166;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
0x68a7;MPSOCRTVIF_MpsocFilenameTooLong;Filename of MPSoC file is to long (max. 256 bytes);167;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
0x68a8;MPSOCRTVIF_InvalidParameter;Command has invalid parameter;168;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
0x68a9;MPSOCRTVIF_NameTooLong;Received command has file string with invalid length;169;MPSOC_RETURN_VALUES_IF;linux/payload/plocMpsocHelpers.h
0x69a0;SPVRTVIF_CrcFailure;Space Packet received from PLOC supervisor has invalid CRC;160;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h
0x69a1;SPVRTVIF_InvalidServiceId;No description;161;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h
0x69a2;SPVRTVIF_ReceivedAckFailure;Received ACK failure reply from PLOC supervisor;162;SUPV_RETURN_VALUES_IF;linux/payload/plocSupvDefs.h
@ -626,4 +627,7 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x6f02;TMS_NoWriteActive;No description;2;TM_SINK;mission/tmtc/DirectTmSinkIF.h
0x6f03;TMS_Timeout;No description;3;TM_SINK;mission/tmtc/DirectTmSinkIF.h
0x7000;VCS_ChannelDoesNotExist;No description;0;VIRTUAL_CHANNEL;mission/com/VirtualChannel.h
0x7200;SCBU_KeyNotFound;No description;0;SCRATCH_BUFFER;bsp_q7s/memory/scratchApi.h
0x7100;PLMPCOM_PacketReceived;No description;0;PLOC_MPSOC_COM;linux/payload/MpsocCommunication.h
0x7101;PLMPCOM_FaultyPacketSize;No description;1;PLOC_MPSOC_COM;linux/payload/MpsocCommunication.h
0x7102;PLMPCOM_CrcCheckFailed;No description;2;PLOC_MPSOC_COM;linux/payload/MpsocCommunication.h
0x7300;SCBU_KeyNotFound;No description;0;SCRATCH_BUFFER;bsp_q7s/memory/scratchApi.h

1 Full ID (hex) Name Description Unique ID Subsytem Name File Path
561 0x67a2 SADPL_MainSwitchTimeoutFailure No description 162 SA_DEPL_HANDLER mission/SolarArrayDeploymentHandler.h
562 0x67a3 SADPL_SwitchingDeplSa1Failed No description 163 SA_DEPL_HANDLER mission/SolarArrayDeploymentHandler.h
563 0x67a4 SADPL_SwitchingDeplSa2Failed No description 164 SA_DEPL_HANDLER mission/SolarArrayDeploymentHandler.h
564 0x68a0 0x6810 MPSOCRTVIF_CrcFailure MPSOCRTVIF_CommandTimeout Space Packet received from PLOC has invalid CRC Command has timed out. 160 16 MPSOC_RETURN_VALUES_IF linux/payload/mpsocRetvals.h linux/payload/plocMpsocHelpers.h
565 0x68a1 0x68a0 MPSOCRTVIF_ReceivedAckFailure MPSOCRTVIF_CrcFailure Received ACK failure reply from PLOC Space Packet received from PLOC has invalid CRC 161 160 MPSOC_RETURN_VALUES_IF linux/payload/mpsocRetvals.h linux/payload/plocMpsocHelpers.h
566 0x68a2 0x68a1 MPSOCRTVIF_ReceivedExeFailure MPSOCRTVIF_ReceivedAckFailure Received execution failure reply from PLOC Received ACK failure reply from PLOC 162 161 MPSOC_RETURN_VALUES_IF linux/payload/mpsocRetvals.h linux/payload/plocMpsocHelpers.h
567 0x68a3 0x68a2 MPSOCRTVIF_InvalidApid MPSOCRTVIF_ReceivedExeFailure Received space packet with invalid APID from PLOC Received execution failure reply from PLOC 163 162 MPSOC_RETURN_VALUES_IF linux/payload/mpsocRetvals.h linux/payload/plocMpsocHelpers.h
568 0x68a4 0x68a3 MPSOCRTVIF_InvalidLength MPSOCRTVIF_InvalidApid Received command with invalid length Received space packet with invalid APID from PLOC 164 163 MPSOC_RETURN_VALUES_IF linux/payload/mpsocRetvals.h linux/payload/plocMpsocHelpers.h
569 0x68a5 0x68a4 MPSOCRTVIF_FilenameTooLong MPSOCRTVIF_InvalidLength Filename of file in OBC filesystem is too long Received command with invalid length 165 164 MPSOC_RETURN_VALUES_IF linux/payload/mpsocRetvals.h linux/payload/plocMpsocHelpers.h
570 0x68a6 0x68a5 MPSOCRTVIF_MpsocHelperExecuting MPSOCRTVIF_FilenameTooLong MPSoC helper is currently executing a command Filename of file in OBC filesystem is too long 166 165 MPSOC_RETURN_VALUES_IF linux/payload/mpsocRetvals.h linux/payload/plocMpsocHelpers.h
571 0x68a7 0x68a6 MPSOCRTVIF_MpsocFilenameTooLong MPSOCRTVIF_MpsocHelperExecuting Filename of MPSoC file is to long (max. 256 bytes) MPSoC helper is currently executing a command 167 166 MPSOC_RETURN_VALUES_IF linux/payload/mpsocRetvals.h linux/payload/plocMpsocHelpers.h
572 0x68a8 0x68a7 MPSOCRTVIF_InvalidParameter MPSOCRTVIF_MpsocFilenameTooLong Command has invalid parameter Filename of MPSoC file is to long (max. 256 bytes) 168 167 MPSOC_RETURN_VALUES_IF linux/payload/mpsocRetvals.h linux/payload/plocMpsocHelpers.h
573 0x68a9 0x68a8 MPSOCRTVIF_NameTooLong MPSOCRTVIF_InvalidParameter Received command has file string with invalid length Command has invalid parameter 169 168 MPSOC_RETURN_VALUES_IF linux/payload/mpsocRetvals.h linux/payload/plocMpsocHelpers.h
574 0x68a9 MPSOCRTVIF_NameTooLong Received command has file string with invalid length 169 MPSOC_RETURN_VALUES_IF linux/payload/plocMpsocHelpers.h
575 0x69a0 SPVRTVIF_CrcFailure Space Packet received from PLOC supervisor has invalid CRC 160 SUPV_RETURN_VALUES_IF linux/payload/plocSupvDefs.h
576 0x69a1 SPVRTVIF_InvalidServiceId No description 161 SUPV_RETURN_VALUES_IF linux/payload/plocSupvDefs.h
577 0x69a2 SPVRTVIF_ReceivedAckFailure Received ACK failure reply from PLOC supervisor 162 SUPV_RETURN_VALUES_IF linux/payload/plocSupvDefs.h
627 0x6f02 TMS_NoWriteActive No description 2 TM_SINK mission/tmtc/DirectTmSinkIF.h
628 0x6f03 TMS_Timeout No description 3 TM_SINK mission/tmtc/DirectTmSinkIF.h
629 0x7000 VCS_ChannelDoesNotExist No description 0 VIRTUAL_CHANNEL mission/com/VirtualChannel.h
630 0x7200 0x7100 SCBU_KeyNotFound PLMPCOM_PacketReceived No description 0 SCRATCH_BUFFER PLOC_MPSOC_COM bsp_q7s/memory/scratchApi.h linux/payload/MpsocCommunication.h
631 0x7101 PLMPCOM_FaultyPacketSize No description 1 PLOC_MPSOC_COM linux/payload/MpsocCommunication.h
632 0x7102 PLMPCOM_CrcCheckFailed No description 2 PLOC_MPSOC_COM linux/payload/MpsocCommunication.h
633 0x7300 SCBU_KeyNotFound No description 0 SCRATCH_BUFFER bsp_q7s/memory/scratchApi.h

View File

@ -11,19 +11,15 @@ import logging
import struct
import enum
from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.config.object_ids import get_object_ids, PLOC_MPSOC_ID
from eive_tmtc.pus_tm.defs import PrintWrapper
from tmtccmd.config.tmtc import (
CmdTreeNode,
tmtc_definitions_provider,
OpCodeEntry,
TmtcDefinitionWrapper,
)
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tmtc import DefaultPusQueueHelper
from eive_tmtc.utility.input_helper import InputHelper
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode, create_mode_command
from tmtccmd.pus.s20_fsfw_param import create_load_param_cmd, create_scalar_u8_parameter
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
@ -31,6 +27,8 @@ _LOGGER = logging.getLogger(__name__)
MANUAL_INPUT = "1"
CRIT_CMD_APID_DICT = {"1": ("flash_mkfs", 0x12A)}
OBC_WRITE_FILE_DICT = {
MANUAL_INPUT: ("manual input", ""),
"2": ("/mnt/sd0/ploc/mpsoc/flash_write.bin", "/mnt/sd0/ploc/mpsoc/flash_write.bin"),
@ -86,12 +84,22 @@ class ActionId(enum.IntEnum):
SET_UART_TX_TRISTATE = 20
RELEASE_UART_TX = 21
TC_CAM_TAKE_PIC = 22
TC_SIMPLEX_SEND_FILE = 23
TC_SIMPLEX_STREAM_FILE = 23
TC_DOWNLINK_DATA_MODULATE = 24
TC_MODE_SNAPSHOT = 25
TC_FLASH_DIR_GET_CONTENT = 28
TM_FLASH_DIRECTORY_CONTENT = 29
TC_FLASH_READ_FULL_FILE = 30
TC_SPLIT_FILE = 31
TC_VERIFY_BOOT = 32
TC_ENABLE_TC_EXECUTION = 33
TC_FLASH_MKFS = 34
class Submode(enum.IntEnum):
IDLE_OR_NONE = 0
REPLAY = 1
SNAPSHOT = 2
class ParamId(enum.IntEnum):
@ -103,8 +111,6 @@ class OpCode:
OFF = "off"
NORMAL = "normal"
VERIFY_BOOT = "verify_boot"
MODE_REPLAY = "mode_replay"
MODE_IDLE = "mode_idle"
REPLAY_WRITE_SEQ = "replay_write"
DOWNLINK_PWR_ON = "downlink_pwr_on"
MEM_WRITE = "memory_write"
@ -116,12 +122,18 @@ class OpCode:
FLASH_GET_DIR_CONTENT = "flash_get_dir_content"
REPLAY_STOP = "replay_stop"
REPLAY_START = "replay_start"
CAM_CMD_SEND = "cam_cmd_send"
CAM_TAKE_PIC = "cam_take_pic"
SIMPLEX_SEND_FILE = "simplex_send_file"
SIMPLEX_STREAM_FILE = "simplex_stream_file"
SPLIT_FILE = "split_file"
DOWNLINK_DATA_MODULATE = "downlink_data_modulate"
MODE_SNAPSHOT = "mode_snapshot"
ENABLE_PLOC_SUPV_COMMANDING_TO_ON = "enable_ploc_supv_cmd_to_on"
DISABLE_PLOC_SUPV_COMMANDING_TO_ON = "disable_ploc_supv_cmd_to_on"
MODE_IDLE = "mode_idle"
MODE_REPLAY = "mode_replay"
MODE_SNAPSHOT = "mode_snapshot"
ENABLE_TC_EXECUTION = "enable_tc_exec"
FLASH_MKFS = "flash_mkfs"
class Info:
@ -139,7 +151,9 @@ class Info:
MEM_READ = "Read from Memory"
REPLAY_START = "Replay Start"
CAM_TAKE_PIC = "Cam Take Picture"
SIMPLEX_SEND_FILE = "Simplex Send File"
CAM_CMD_SEND = "Send Camera Command"
SIMPLEX_STREAM_FILE = "Simplex Stream File with E-Band"
SPLIT_FILE = "Split file on MPSoC Flash"
FLASH_READ_FILE = "Copy file from MPSoC to OBC"
FLASH_WRITE_FILE = "Copy file from OBC to MPSoC"
FLASH_DELETE_FILE = "Delete file on MPSoC"
@ -150,6 +164,8 @@ class Info:
DISABLE_PLOC_SUPV_COMMANDING_TO_ON = (
"Disable PLOC SUPV commanding when switching ON"
)
ENABLE_TC_EXECUTION = "Enable execution of critical commands"
FLASH_MKFS = "Flash MKFS command"
class MemAddresses(enum.IntEnum):
@ -168,45 +184,6 @@ def create_ploc_mpsoc_node() -> CmdTreeNode:
return node
# Legacy command definitions.
@tmtc_definitions_provider
def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(OpCode.OFF, Info.OFF)
oce.add(OpCode.ON, Info.ON)
oce.add(OpCode.NORMAL, Info.NORMAL)
oce.add(OpCode.MEM_WRITE, "Ploc MPSoC: Memory write")
oce.add(OpCode.MEM_READ, "Ploc MPSoC: Memory read")
oce.add(OpCode.FLASH_WRITE_FILE, Info.FLASH_WRITE_FILE)
oce.add(OpCode.FLASH_READ_FILE, Info.FLASH_READ_FILE)
oce.add(OpCode.FLASH_DELETE_FILE, Info.FLASH_DELETE_FILE)
oce.add(OpCode.FLASH_GET_DIR_CONTENT, Info.FLASH_GET_DIR_CONTENT)
oce.add(OpCode.REPLAY_START, Info.REPLAY_START)
oce.add(OpCode.REPLAY_STOP, Info.REPLAY_STOP)
oce.add(OpCode.DOWNLINK_PWR_ON, Info.DOWNLINK_PWR_ON)
oce.add(OpCode.DOWNLINK_PWR_OFF, Info.DOWNLINK_PWR_OFF)
oce.add(OpCode.REPLAY_WRITE_SEQ, Info.REPLAY_WRITE_SEQ)
oce.add("12", "Ploc MPSoC: OBSW reset sequence count")
oce.add(OpCode.VERIFY_BOOT, Info.VERIFY_BOOT)
oce.add(OpCode.MODE_REPLAY, Info.MODE_REPLAY)
oce.add(OpCode.MODE_IDLE, Info.MODE_IDLE)
oce.add("16", "Ploc MPSoC: Tc cam command send")
oce.add("17", "Ploc MPSoC: Set UART TX tristate")
oce.add("18", "Ploc MPSoC: Relesase UART TX")
oce.add(OpCode.CAM_TAKE_PIC, Info.CAM_TAKE_PIC)
oce.add(OpCode.SIMPLEX_SEND_FILE, Info.SIMPLEX_SEND_FILE)
oce.add(OpCode.DOWNLINK_DATA_MODULATE, Info.DOWNLINK_DATA_MODULATE)
oce.add(OpCode.MODE_SNAPSHOT, Info.MODE_SNAPSHOT)
oce.add(
OpCode.ENABLE_PLOC_SUPV_COMMANDING_TO_ON, Info.ENABLE_PLOC_SUPV_COMMANDING_TO_ON
)
oce.add(
OpCode.DISABLE_PLOC_SUPV_COMMANDING_TO_ON,
Info.DISABLE_PLOC_SUPV_COMMANDING_TO_ON,
)
defs.add_service(CustomServiceList.PLOC_MPSOC.value, "Ploc MPSoC", oce)
def pack_ploc_mpsoc_commands(
q: DefaultPusQueueHelper, cmd_str: str
): # noqa C901: Complexity okay here.
@ -290,25 +267,11 @@ def pack_ploc_mpsoc_commands(
data = object_id.as_bytes + struct.pack("!I", ActionId.OBSW_RESET_SEQ_COUNT)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCode.VERIFY_BOOT:
num_words = 1
q.add_log_cmd(f"{prefix} {Info.VERIFY_BOOT}")
data = (
object_id.as_bytes
+ struct.pack("!I", ActionId.TC_MEM_READ)
+ struct.pack("!I", MemAddresses.DEADBEEF)
+ struct.pack("!H", num_words)
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCode.MODE_REPLAY:
q.add_log_cmd("PLOC MPSoC: Tc mode replay")
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_MODE_REPLAY)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCode.MODE_IDLE:
q.add_log_cmd("PLOC MPSoC: Tc mode idle")
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_MODE_IDLE)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == "16":
q.add_log_cmd("PLOC MPSoC: Tc cam command send")
app_data = object_id.as_bytes + struct.pack("!I", ActionId.TC_VERIFY_BOOT)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=app_data))
if cmd_str == OpCode.CAM_CMD_SEND:
q.add_log_cmd(Info.CAM_CMD_SEND)
cam_cmd = input("Specify cam command string: ")
data = (
object_id.as_bytes
@ -316,6 +279,44 @@ def pack_ploc_mpsoc_commands(
+ bytearray(cam_cmd, "utf-8")
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCode.ENABLE_TC_EXECUTION:
q.add_log_cmd(Info.ENABLE_TC_EXECUTION)
while True:
for key, val in CRIT_CMD_APID_DICT.items():
print(f"{key}: {val[0]} with APID {val[1]}")
key = input("Please specify the command to enable by key: ")
if key not in CRIT_CMD_APID_DICT:
print("invalid key")
continue
apid = CRIT_CMD_APID_DICT[key][1]
break
app_data = struct.pack("!H", apid)
q.add_pus_tc(
create_action_cmd(PLOC_MPSOC_ID, ActionId.TC_ENABLE_TC_EXECUTION, app_data)
)
if cmd_str == OpCode.FLASH_MKFS:
q.add_log_cmd(Info.FLASH_MKFS)
while True:
flash_select = int(input("Please select the flash ID (0 or 1): "))
if flash_select != 0 and flash_select != 1:
_LOGGER.warn("invalid flash select")
continue
break
q.add_pus_tc(
create_action_cmd(
PLOC_MPSOC_ID, ActionId.TC_FLASH_MKFS, bytes([flash_select])
)
)
if cmd_str == OpCode.SPLIT_FILE:
q.add_log_cmd(Info.SPLIT_FILE)
q.add_pus_tc(
create_action_cmd(
PLOC_MPSOC_ID,
ActionId.TC_SPLIT_FILE,
user_data=prepare_simplex_store_file_user_data(),
)
)
if cmd_str == "17":
q.add_log_cmd("PLOC MPSoC: Set UART TX tristate")
data = object_id.as_bytes + struct.pack("!I", ActionId.SET_UART_TX_TRISTATE)
@ -328,18 +329,30 @@ def pack_ploc_mpsoc_commands(
q.add_log_cmd("PLOC MPSoC: Cam take picture")
data = prepare_cam_take_pic_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCode.SIMPLEX_SEND_FILE:
q.add_log_cmd("PLOC MPSoC: Simplex send file")
data = prepare_simplex_send_file_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCode.SIMPLEX_STREAM_FILE:
q.add_log_cmd(Info.SIMPLEX_STREAM_FILE)
data = prepare_simplex_stream_file_user_data()
q.add_pus_tc(
create_action_cmd(
PLOC_MPSOC_ID, ActionId.TC_SIMPLEX_STREAM_FILE, user_data=data
)
)
if cmd_str == OpCode.DOWNLINK_DATA_MODULATE:
q.add_log_cmd("PLOC MPSoC: Downlink data modulate")
data = prepare_downlink_data_modulate_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCode.MODE_SNAPSHOT:
q.add_log_cmd("PLOC MPSoC: Mode snapshot")
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_MODE_SNAPSHOT)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
q.add_log_cmd(Info.MODE_SNAPSHOT)
mode = prompt_mode_for_submode_change()
q.add_pus_tc(create_mode_command(PLOC_MPSOC_ID, mode, Submode.SNAPSHOT))
if cmd_str == OpCode.MODE_IDLE:
q.add_log_cmd(Info.MODE_IDLE)
mode = prompt_mode_for_submode_change()
q.add_pus_tc(create_mode_command(PLOC_MPSOC_ID, mode, Submode.IDLE_OR_NONE))
if cmd_str == OpCode.MODE_REPLAY:
q.add_log_cmd(Info.MODE_REPLAY)
mode = prompt_mode_for_submode_change()
q.add_pus_tc(create_mode_command(PLOC_MPSOC_ID, mode, Submode.REPLAY))
if cmd_str == OpCode.ENABLE_PLOC_SUPV_COMMANDING_TO_ON:
q.add_log_cmd(Info.ENABLE_PLOC_SUPV_COMMANDING_TO_ON)
q.add_pus_tc(
@ -360,6 +373,20 @@ def pack_ploc_mpsoc_commands(
)
def prompt_mode_for_submode_change() -> int:
while True:
mode = input("Please specify primary mode [0: ON, 1: NORMAL]: ")
if mode == "0":
mode = Mode.ON
elif mode == "1":
mode = Mode.NORMAL
else:
print("Invalid mode")
continue
break
return mode
def generate_write_mem_command(
object_id: bytes, memory_address: int, memory_data: int, mem_len: int
) -> bytearray:
@ -467,10 +494,10 @@ def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
return bytearray(command)
def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
selection = input("Use default parameter? (Y/N): ")
def prepare_cam_take_pic_cmd(object_id: bytes) -> bytes:
filename = input("Specify target filename: ")
selection = input("Use default parameter? (y/n): ")
if selection.lower() in ["y", "1", "yes"]:
filename = "0:/test"
encoder_setting_y = 7
quantization_y = 0
encoder_setting_cb = 7
@ -479,7 +506,6 @@ def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
quantization_cr = 0
bypass_compressor = 0
else:
filename = input("Specify filename: ")
encoder_setting_y = int(input("Specify encoderSetting_Y: "))
quantization_y = int(input("Specify quantization_Y: "))
encoder_setting_cb = int(input("Specify encoderSetting_Cb: "))
@ -490,7 +516,7 @@ def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
command = (
object_id
+ struct.pack("!I", ActionId.TC_CAM_TAKE_PIC)
+ bytearray(filename, "utf-8")
+ filename.encode()
+ bytes([0])
+ struct.pack("!B", encoder_setting_y)
+ struct.pack("!Q", quantization_y)
@ -500,18 +526,23 @@ def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
+ struct.pack("!Q", quantization_cr)
+ struct.pack("!B", bypass_compressor)
)
return bytearray(command)
return command
def prepare_simplex_send_file_cmd(object_id: bytes) -> bytearray:
def prepare_simplex_stream_file_user_data() -> bytes:
filename = input("Specify filename: ")
command = filename.encode() + bytes([0])
return command
def prepare_simplex_store_file_user_data() -> bytes:
num_of_chunks = int(input("Please specify the number of chunks: "))
assert num_of_chunks >= 0
filename = input("Specify filename: ")
command = (
object_id
+ struct.pack("!I", ActionId.TC_SIMPLEX_SEND_FILE)
+ bytearray(filename, "utf-8")
+ bytes([0])
struct.pack("!I", num_of_chunks) + bytearray(filename, "utf-8") + bytes([0])
)
return bytearray(command)
return command
def prepare_downlink_data_modulate_cmd(object_id: bytes) -> bytearray:
@ -714,11 +745,13 @@ def handle_mpsoc_data_reply(action_id: int, pw: PrintWrapper, custom_data: bytea
"PLOC MPSoC flash directory data shorter than minimum 16 bytes"
)
current_idx = 0
dir_name_short = custom_data[current_idx : current_idx + 12].decode("utf-8")
end_of_str = custom_data[current_idx : current_idx + 12].index(b"\x00")
dir_name_short = custom_data[current_idx : current_idx + end_of_str].decode()
current_idx += 12
num_elements = struct.unpack("!I", custom_data[current_idx : current_idx + 4])[
0
]
current_idx += 4
elem_names = []
elem_attrs = []
elem_sizes = []
@ -734,9 +767,7 @@ def handle_mpsoc_data_reply(action_id: int, pw: PrintWrapper, custom_data: bytea
# It is as weird as it looks..
for _ in range(num_elements):
end_of_str = custom_data[current_idx : current_idx + 12].index(b"\x00")
elem_name = custom_data[current_idx : current_idx + end_of_str].decode(
"utf-8"
)
elem_name = custom_data[current_idx : current_idx + end_of_str].decode()
current_idx += 12
elem_names.append(elem_name)
for _ in range(num_elements):

View File

@ -112,7 +112,7 @@ class SupvActionId(enum.IntEnum):
REQUEST_ADC_REPORT = 57
RESET_PL = 58
ENABLE_NVMS = 59
CONTINUE_UPDATE = 60
RESUME_UPDATE = 60
MEM_CHECK = 61
@ -137,7 +137,7 @@ class OpCode:
SET_TIME_REF = "set_time_ref"
FACTORY_FLASH = "factory_flash"
START_UPDATE = "start_update"
PERFORM_UPDATE = "update"
RESUME_UPDATE = "resum_update"
FACTORY_RESET = "factory_reset"
MEM_CHECK = "mem_check"
RESET_MPSOC = "reset_mpsoc"
@ -156,7 +156,7 @@ class Info(str, enum.Enum):
SHUTDOWN_MPSOC = "Shutdown MPSoC"
SET_TIME_REF = "Set time reference"
FACTORY_FLASH = "Factory Flash Mode"
PERFORM_UPDATE = "Start or continue MPSoC SW update at starting bytes"
RESUME_UPDATE = "Start or continue MPSoC SW update at starting bytes"
START_UPDATE = "Start new MPSoC SW update"
FACTORY_RESET = "Factory Reset of loggers"
MEM_CHECK = "Memory Check"
@ -331,7 +331,7 @@ def pack_ploc_supv_commands(q: DefaultPusQueueHelper, cmd_str: str): # noqa C90
q.add_log_cmd("PLOC Supversior: Start new MPSoC SW update")
command = pack_update_command(object_id.as_bytes, True)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if cmd_str in OpCode.PERFORM_UPDATE:
if cmd_str in OpCode.RESUME_UPDATE:
q.add_log_cmd("PLOC Supervisor: Perform MPSoC SW update")
command = pack_update_command(object_id.as_bytes, False)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
@ -370,7 +370,7 @@ def pack_ploc_supv_commands(q: DefaultPusQueueHelper, cmd_str: str): # noqa C90
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if cmd_str == "58":
q.add_log_cmd("PLOC Supervisor: Continue update")
command = object_id.as_bytes + struct.pack("!I", SupvActionId.CONTINUE_UPDATE)
command = object_id.as_bytes + struct.pack("!I", SupvActionId.RESUME_UPDATE)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if cmd_str == OpCode.MEM_CHECK:
custom_data = bytearray()

View File

@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
name = "eive-tmtc"
description = "TMTC Commander EIVE"
readme = "README.md"
version = "6.2.0"
version = "7.0.0"
requires-python = ">=3.10"
license = {text = "Apache-2.0"}
authors = [
@ -29,7 +29,7 @@ classifiers = [
"Topic :: Scientific/Engineering"
]
dependencies = [
"tmtccmd ~= 8.0.0rc1",
"tmtccmd == 8.0.0rc1",
"cfdp-py~=0.1.0",
# "tmtccmd @ git+https://github.com/robamu-org/tmtccmd@main",
"python-dateutil ~= 2.8",