From 37eafb722b36ebabb50252121c80ef7712216486 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 11 Apr 2024 10:52:14 +0200 Subject: [PATCH 01/16] this should do the job --- eive_tmtc/tmtc/payload/ploc_mpsoc.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eive_tmtc/tmtc/payload/ploc_mpsoc.py b/eive_tmtc/tmtc/payload/ploc_mpsoc.py index 49a5bd4..508f2cb 100644 --- a/eive_tmtc/tmtc/payload/ploc_mpsoc.py +++ b/eive_tmtc/tmtc/payload/ploc_mpsoc.py @@ -503,15 +503,18 @@ def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray: return bytearray(command) -def prepare_simplex_send_file_cmd(object_id: bytes) -> bytearray: +def prepare_simplex_send_file_cmd(object_id: bytes) -> 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", num_of_chunks) + struct.pack("!I", ActionId.TC_SIMPLEX_SEND_FILE) + bytearray(filename, "utf-8") + bytes([0]) ) - return bytearray(command) + return command def prepare_downlink_data_modulate_cmd(object_id: bytes) -> bytearray: From d5bb6fe6c5e9f3ea2cc703128bf7ed0560ca41de Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 17 Apr 2024 11:22:41 +0200 Subject: [PATCH 02/16] re-run generators --- eive_tmtc/config/events.csv | 16 ++++++++-------- eive_tmtc/config/objects.csv | 1 + eive_tmtc/config/returnvalues.csv | 26 +++++++++++++++----------- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/eive_tmtc/config/events.csv b/eive_tmtc/config/events.csv index 3c05a3c..6f5579c 100644 --- a/eive_tmtc/config/events.csv +++ b/eive_tmtc/config/events.csv @@ -128,14 +128,14 @@ 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;No description;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 diff --git a/eive_tmtc/config/objects.csv b/eive_tmtc/config/objects.csv index 1ada26d..8fc1bd2 100644 --- a/eive_tmtc/config/objects.csv +++ b/eive_tmtc/config/objects.csv @@ -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 diff --git a/eive_tmtc/config/returnvalues.csv b/eive_tmtc/config/returnvalues.csv index 72d4779..ec9a7fe 100644 --- a/eive_tmtc/config/returnvalues.csv +++ b/eive_tmtc/config/returnvalues.csv @@ -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 From fc5fb0eed333a46407c59e40cc9ca018ab3e217c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 17 Apr 2024 13:10:13 +0200 Subject: [PATCH 03/16] add new submode commands --- eive_tmtc/tmtc/payload/ploc_mpsoc.py | 94 ++++++++++++++-------------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/eive_tmtc/tmtc/payload/ploc_mpsoc.py b/eive_tmtc/tmtc/payload/ploc_mpsoc.py index 508f2cb..b1f8859 100644 --- a/eive_tmtc/tmtc/payload/ploc_mpsoc.py +++ b/eive_tmtc/tmtc/payload/ploc_mpsoc.py @@ -23,7 +23,7 @@ from tmtccmd.config.tmtc import ( 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 @@ -94,6 +94,12 @@ class ActionId(enum.IntEnum): TC_FLASH_READ_FULL_FILE = 30 +class Submode(enum.IntEnum): + IDLE_OR_NONE = 0 + REPLAY = 1 + SNAPSHOT = 2 + + class ParamId(enum.IntEnum): PLOC_SUPV_SKIP_CMD_TO_ON = 1 @@ -103,8 +109,8 @@ class OpCode: OFF = "off" NORMAL = "normal" VERIFY_BOOT = "verify_boot" - MODE_REPLAY = "mode_replay" - MODE_IDLE = "mode_idle" + MODE_REPLAY_LEGACY = "mode_replay_legacy" + MODE_IDLE_LEGACY = "mode_idle_legacy" REPLAY_WRITE_SEQ = "replay_write" DOWNLINK_PWR_ON = "downlink_pwr_on" MEM_WRITE = "memory_write" @@ -116,12 +122,16 @@ 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" DOWNLINK_DATA_MODULATE = "downlink_data_modulate" - MODE_SNAPSHOT = "mode_snapshot" + MODE_SNAPSHOT_LEGACY = "mode_snapshot_legacy" 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" class Info: @@ -139,6 +149,7 @@ class Info: MEM_READ = "Read from Memory" REPLAY_START = "Replay Start" CAM_TAKE_PIC = "Cam Take Picture" + CAM_CMD_SEND = "Send Camera Command" SIMPLEX_SEND_FILE = "Simplex Send File" FLASH_READ_FILE = "Copy file from MPSoC to OBC" FLASH_WRITE_FILE = "Copy file from OBC to MPSoC" @@ -168,45 +179,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. @@ -299,16 +271,16 @@ def pack_ploc_mpsoc_commands( + struct.pack("!H", num_words) ) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) - if cmd_str == OpCode.MODE_REPLAY: + if cmd_str == OpCode.MODE_REPLAY_LEGACY: 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: + if cmd_str == OpCode.MODE_IDLE_LEGACY: 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") + 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 @@ -336,10 +308,22 @@ def pack_ploc_mpsoc_commands( 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: + if cmd_str == OpCode.MODE_SNAPSHOT_LEGACY: 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)) + if cmd_str == OpCode.MODE_SNAPSHOT: + 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 +344,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: From 18860ec2c670230722f47a149a2486377a75da52 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 17 Apr 2024 13:20:46 +0200 Subject: [PATCH 04/16] tricky --- eive_tmtc/tmtc/payload/ploc_mpsoc.py | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/eive_tmtc/tmtc/payload/ploc_mpsoc.py b/eive_tmtc/tmtc/payload/ploc_mpsoc.py index b1f8859..586dce7 100644 --- a/eive_tmtc/tmtc/payload/ploc_mpsoc.py +++ b/eive_tmtc/tmtc/payload/ploc_mpsoc.py @@ -11,14 +11,10 @@ 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 @@ -109,8 +105,6 @@ class OpCode: OFF = "off" NORMAL = "normal" VERIFY_BOOT = "verify_boot" - MODE_REPLAY_LEGACY = "mode_replay_legacy" - MODE_IDLE_LEGACY = "mode_idle_legacy" REPLAY_WRITE_SEQ = "replay_write" DOWNLINK_PWR_ON = "downlink_pwr_on" MEM_WRITE = "memory_write" @@ -126,7 +120,6 @@ class OpCode: CAM_TAKE_PIC = "cam_take_pic" SIMPLEX_SEND_FILE = "simplex_send_file" DOWNLINK_DATA_MODULATE = "downlink_data_modulate" - MODE_SNAPSHOT_LEGACY = "mode_snapshot_legacy" 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" @@ -271,14 +264,6 @@ def pack_ploc_mpsoc_commands( + struct.pack("!H", num_words) ) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) - if cmd_str == OpCode.MODE_REPLAY_LEGACY: - 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_LEGACY: - 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 == OpCode.CAM_CMD_SEND: q.add_log_cmd(Info.CAM_CMD_SEND) cam_cmd = input("Specify cam command string: ") @@ -308,10 +293,6 @@ def pack_ploc_mpsoc_commands( 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_LEGACY: - 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)) if cmd_str == OpCode.MODE_SNAPSHOT: q.add_log_cmd(Info.MODE_SNAPSHOT) mode = prompt_mode_for_submode_change() @@ -346,10 +327,10 @@ 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 = input("Please specify primary mode [0: ON, 1: NORMAL]: ") + if mode == "0": mode = Mode.ON - elif mode == 1: + elif mode == "1": mode = Mode.NORMAL else: print("Invalid mode") From 05d595523624e0388d74e5f09ac3e4d3657ebf91 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 17 Apr 2024 14:43:15 +0200 Subject: [PATCH 05/16] split up in store file and stream file --- eive_tmtc/tmtc/payload/ploc_mpsoc.py | 31 +++++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/eive_tmtc/tmtc/payload/ploc_mpsoc.py b/eive_tmtc/tmtc/payload/ploc_mpsoc.py index 586dce7..3645bd1 100644 --- a/eive_tmtc/tmtc/payload/ploc_mpsoc.py +++ b/eive_tmtc/tmtc/payload/ploc_mpsoc.py @@ -82,12 +82,14 @@ 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_SIMPLEX_STORE_FILE = 31 + TC_VERIFY_BOOT = 32 class Submode(enum.IntEnum): @@ -118,7 +120,8 @@ class OpCode: 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" + SIMPLEX_STORE_FILE = "simplex_store_file" DOWNLINK_DATA_MODULATE = "downlink_data_modulate" ENABLE_PLOC_SUPV_COMMANDING_TO_ON = "enable_ploc_supv_cmd_to_on" DISABLE_PLOC_SUPV_COMMANDING_TO_ON = "disable_ploc_supv_cmd_to_on" @@ -143,7 +146,8 @@ class Info: REPLAY_START = "Replay Start" CAM_TAKE_PIC = "Cam Take Picture" CAM_CMD_SEND = "Send Camera Command" - SIMPLEX_SEND_FILE = "Simplex Send File" + SIMPLEX_STREAM_FILE = "Simplex Stream File with E-Band" + SIMPLEX_STORE_FILE = "Simplex Store File on MPSoC" 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" @@ -285,9 +289,9 @@ 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) + if cmd_str == OpCode.SIMPLEX_STREAM_FILE: + q.add_log_cmd(Info.SIMPLEX_STREAM_FILE) + data = prepare_simplex_stream_file_cmd(object_id.as_bytes) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) if cmd_str == OpCode.DOWNLINK_DATA_MODULATE: q.add_log_cmd("PLOC MPSoC: Downlink data modulate") @@ -482,14 +486,25 @@ def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray: return bytearray(command) -def prepare_simplex_send_file_cmd(object_id: bytes) -> bytes: +def prepare_simplex_stream_file_cmd(object_id: bytes) -> bytes: + filename = input("Specify filename: ") + command = ( + object_id + + struct.pack("!I", ActionId.TC_SIMPLEX_STREAM_FILE) + + bytearray(filename, "utf-8") + + bytes([0]) + ) + return command + + +def prepare_simplex_store_file_cmd(object_id: bytes) -> 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_STORE_FILE) + struct.pack("!I", num_of_chunks) - + struct.pack("!I", ActionId.TC_SIMPLEX_SEND_FILE) + bytearray(filename, "utf-8") + bytes([0]) ) From 0c51cad81390bc66e23f6765b5efca7537b12b20 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 17 Apr 2024 14:51:44 +0200 Subject: [PATCH 06/16] remove old boot verification cmd --- eive_tmtc/tmtc/payload/ploc_mpsoc.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/eive_tmtc/tmtc/payload/ploc_mpsoc.py b/eive_tmtc/tmtc/payload/ploc_mpsoc.py index 3645bd1..ee63c4b 100644 --- a/eive_tmtc/tmtc/payload/ploc_mpsoc.py +++ b/eive_tmtc/tmtc/payload/ploc_mpsoc.py @@ -259,15 +259,9 @@ 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)) + 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: ") From 69fda96d7acd78d54a3f653113c8a417febd93c2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 17 Apr 2024 15:02:20 +0200 Subject: [PATCH 07/16] bump major version --- CHANGELOG.md | 4 ++++ pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a76b643..b0334d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ list yields a list of all related PRs for each release. # [unreleased] +# [v7.0.0] 2024-04-17 + +- Reworked PLOC MPSoC commanding to be inline with OBSW update. + # [v6.2.0] 2024-04-10 ## Added diff --git a/pyproject.toml b/pyproject.toml index b5f75e8..6f7a9c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = [ From 36d9323b5722bae50fd723a1f308d282ad968758 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 25 Apr 2024 12:11:18 +0200 Subject: [PATCH 08/16] added commands for flash formatting --- eive_tmtc/tmtc/payload/ploc_mpsoc.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/eive_tmtc/tmtc/payload/ploc_mpsoc.py b/eive_tmtc/tmtc/payload/ploc_mpsoc.py index ee63c4b..404256b 100644 --- a/eive_tmtc/tmtc/payload/ploc_mpsoc.py +++ b/eive_tmtc/tmtc/payload/ploc_mpsoc.py @@ -90,6 +90,8 @@ class ActionId(enum.IntEnum): TC_FLASH_READ_FULL_FILE = 30 TC_SIMPLEX_STORE_FILE = 31 TC_VERIFY_BOOT = 32 + TC_ENABLE_FLASH_TC_EXECUTION = 33 + TC_FLASH_MKFS = 34 class Submode(enum.IntEnum): @@ -128,6 +130,8 @@ class OpCode: MODE_IDLE = "mode_idle" MODE_REPLAY = "mode_replay" MODE_SNAPSHOT = "mode_snapshot" + ENABLE_FLASH_TC_EXECUTION = "enable_flash_tc_exec" + FLASH_MKFS = "flash_mkfs" class Info: @@ -158,6 +162,8 @@ class Info: DISABLE_PLOC_SUPV_COMMANDING_TO_ON = ( "Disable PLOC SUPV commanding when switching ON" ) + ENABLE_FLASH_TC_EXECUTION = "Enable execution of Flash MKFS command" + FLASH_MKFS = "Flash MKFS command" class MemAddresses(enum.IntEnum): @@ -271,6 +277,25 @@ 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_FLASH_TC_EXECUTION: + q.add_log_cmd(Info.ENABLE_FLASH_TC_EXECUTION) + q.add_pus_tc( + create_action_cmd(PLOC_MPSOC_ID, ActionId.TC_ENABLE_FLASH_TC_EXECUTION) + ) + 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 == "17": q.add_log_cmd("PLOC MPSoC: Set UART TX tristate") data = object_id.as_bytes + struct.pack("!I", ActionId.SET_UART_TX_TRISTATE) From dfa45dbdba16d2190616eca6ba1dc13e94692b63 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 25 Apr 2024 17:26:57 +0200 Subject: [PATCH 09/16] added some commands for preparing flash --- eive_tmtc/tmtc/payload/ploc_mpsoc.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/eive_tmtc/tmtc/payload/ploc_mpsoc.py b/eive_tmtc/tmtc/payload/ploc_mpsoc.py index 404256b..5da2eaa 100644 --- a/eive_tmtc/tmtc/payload/ploc_mpsoc.py +++ b/eive_tmtc/tmtc/payload/ploc_mpsoc.py @@ -27,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"), @@ -90,7 +92,7 @@ class ActionId(enum.IntEnum): TC_FLASH_READ_FULL_FILE = 30 TC_SIMPLEX_STORE_FILE = 31 TC_VERIFY_BOOT = 32 - TC_ENABLE_FLASH_TC_EXECUTION = 33 + TC_ENABLE_TC_EXECUTION = 33 TC_FLASH_MKFS = 34 @@ -130,7 +132,7 @@ class OpCode: MODE_IDLE = "mode_idle" MODE_REPLAY = "mode_replay" MODE_SNAPSHOT = "mode_snapshot" - ENABLE_FLASH_TC_EXECUTION = "enable_flash_tc_exec" + ENABLE_TC_EXECUTION = "enable_tc_exec" FLASH_MKFS = "flash_mkfs" @@ -162,7 +164,7 @@ class Info: DISABLE_PLOC_SUPV_COMMANDING_TO_ON = ( "Disable PLOC SUPV commanding when switching ON" ) - ENABLE_FLASH_TC_EXECUTION = "Enable execution of Flash MKFS command" + ENABLE_TC_EXECUTION = "Enable execution of critical commands" FLASH_MKFS = "Flash MKFS command" @@ -277,10 +279,20 @@ 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_FLASH_TC_EXECUTION: - q.add_log_cmd(Info.ENABLE_FLASH_TC_EXECUTION) + 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_FLASH_TC_EXECUTION) + 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) From c50f8c2ce2638017aaff30ac2ee6bbff8220c177 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 26 Apr 2024 13:53:39 +0200 Subject: [PATCH 10/16] some fixes --- eive_tmtc/tmtc/payload/ploc_mpsoc.py | 57 ++++++++++++++-------------- pyproject.toml | 6 +-- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/eive_tmtc/tmtc/payload/ploc_mpsoc.py b/eive_tmtc/tmtc/payload/ploc_mpsoc.py index 5da2eaa..68dc9c3 100644 --- a/eive_tmtc/tmtc/payload/ploc_mpsoc.py +++ b/eive_tmtc/tmtc/payload/ploc_mpsoc.py @@ -308,6 +308,15 @@ def pack_ploc_mpsoc_commands( ) ) + if cmd_str == OpCode.SIMPLEX_STORE_FILE: + q.add_log_cmd(Info.SIMPLEX_STORE_FILE) + q.add_pus_tc( + create_action_cmd( + PLOC_MPSOC_ID, + ActionId.TC_SIMPLEX_STORE_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) @@ -322,8 +331,12 @@ def pack_ploc_mpsoc_commands( 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_cmd(object_id.as_bytes) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) + 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) @@ -481,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 @@ -493,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: ")) @@ -504,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) @@ -514,30 +526,21 @@ def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray: + struct.pack("!Q", quantization_cr) + struct.pack("!B", bypass_compressor) ) - return bytearray(command) - - -def prepare_simplex_stream_file_cmd(object_id: bytes) -> bytes: - filename = input("Specify filename: ") - command = ( - object_id - + struct.pack("!I", ActionId.TC_SIMPLEX_STREAM_FILE) - + bytearray(filename, "utf-8") - + bytes([0]) - ) return command -def prepare_simplex_store_file_cmd(object_id: bytes) -> bytes: +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_STORE_FILE) - + struct.pack("!I", num_of_chunks) - + bytearray(filename, "utf-8") - + bytes([0]) + struct.pack("!I", num_of_chunks) + bytearray(filename, "utf-8") + bytes([0]) ) return command @@ -742,7 +745,7 @@ 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") + dir_name_short = custom_data[current_idx : current_idx + 12].decode() current_idx += 12 num_elements = struct.unpack("!I", custom_data[current_idx : current_idx + 4])[ 0 @@ -762,9 +765,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): diff --git a/pyproject.toml b/pyproject.toml index 6f7a9c4..c055921 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,10 +29,10 @@ 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", + # "tmtccmd @ git+https://github.com/robamu-org/tmtccmd@main", + "python-dateutil ~= 2.8", ] [project.urls] From a59aceda751bd1594b91c632fe0ae85b844707df Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 26 Apr 2024 14:36:02 +0200 Subject: [PATCH 11/16] odd things happening here --- eive_tmtc/tmtc/payload/ploc_mpsoc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eive_tmtc/tmtc/payload/ploc_mpsoc.py b/eive_tmtc/tmtc/payload/ploc_mpsoc.py index 68dc9c3..2a93ef7 100644 --- a/eive_tmtc/tmtc/payload/ploc_mpsoc.py +++ b/eive_tmtc/tmtc/payload/ploc_mpsoc.py @@ -745,7 +745,8 @@ 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() + 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 From f9041f215aa39df2df314b6353c098853ac64426 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 26 Apr 2024 15:27:44 +0200 Subject: [PATCH 12/16] how the fuck did that work the last time? --- eive_tmtc/tmtc/payload/ploc_mpsoc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/eive_tmtc/tmtc/payload/ploc_mpsoc.py b/eive_tmtc/tmtc/payload/ploc_mpsoc.py index 2a93ef7..f674f1f 100644 --- a/eive_tmtc/tmtc/payload/ploc_mpsoc.py +++ b/eive_tmtc/tmtc/payload/ploc_mpsoc.py @@ -751,6 +751,7 @@ def handle_mpsoc_data_reply(action_id: int, pw: PrintWrapper, custom_data: bytea num_elements = struct.unpack("!I", custom_data[current_idx : current_idx + 4])[ 0 ] + current_idx += 4 elem_names = [] elem_attrs = [] elem_sizes = [] From de34952df5557c28625ad6fb3a2365dd45b81707 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 Apr 2024 14:36:11 +0200 Subject: [PATCH 13/16] less confusing cmd names --- eive_tmtc/tmtc/payload/ploc_supervisor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eive_tmtc/tmtc/payload/ploc_supervisor.py b/eive_tmtc/tmtc/payload/ploc_supervisor.py index f75198f..b5edaac 100644 --- a/eive_tmtc/tmtc/payload/ploc_supervisor.py +++ b/eive_tmtc/tmtc/payload/ploc_supervisor.py @@ -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() From 376f94b1673921ef63f7cb11f4852afd9f8fa818 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 May 2024 13:18:27 +0200 Subject: [PATCH 14/16] update events --- eive_tmtc/config/events.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/eive_tmtc/config/events.csv b/eive_tmtc/config/events.csv index 6f5579c..6a851c6 100644 --- a/eive_tmtc/config/events.csv +++ b/eive_tmtc/config/events.csv @@ -136,6 +136,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 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;No description;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 From ada099cab1c1ab842d775ff4b658f97246122b18 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 May 2024 13:48:22 +0200 Subject: [PATCH 15/16] events --- eive_tmtc/config/events.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eive_tmtc/config/events.csv b/eive_tmtc/config/events.csv index 6a851c6..7b833ae 100644 --- a/eive_tmtc/config/events.csv +++ b/eive_tmtc/config/events.csv @@ -135,7 +135,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 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;No description;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 From 9cc4fa702c23e795160c5d62fd448726b0f30f43 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 May 2024 14:10:30 +0200 Subject: [PATCH 16/16] renaming --- eive_tmtc/tmtc/payload/ploc_mpsoc.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eive_tmtc/tmtc/payload/ploc_mpsoc.py b/eive_tmtc/tmtc/payload/ploc_mpsoc.py index f674f1f..e542f1c 100644 --- a/eive_tmtc/tmtc/payload/ploc_mpsoc.py +++ b/eive_tmtc/tmtc/payload/ploc_mpsoc.py @@ -90,7 +90,7 @@ class ActionId(enum.IntEnum): TC_FLASH_DIR_GET_CONTENT = 28 TM_FLASH_DIRECTORY_CONTENT = 29 TC_FLASH_READ_FULL_FILE = 30 - TC_SIMPLEX_STORE_FILE = 31 + TC_SPLIT_FILE = 31 TC_VERIFY_BOOT = 32 TC_ENABLE_TC_EXECUTION = 33 TC_FLASH_MKFS = 34 @@ -125,7 +125,7 @@ class OpCode: CAM_CMD_SEND = "cam_cmd_send" CAM_TAKE_PIC = "cam_take_pic" SIMPLEX_STREAM_FILE = "simplex_stream_file" - SIMPLEX_STORE_FILE = "simplex_store_file" + SPLIT_FILE = "split_file" DOWNLINK_DATA_MODULATE = "downlink_data_modulate" ENABLE_PLOC_SUPV_COMMANDING_TO_ON = "enable_ploc_supv_cmd_to_on" DISABLE_PLOC_SUPV_COMMANDING_TO_ON = "disable_ploc_supv_cmd_to_on" @@ -153,7 +153,7 @@ class Info: CAM_TAKE_PIC = "Cam Take Picture" CAM_CMD_SEND = "Send Camera Command" SIMPLEX_STREAM_FILE = "Simplex Stream File with E-Band" - SIMPLEX_STORE_FILE = "Simplex Store File on MPSoC" + 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" @@ -308,12 +308,12 @@ def pack_ploc_mpsoc_commands( ) ) - if cmd_str == OpCode.SIMPLEX_STORE_FILE: - q.add_log_cmd(Info.SIMPLEX_STORE_FILE) + 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_SIMPLEX_STORE_FILE, + ActionId.TC_SPLIT_FILE, user_data=prepare_simplex_store_file_user_data(), ) )