moved 2 parameters #196

Merged
muellerr merged 13 commits from move-pdu-datavar into v4.0.0-dev 2023-06-09 12:41:56 +02:00
7 changed files with 395 additions and 145 deletions
Showing only changes of commit 620360c8e8 - Show all commits

View File

@ -10,9 +10,17 @@ list yields a list of all related PRs for each release.
# [unreleased]
# [v3.2.0] to be released
## Added
- Event handling for reboot counter events.
- Start adding new MPSoC commands, improve MPSoC commanding module a bit.
- Handling for PLOC MPSoC flash content report.
## Fixed
- Fix for PLOC power switching.
# [v3.1.1] 2023-04-17

View File

@ -177,20 +177,24 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
12515;0x30e3;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not exist P1: Internal state of str helper;linux/acs/StrComHandler.h
12516;0x30e4;STR_HELPER_SENDING_PACKET_FAILED;LOW;No description;linux/acs/StrComHandler.h
12517;0x30e5;STR_HELPER_REQUESTING_MSG_FAILED;LOW;No description;linux/acs/StrComHandler.h
12600;0x3138;MPSOC_FLASH_WRITE_FAILED;LOW;Flash write fails;linux/payload/PlocMpsocHelper.h
12601;0x3139;MPSOC_FLASH_WRITE_SUCCESSFUL;LOW;Flash write successful;linux/payload/PlocMpsocHelper.h
12602;0x313a;MPSOC_SENDING_COMMAND_FAILED;LOW;No description;linux/payload/PlocMpsocHelper.h
12603;0x313b;MPSOC_HELPER_REQUESTING_REPLY_FAILED;LOW;Request receive message of communication interface failed P1: Return value returned by the communication interface requestReceiveMessage function P2: Internal state of MPSoC helper;linux/payload/PlocMpsocHelper.h
12604;0x313c;MPSOC_HELPER_READING_REPLY_FAILED;LOW;Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of MPSoC helper;linux/payload/PlocMpsocHelper.h
12605;0x313d;MPSOC_MISSING_ACK;LOW;Did not receive acknowledgment report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/payload/PlocMpsocHelper.h
12606;0x313e;MPSOC_MISSING_EXE;LOW;Did not receive execution report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/payload/PlocMpsocHelper.h
12607;0x313f;MPSOC_ACK_FAILURE_REPORT;LOW;Received acknowledgment failure report P1: Internal state of MPSoC;linux/payload/PlocMpsocHelper.h
12608;0x3140;MPSOC_EXE_FAILURE_REPORT;LOW;Received execution failure report P1: Internal state of MPSoC;linux/payload/PlocMpsocHelper.h
12609;0x3141;MPSOC_ACK_INVALID_APID;LOW;Expected acknowledgment report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC;linux/payload/PlocMpsocHelper.h
12610;0x3142;MPSOC_EXE_INVALID_APID;LOW;Expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC;linux/payload/PlocMpsocHelper.h
12611;0x3143;MPSOC_HELPER_SEQ_CNT_MISMATCH;LOW;Received sequence count does not match expected sequence count P1: Expected sequence count P2: Received sequence count;linux/payload/PlocMpsocHelper.h
12612;0x3144;MPSOC_TM_SIZE_ERROR;LOW;No description;linux/payload/PlocMpsocHelper.h
12613;0x3145;MPSOC_TM_CRC_MISSMATCH;LOW;No description;linux/payload/PlocMpsocHelper.h
12600;0x3138;MPSOC_FLASH_WRITE_FAILED;LOW;Flash write fails;linux/payload/PlocMpsocSpecialComHelper.h
12601;0x3139;MPSOC_FLASH_WRITE_SUCCESSFUL;INFO;Flash write successful;linux/payload/PlocMpsocSpecialComHelper.h
12602;0x313a;MPSOC_SENDING_COMMAND_FAILED;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
12603;0x313b;MPSOC_HELPER_REQUESTING_REPLY_FAILED;LOW;Request receive message of communication interface failed P1: Return value returned by the communication interface requestReceiveMessage function P2: Internal state of MPSoC helper;linux/payload/PlocMpsocSpecialComHelper.h
12604;0x313c;MPSOC_HELPER_READING_REPLY_FAILED;LOW;Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of MPSoC helper;linux/payload/PlocMpsocSpecialComHelper.h
12605;0x313d;MPSOC_MISSING_ACK;LOW;Did not receive acknowledgment report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/payload/PlocMpsocSpecialComHelper.h
12606;0x313e;MPSOC_MISSING_EXE;LOW;Did not receive execution report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/payload/PlocMpsocSpecialComHelper.h
12607;0x313f;MPSOC_ACK_FAILURE_REPORT;LOW;Received acknowledgment failure report P1: Internal state of MPSoC;linux/payload/PlocMpsocSpecialComHelper.h
12608;0x3140;MPSOC_EXE_FAILURE_REPORT;LOW;Received execution failure report P1: Internal state of MPSoC;linux/payload/PlocMpsocSpecialComHelper.h
12609;0x3141;MPSOC_ACK_INVALID_APID;LOW;Expected acknowledgment report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC;linux/payload/PlocMpsocSpecialComHelper.h
12610;0x3142;MPSOC_EXE_INVALID_APID;LOW;Expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC;linux/payload/PlocMpsocSpecialComHelper.h
12611;0x3143;MPSOC_HELPER_SEQ_CNT_MISMATCH;LOW;Received sequence count does not match expected sequence count P1: Expected sequence count P2: Received sequence count;linux/payload/PlocMpsocSpecialComHelper.h
12612;0x3144;MPSOC_TM_SIZE_ERROR;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
12613;0x3145;MPSOC_TM_CRC_MISSMATCH;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
12614;0x3146;MPSOC_FLASH_READ_PACKET_ERROR;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
12615;0x3147;MPSOC_FLASH_READ_FAILED;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
12616;0x3148;MPSOC_FLASH_READ_SUCCESSFUL;INFO;No description;linux/payload/PlocMpsocSpecialComHelper.h
12617;0x3149;MPSOC_READ_TIMEOUT;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
12700;0x319c;TRANSITION_BACK_TO_OFF;MEDIUM;Could not transition properly and went back to ALL OFF;mission/payload/PayloadPcduHandler.h
12701;0x319d;NEG_V_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
12702;0x319e;U_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
@ -274,7 +278,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
14105;0x3719;CAMERA_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
14106;0x371a;PCDU_SYSTEM_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
14107;0x371b;HEATER_NOT_OFF_FOR_OFF_MODE;MEDIUM;No description;mission/controller/tcsDefs.h
14108;0x371c;MGT_OVERHEATING;MEDIUM;No description;mission/controller/tcsDefs.h
14108;0x371c;MGT_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
14201;0x3779;TX_TIMER_EXPIRED;INFO;The transmit timer to protect the Syrlinks expired P1: The current timer value;mission/system/com/ComSubsystem.h
14202;0x377a;BIT_LOCK_TX_ON;INFO;Transmitter will be turned on due to detection of bitlock;mission/system/com/ComSubsystem.h
14300;0x37dc;POSSIBLE_FILE_CORRUPTION;LOW;P1: Result code of TM packet parser. P2: Timestamp of possibly corrupt file as a unix timestamp.;mission/persistentTmStoreDefs.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
177 12515 0x30e3 STR_HELPER_FILE_NOT_EXISTS LOW Specified file does not exist P1: Internal state of str helper linux/acs/StrComHandler.h
178 12516 0x30e4 STR_HELPER_SENDING_PACKET_FAILED LOW No description linux/acs/StrComHandler.h
179 12517 0x30e5 STR_HELPER_REQUESTING_MSG_FAILED LOW No description linux/acs/StrComHandler.h
180 12600 0x3138 MPSOC_FLASH_WRITE_FAILED LOW Flash write fails linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
181 12601 0x3139 MPSOC_FLASH_WRITE_SUCCESSFUL LOW INFO Flash write successful linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
182 12602 0x313a MPSOC_SENDING_COMMAND_FAILED LOW No description linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
183 12603 0x313b MPSOC_HELPER_REQUESTING_REPLY_FAILED LOW Request receive message of communication interface failed P1: Return value returned by the communication interface requestReceiveMessage function P2: Internal state of MPSoC helper linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
184 12604 0x313c MPSOC_HELPER_READING_REPLY_FAILED LOW Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of MPSoC helper linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
185 12605 0x313d MPSOC_MISSING_ACK LOW Did not receive acknowledgment report P1: Number of bytes missing P2: Internal state of MPSoC helper linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
186 12606 0x313e MPSOC_MISSING_EXE LOW Did not receive execution report P1: Number of bytes missing P2: Internal state of MPSoC helper linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
187 12607 0x313f MPSOC_ACK_FAILURE_REPORT LOW Received acknowledgment failure report P1: Internal state of MPSoC linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
188 12608 0x3140 MPSOC_EXE_FAILURE_REPORT LOW Received execution failure report P1: Internal state of MPSoC linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
189 12609 0x3141 MPSOC_ACK_INVALID_APID LOW Expected acknowledgment report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
190 12610 0x3142 MPSOC_EXE_INVALID_APID LOW Expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
191 12611 0x3143 MPSOC_HELPER_SEQ_CNT_MISMATCH LOW Received sequence count does not match expected sequence count P1: Expected sequence count P2: Received sequence count linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
192 12612 0x3144 MPSOC_TM_SIZE_ERROR LOW No description linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
193 12613 0x3145 MPSOC_TM_CRC_MISSMATCH LOW No description linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
194 12614 0x3146 MPSOC_FLASH_READ_PACKET_ERROR LOW No description linux/payload/PlocMpsocSpecialComHelper.h
195 12615 0x3147 MPSOC_FLASH_READ_FAILED LOW No description linux/payload/PlocMpsocSpecialComHelper.h
196 12616 0x3148 MPSOC_FLASH_READ_SUCCESSFUL INFO No description linux/payload/PlocMpsocSpecialComHelper.h
197 12617 0x3149 MPSOC_READ_TIMEOUT LOW No description linux/payload/PlocMpsocSpecialComHelper.h
198 12700 0x319c TRANSITION_BACK_TO_OFF MEDIUM Could not transition properly and went back to ALL OFF mission/payload/PayloadPcduHandler.h
199 12701 0x319d NEG_V_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/payload/PayloadPcduHandler.h
200 12702 0x319e U_DRO_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission/payload/PayloadPcduHandler.h
278 14105 0x3719 CAMERA_OVERHEATING HIGH No description mission/controller/tcsDefs.h
279 14106 0x371a PCDU_SYSTEM_OVERHEATING HIGH No description mission/controller/tcsDefs.h
280 14107 0x371b HEATER_NOT_OFF_FOR_OFF_MODE MEDIUM No description mission/controller/tcsDefs.h
281 14108 0x371c MGT_OVERHEATING MEDIUM HIGH No description mission/controller/tcsDefs.h
282 14201 0x3779 TX_TIMER_EXPIRED INFO The transmit timer to protect the Syrlinks expired P1: The current timer value mission/system/com/ComSubsystem.h
283 14202 0x377a BIT_LOCK_TX_ON INFO Transmitter will be turned on due to detection of bitlock mission/system/com/ComSubsystem.h
284 14300 0x37dc POSSIBLE_FILE_CORRUPTION LOW P1: Result code of TM packet parser. P2: Timestamp of possibly corrupt file as a unix timestamp. mission/persistentTmStoreDefs.h

View File

@ -478,8 +478,8 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x53b6;STRH_StartrackerAlreadyBooted;Star tracker is already in firmware mode;182;STR_HANDLER;mission/acs/str/StarTrackerHandler.h
0x53b7;STRH_StartrackerNotRunningFirmware;Star tracker must be in firmware mode to run this command;183;STR_HANDLER;mission/acs/str/StarTrackerHandler.h
0x53b8;STRH_StartrackerNotRunningBootloader;Star tracker must be in bootloader mode to run this command;184;STR_HANDLER;mission/acs/str/StarTrackerHandler.h
0x54e0;DWLPWRON_InvalidMode;Received command has invalid JESD mode (valid modes are 0 - 5);224;DWLPWRON_CMD;linux/payload/plocMpscoDefs.h
0x54e1;DWLPWRON_InvalidLaneRate;Received command has invalid lane rate (valid lane rate are 0 - 9);225;DWLPWRON_CMD;linux/payload/plocMpscoDefs.h
0x54e0;DWLPWRON_InvalidMode;Received command has invalid JESD mode (valid modes are 0 - 5);224;DWLPWRON_CMD;linux/payload/plocMpsocHelpers.h
0x54e1;DWLPWRON_InvalidLaneRate;Received command has invalid lane rate (valid lane rate are 0 - 9);225;DWLPWRON_CMD;linux/payload/plocMpsocHelpers.h
0x5700;PLSPVhLP_RequestDone;No description;0;PLOC_SUPV_HELPER;linux/payload/PlocSupvUartMan.h
0x5701;PLSPVhLP_NoPacketFound;No description;1;PLOC_SUPV_HELPER;linux/payload/PlocSupvUartMan.h
0x5702;PLSPVhLP_DecodeBufTooSmall;No description;2;PLOC_SUPV_HELPER;linux/payload/PlocSupvUartMan.h
@ -543,7 +543,8 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x63a0;NVMB_KeyNotExists;Specified key does not exist in json file;160;NVM_PARAM_BASE;mission/memory/NvmParameterBase.h
0x64a0;FSHLP_SdNotMounted;SD card specified with path string not mounted;160;FILE_SYSTEM_HELPER;bsp_q7s/fs/FilesystemHelper.h
0x64a1;FSHLP_FileNotExists;Specified file does not exist on filesystem;161;FILE_SYSTEM_HELPER;bsp_q7s/fs/FilesystemHelper.h
0x65a0;PLMPHLP_FileClosedAccidentally;File accidentally close;160;PLOC_MPSOC_HELPER;linux/payload/PlocMpsocHelper.h
0x65a0;PLMPHLP_FileWriteError;File error occured for file transfers from OBC to the MPSoC.;160;PLOC_MPSOC_HELPER;linux/payload/PlocMpsocSpecialComHelper.h
0x65a1;PLMPHLP_FileReadError;File error occured for file transfers from MPSoC to OBC.;161;PLOC_MPSOC_HELPER;linux/payload/PlocMpsocSpecialComHelper.h
0x66a0;SADPL_CommandNotSupported;No description;160;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
0x66a1;SADPL_DeploymentAlreadyExecuting;No description;161;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
0x66a2;SADPL_MainSwitchTimeoutFailure;No description;162;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h

1 Full ID (hex) Name Description Unique ID Subsytem Name File Path
478 0x53b6 STRH_StartrackerAlreadyBooted Star tracker is already in firmware mode 182 STR_HANDLER mission/acs/str/StarTrackerHandler.h
479 0x53b7 STRH_StartrackerNotRunningFirmware Star tracker must be in firmware mode to run this command 183 STR_HANDLER mission/acs/str/StarTrackerHandler.h
480 0x53b8 STRH_StartrackerNotRunningBootloader Star tracker must be in bootloader mode to run this command 184 STR_HANDLER mission/acs/str/StarTrackerHandler.h
481 0x54e0 DWLPWRON_InvalidMode Received command has invalid JESD mode (valid modes are 0 - 5) 224 DWLPWRON_CMD linux/payload/plocMpscoDefs.h linux/payload/plocMpsocHelpers.h
482 0x54e1 DWLPWRON_InvalidLaneRate Received command has invalid lane rate (valid lane rate are 0 - 9) 225 DWLPWRON_CMD linux/payload/plocMpscoDefs.h linux/payload/plocMpsocHelpers.h
483 0x5700 PLSPVhLP_RequestDone No description 0 PLOC_SUPV_HELPER linux/payload/PlocSupvUartMan.h
484 0x5701 PLSPVhLP_NoPacketFound No description 1 PLOC_SUPV_HELPER linux/payload/PlocSupvUartMan.h
485 0x5702 PLSPVhLP_DecodeBufTooSmall No description 2 PLOC_SUPV_HELPER linux/payload/PlocSupvUartMan.h
543 0x63a0 NVMB_KeyNotExists Specified key does not exist in json file 160 NVM_PARAM_BASE mission/memory/NvmParameterBase.h
544 0x64a0 FSHLP_SdNotMounted SD card specified with path string not mounted 160 FILE_SYSTEM_HELPER bsp_q7s/fs/FilesystemHelper.h
545 0x64a1 FSHLP_FileNotExists Specified file does not exist on filesystem 161 FILE_SYSTEM_HELPER bsp_q7s/fs/FilesystemHelper.h
546 0x65a0 PLMPHLP_FileClosedAccidentally PLMPHLP_FileWriteError File accidentally close File error occured for file transfers from OBC to the MPSoC. 160 PLOC_MPSOC_HELPER linux/payload/PlocMpsocHelper.h linux/payload/PlocMpsocSpecialComHelper.h
547 0x65a1 PLMPHLP_FileReadError File error occured for file transfers from MPSoC to OBC. 161 PLOC_MPSOC_HELPER linux/payload/PlocMpsocSpecialComHelper.h
548 0x66a0 SADPL_CommandNotSupported No description 160 SA_DEPL_HANDLER mission/SolarArrayDeploymentHandler.h
549 0x66a1 SADPL_DeploymentAlreadyExecuting No description 161 SA_DEPL_HANDLER mission/SolarArrayDeploymentHandler.h
550 0x66a2 SADPL_MainSwitchTimeoutFailure No description 162 SA_DEPL_HANDLER mission/SolarArrayDeploymentHandler.h

View File

@ -3,7 +3,7 @@ from eive_tmtc.config.object_ids import *
from eive_tmtc.tmtc.acs.imtq import ImtqActionId
from eive_tmtc.pus_tm.defs import PrintWrapper
from eive_tmtc.tmtc.core import handle_core_ctrl_action_replies
from eive_tmtc.tmtc.payload.ploc_mpsoc import PlocReplyIds
from eive_tmtc.tmtc.payload.ploc_mpsoc import handle_mpsoc_data_reply
from eive_tmtc.tmtc.payload.ploc_supervisor import SupvActionId
from eive_tmtc.tmtc.acs.star_tracker import StarTrackerActionId
from eive_tmtc.tmtc.power.tm import handle_get_param_data_reply
@ -23,7 +23,6 @@ def handle_action_reply(
tm_packet = Service8FsfwTm.unpack(
raw_telemetry=raw_tm, time_reader=CdsShortTimestamp.empty()
)
printer.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
object_id = obj_id_dict.get(tm_packet.source_object_id_as_bytes)
pw = PrintWrapper(printer)
custom_data = tm_packet.custom_data
@ -35,7 +34,7 @@ def handle_action_reply(
if object_id.as_bytes == IMTQ_HANDLER_ID:
return handle_imtq_replies(action_id, printer, custom_data)
elif object_id.as_bytes == PLOC_MPSOC_ID:
return handle_ploc_replies(action_id, printer, custom_data)
return handle_mpsoc_data_reply(action_id, printer, custom_data)
elif object_id.as_bytes == PLOC_SUPV_ID:
return handle_supervisor_replies(action_id, printer, custom_data)
elif object_id.as_bytes == CORE_CONTROLLER_ID:
@ -71,36 +70,6 @@ def handle_imtq_replies(
printer.file_logger.info(content_list)
def handle_ploc_replies(
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
):
if action_id == PlocReplyIds.TM_MEM_READ_RPT:
header_list = [
"PLOC Memory Address",
"PLOC Mem Len",
"PLOC Read Memory Data",
]
content_list = [
"0x" + custom_data[:4].hex(),
struct.unpack("!H", custom_data[4:6])[0],
"0x" + custom_data[6:10].hex(),
]
print(header_list)
print(content_list)
printer.file_logger.info(header_list)
printer.file_logger.info(content_list)
elif action_id == PlocReplyIds.TM_CAM_CMD_RPT:
header_list = ["Camera reply string", "ACK"]
content_list = [
custom_data[: len(custom_data) - 1].decode("utf-8"),
hex(custom_data[-1]),
]
print(header_list)
print(content_list)
printer.file_logger.info(header_list)
printer.file_logger.info(content_list)
def handle_supervisor_replies(
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
):

View File

@ -4,6 +4,7 @@ import logging
# from pus_tm.tcp_server_objects import TCP_SEVER_SENSOR_TEMPERATURES
from eive_tmtc.tmtc.acs.acs_ctrl import handle_acs_ctrl_hk_data
from eive_tmtc.tmtc.payload.ploc_mpsoc import handle_ploc_mpsoc_hk_data
from eive_tmtc.tmtc.tcs.rtd import RTD_NAMES, handle_rtd_hk
from eive_tmtc.tmtc.acs.star_tracker import handle_str_hk_data
from eive_tmtc.tmtc.power.plpcdu import handle_plpcdu_hk
@ -117,6 +118,10 @@ def handle_regular_hk_print(
return handle_pdu_data(
printer=printer, pdu_idx=2, set_id=set_id, hk_data=hk_data
)
elif objb == obj_ids.PLOC_MPSOC_ID:
return handle_ploc_mpsoc_hk_data(
printer=printer, hk_data=hk_data, set_id=set_id
)
elif objb == obj_ids.ACU_HANDLER_ID:
return handle_acu_hk_data(printer=printer, hk_data=hk_data, set_id=set_id)
elif objb == obj_ids.RAD_SENSOR_ID:

View File

@ -6,12 +6,14 @@
@author J. Meier
@date 06.03.2021
"""
import dataclasses
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 (
tmtc_definitions_provider,
OpCodeEntry,
@ -22,38 +24,54 @@ from tmtccmd.tc import service_provider
from tmtccmd.tc.decorator import ServiceProviderParams
from eive_tmtc.utility.input_helper import InputHelper
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
from tmtccmd.tc.pus_8_fsfw_funccmd import create_action_cmd
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
_LOGGER = logging.getLogger(__name__)
MANUAL_INPUT = "1"
flash_write_file_dict = {
MANUAL_INPUT: ["manual input", ""],
"2": ["/mnt/sd0/ploc/mpsoc/flash_write.bin", "/mnt/sd0/ploc/mpsoc/flash_write.bin"],
OBC_WRITE_FILE_DICT = {
MANUAL_INPUT: ("manual input", ""),
"2": ("/mnt/sd0/ploc/mpsoc/flash_write.bin", "/mnt/sd0/ploc/mpsoc/flash_write.bin"),
}
mpsoc_file_dict = {
MANUAL_INPUT: ["manual input", ""],
"2": ["0:/flash", "0:/flash"],
OBC_READ_FILE_DICT = {
MANUAL_INPUT: ("manual input", ""),
"2": ("/mnt/sd0/ploc/mpsoc/flash_read.bin", "/mnt/sd0/ploc/mpsoc/flash_read.bin"),
}
MPSOC_WRITE_FILE_DICT = {
MANUAL_INPUT: ("manual input", ""),
"2": ("0:/", "0:/"),
}
MPSOC_READ_FILE_DICT = {
MANUAL_INPUT: ("manual input", ""),
"2": ("0:/PICA", "0:/PICA"),
}
SEQ_FILE_NAMES = ["0:/EM16/231", "0:/EQ04/E-75", "0:/EQ01/E130"]
SEQ_FILE_DICT = {
MANUAL_INPUT: ["manual input", ""],
"2": [f"16QRM On Carrier 200 MBd ({SEQ_FILE_NAMES[0]})", f"{SEQ_FILE_NAMES[0]}"],
"3": [f"QPSK On Carrier 780 MBd ({SEQ_FILE_NAMES[1]})", f"{SEQ_FILE_NAMES[1]}"],
"4": [f"Maximum Bandwidth QPSK ({SEQ_FILE_NAMES[2]})", f"{SEQ_FILE_NAMES[2]}"],
MANUAL_INPUT: ("manual input", ""),
"2": (f"16QRM On Carrier 200 MBd ({SEQ_FILE_NAMES[0]})", f"{SEQ_FILE_NAMES[0]}"),
"3": (f"QPSK On Carrier 780 MBd ({SEQ_FILE_NAMES[1]})", f"{SEQ_FILE_NAMES[1]}"),
"4": (f"Maximum Bandwidth QPSK ({SEQ_FILE_NAMES[2]})", f"{SEQ_FILE_NAMES[2]}"),
}
CARRIAGE_RETURN = 0xD
class CommandId(enum.IntEnum):
class SetId(enum.IntEnum):
HK_ID = 0
class ActionId(enum.IntEnum):
TC_MEM_WRITE = 1
TC_MEM_READ = 2
FLASH_WRITE = 9
TM_MEM_READ_RPT = 6
TC_FLASH_WRITE_FULL_FILE = 9
TC_FLASH_DELETE = 10
TC_REPLAY_START = 11
TC_REPLAY_STOP = 12
@ -64,28 +82,40 @@ class CommandId(enum.IntEnum):
TC_MODE_REPLAY = 16
TC_CAM_CMD_SEND = 17
TC_MODE_IDLE = 18
TM_CAM_CMD_RPT = 19
SET_UART_TX_TRISTATE = 20
RELEASE_UART_TX = 21
TC_CAM_TAKE_PIC = 22
TC_SIMPLEX_SEND_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
class OpCode:
ON = ["on"]
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"]
REPLAY_START = ["replay_start"]
CAM_TAKE_PIC = ["cam_take_pic"]
SIMPLEX_SEND_FILE = ["simplex_send_file"]
DOWNLINK_DATA_MODULATE = ["downlink_data_modulate"]
MODE_SNAPSHOT = ["mode_snapshot"]
ON = "on"
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"
MEM_READ = "memory_read"
DOWNLINK_PWR_OFF = "downlink_pwr_off"
FLASH_WRITE_FILE = "flash_write_file"
FLASH_READ_FILE = "flash_read_file"
FLASH_DELETE_FILE = "flash_delete_file"
FLASH_GET_DIR_CONTENT = "flash_get_dir_content"
REPLAY_STOP = "replay_stop"
REPLAY_START = "replay_start"
CAM_TAKE_PIC = "cam_take_pic"
SIMPLEX_SEND_FILE = "simplex_send_file"
DOWNLINK_DATA_MODULATE = "downlink_data_modulate"
MODE_SNAPSHOT = "mode_snapshot"
class Info:
@ -94,12 +124,18 @@ class Info:
NORMAL = "Normal"
VERIFY_BOOT = "Verify boot by reading 0xdeadbeef from DEADBEEF address"
MODE_REPLAY = "Switch to REPLAY mode"
REPLAY_STOP = "Stop Replay"
MODE_IDLE = "Switch to IDLE mode"
REPLAY_WRITE_SEQ = "Replay write sequence"
DOWNLINK_PWR_ON = "Downlink Power On"
DOWNLINK_PWR_OFF = "Downlink Power Off"
REPLAY_START = "Replay Start"
CAM_TAKE_PIC = "Cam Take Picture"
SIMPLEX_SEND_FILE = "Simplex Send File"
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"
FLASH_GET_DIR_CONTENT = "Get flash directory content on MPSoC"
DOWNLINK_DATA_MODULATE = "Downlink data modulate"
MODE_SNAPSHOT = "Mode Snapshot"
@ -108,28 +144,25 @@ class MemAddresses(enum.IntEnum):
DEADBEEF = 0x40000004
class PlocReplyIds(enum.IntEnum):
TM_MEM_READ_RPT = 6
TM_CAM_CMD_RPT = 19
@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("3", "Ploc MPSoC: Memory write")
oce.add("4", "Ploc MPSoC: Memory read")
oce.add("5", "Ploc MPSoC: Flash write")
oce.add("6", "Ploc MPSoC: Flash delete")
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("8", "Ploc MPSoC: Replay stop")
oce.add(OpCode.REPLAY_STOP, Info.REPLAY_STOP)
oce.add(OpCode.DOWNLINK_PWR_ON, Info.DOWNLINK_PWR_ON)
oce.add("10", "Ploc MPSoC: Downlink pwr off")
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, "Ploc MPSoC: Read DEADBEEF address")
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")
@ -152,19 +185,19 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
f"Generate command for PLOC MPSoC with object id: {object_id.as_hex_string}"
)
obyt = object_id.as_bytes
if op_code in OpCode.OFF:
if op_code == OpCode.OFF:
q.add_log_cmd(f"{prefix}: {Info.OFF}")
command = pack_mode_data(obyt, Mode.OFF, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
if op_code in OpCode.ON:
if op_code == OpCode.ON:
q.add_log_cmd(f"{prefix}: {Info.ON}")
data = pack_mode_data(obyt, Mode.ON, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if op_code in OpCode.NORMAL:
if op_code == OpCode.NORMAL:
q.add_log_cmd(f"{prefix}: {Info.NORMAL}")
data = pack_mode_data(object_id.as_bytes, Mode.NORMAL, 0)
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
if op_code == "3":
if op_code == OpCode.MEM_WRITE:
q.add_log_cmd("PLOC MPSoC: TC mem write test")
memory_address = int(
input("PLOC MPSoC: Tc Mem Write: Type memory address: 0x"), 16
@ -180,11 +213,15 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
q.add_log_cmd("PLOC MPSoC: TC mem read test")
data = prepare_mem_read_command(object_id=object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "5":
q.add_log_cmd("PLOC MPSoC: Flash write")
if op_code == OpCode.FLASH_WRITE_FILE:
q.add_log_cmd(f"{prefix}: {Info.FLASH_WRITE_FILE}")
data = prepare_flash_write_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "6":
if op_code == OpCode.FLASH_READ_FILE:
q.add_log_cmd(f"{prefix}: {Info.FLASH_READ_FILE}")
data = prepare_flash_read_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == OpCode.FLASH_DELETE_FILE:
q.add_log_cmd("PLOC MPSoC: Flash delete")
data = prepare_flash_delete_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
@ -192,76 +229,88 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
q.add_log_cmd(f"{prefix}: {Info.REPLAY_START}")
data = prepare_replay_start_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "8":
if op_code == OpCode.REPLAY_STOP:
q.add_log_cmd("PLOC MPSoC: Replay stop")
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_REPLAY_STOP)
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_REPLAY_STOP)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code in OpCode.DOWNLINK_PWR_ON:
if op_code == OpCode.DOWNLINK_PWR_ON:
q.add_log_cmd(f"{prefix}: {OpCode.DOWNLINK_PWR_ON}")
data = prepare_downlink_pwr_on_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "10":
if op_code == OpCode.DOWNLINK_PWR_OFF:
q.add_log_cmd("PLOC MPSoC: Downlink pwr off")
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_DOWNLINK_PWR_OFF)
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_DOWNLINK_PWR_OFF)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code in OpCode.REPLAY_WRITE_SEQ:
if op_code == OpCode.FLASH_GET_DIR_CONTENT:
q.add_log_cmd(f"{prefix}: {Info.FLASH_GET_DIR_CONTENT}")
dir_name = input("Please specify MPSoC directory name to get information for: ")
dir_name = bytearray(dir_name.encode("utf-8"))
dir_name.append(0)
q.add_pus_tc(
create_action_cmd(
object_id=object_id.as_bytes,
action_id=ActionId.TC_FLASH_DIR_GET_CONTENT,
user_data=dir_name,
)
)
if op_code == OpCode.REPLAY_WRITE_SEQ:
q.add_log_cmd(f"{prefix}: {Info.REPLAY_WRITE_SEQ}")
data = prepare_replay_write_sequence_cmd(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "12":
q.add_log_cmd("PLOC MPSoC: Reset OBSW sequence count")
data = object_id.as_bytes + struct.pack("!I", CommandId.OBSW_RESET_SEQ_COUNT)
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 op_code in OpCode.VERIFY_BOOT:
if op_code == OpCode.VERIFY_BOOT:
num_words = 1
q.add_log_cmd(f"{prefix} {Info.VERIFY_BOOT}")
data = (
object_id.as_bytes
+ struct.pack("!I", CommandId.TC_MEM_READ)
+ 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 op_code in OpCode.MODE_REPLAY:
if op_code == OpCode.MODE_REPLAY:
q.add_log_cmd("PLOC MPSoC: Tc mode replay")
data = object_id.as_bytes + struct.pack("!I", CommandId.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 op_code in OpCode.MODE_IDLE:
if op_code == OpCode.MODE_IDLE:
q.add_log_cmd("PLOC MPSoC: Tc mode idle")
data = object_id.as_bytes + struct.pack("!I", CommandId.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 op_code == "16":
q.add_log_cmd("PLOC MPSoC: Tc cam command send")
cam_cmd = input("Specify cam command string: ")
data = (
object_id.as_bytes
+ struct.pack("!I", CommandId.TC_CAM_CMD_SEND)
+ struct.pack("!I", ActionId.TC_CAM_CMD_SEND)
+ bytearray(cam_cmd, "utf-8")
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "17":
q.add_log_cmd("PLOC MPSoC: Set UART TX tristate")
data = object_id.as_bytes + struct.pack("!I", CommandId.SET_UART_TX_TRISTATE)
data = object_id.as_bytes + struct.pack("!I", ActionId.SET_UART_TX_TRISTATE)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == "18":
q.add_log_cmd("PLOC MPSoC: Release UART TX")
data = object_id.as_bytes + struct.pack("!I", CommandId.RELEASE_UART_TX)
data = object_id.as_bytes + struct.pack("!I", ActionId.RELEASE_UART_TX)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code in OpCode.CAM_TAKE_PIC:
if op_code == OpCode.CAM_TAKE_PIC:
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 op_code in OpCode.SIMPLEX_SEND_FILE:
if op_code == 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 op_code in OpCode.DOWNLINK_DATA_MODULATE:
if op_code == 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 op_code in OpCode.MODE_SNAPSHOT:
if op_code == OpCode.MODE_SNAPSHOT:
q.add_log_cmd("PLOC MPSoC: Mode snapshot")
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_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))
@ -278,7 +327,7 @@ def generate_write_mem_command(
"""
command = (
object_id
+ struct.pack("!I", CommandId.TC_MEM_WRITE)
+ struct.pack("!I", ActionId.TC_MEM_WRITE)
+ struct.pack("!I", memory_address)
+ struct.pack("!H", mem_len)
+ struct.pack("!I", memory_data)
@ -291,31 +340,48 @@ def prepare_mem_read_command(object_id: bytes) -> bytearray:
num_words = int(input("PLOC MPSoC specify number of words (32-bit) to read: "))
command = (
object_id
+ struct.pack("!I", CommandId.TC_MEM_READ)
+ struct.pack("!I", ActionId.TC_MEM_READ)
+ struct.pack("!I", memory_address)
+ struct.pack("!H", num_words)
)
return bytearray(command)
def prepare_flash_base_cmd(
obc_filename: str, mpsoc_filename: str, action_id: int, object_id: bytes
) -> bytearray:
command = bytearray(object_id)
command.extend(struct.pack("!I", action_id))
command.extend(obc_filename.encode("utf-8"))
command.append(0)
command.extend(mpsoc_filename.encode("utf-8"))
command.append(0)
return command
def prepare_flash_write_cmd(object_id: bytes) -> bytearray:
obc_file = get_obc_file()
mpsoc_file = get_mpsoc_file()
command = (
object_id
+ struct.pack("!I", CommandId.FLASH_WRITE)
+ bytearray(obc_file, "utf-8")
+ bytearray(mpsoc_file, "utf-8")
obc_file = get_obc_file(OBC_WRITE_FILE_DICT)
mpsoc_file = get_mpsoc_file(MPSOC_WRITE_FILE_DICT)
return prepare_flash_base_cmd(
obc_file, mpsoc_file, ActionId.TC_FLASH_WRITE_FULL_FILE, object_id
)
return bytearray(command)
def prepare_flash_read_cmd(object_id: bytes) -> bytearray:
mpsoc_file = get_mpsoc_file(MPSOC_READ_FILE_DICT)
obc_file = get_obc_file(OBC_READ_FILE_DICT)
cmd = prepare_flash_base_cmd(
obc_file, mpsoc_file, ActionId.TC_FLASH_READ_FULL_FILE, object_id
)
file_size = get_mpsoc_file_size()
cmd.extend(struct.pack("!I", file_size))
return cmd
def prepare_flash_delete_cmd(object_id: bytes) -> bytearray:
file = get_mpsoc_file()
file = get_mpsoc_file(MPSOC_READ_FILE_DICT)
command = (
object_id
+ struct.pack("!I", CommandId.TC_FLASH_DELETE)
+ bytearray(file, "utf-8")
object_id + struct.pack("!I", ActionId.TC_FLASH_DELETE) + file.encode("utf-8")
)
return bytearray(command)
@ -324,7 +390,7 @@ def prepare_replay_start_cmd(object_id: bytes) -> bytearray:
replay = int(input("Specify replay mode (0 - once, 1 - repeated): "))
command = (
object_id
+ struct.pack("!I", CommandId.TC_REPLAY_START)
+ struct.pack("!I", ActionId.TC_REPLAY_START)
+ struct.pack("!B", replay)
)
return bytearray(command)
@ -335,7 +401,7 @@ def prepare_downlink_pwr_on_cmd(object_id: bytes) -> bytearray:
lane_rate = int(input("Specify lane rate (0 - 9): "))
command = (
object_id
+ struct.pack("!I", CommandId.TC_DOWNLINK_PWR_ON)
+ struct.pack("!I", ActionId.TC_DOWNLINK_PWR_ON)
+ struct.pack("!B", mode)
+ struct.pack("!B", lane_rate)
)
@ -347,7 +413,7 @@ def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
file = get_sequence_file()
command = (
object_id
+ struct.pack("!I", CommandId.TC_REPLAY_WRITE_SEQUENCE)
+ struct.pack("!I", ActionId.TC_REPLAY_WRITE_SEQUENCE)
+ struct.pack("!B", use_decoding)
+ bytearray(file, "utf-8")
# + bytes([0])
@ -377,7 +443,7 @@ def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
bypass_compressor = int(input("Specify bypassCompressor: "))
command = (
object_id
+ struct.pack("!I", CommandId.TC_CAM_TAKE_PIC)
+ struct.pack("!I", ActionId.TC_CAM_TAKE_PIC)
+ bytearray(filename, "utf-8")
+ bytes([0])
+ struct.pack("!B", encoder_setting_y)
@ -395,7 +461,7 @@ def prepare_simplex_send_file_cmd(object_id: bytes) -> bytearray:
filename = input("Specify filename: ")
command = (
object_id
+ struct.pack("!I", CommandId.TC_SIMPLEX_SEND_FILE)
+ struct.pack("!I", ActionId.TC_SIMPLEX_SEND_FILE)
+ bytearray(filename, "utf-8")
+ bytes([0])
)
@ -409,7 +475,7 @@ def prepare_downlink_data_modulate_cmd(object_id: bytes) -> bytearray:
dest_mem_addr = int(input("Specify destMemAddr: "))
command = (
object_id
+ struct.pack("!I", CommandId.TC_DOWNLINK_DATA_MODULATE)
+ struct.pack("!I", ActionId.TC_DOWNLINK_DATA_MODULATE)
+ struct.pack("!B", format)
+ struct.pack("!I", src_mem_addr)
+ struct.pack("!H", src_mem_len)
@ -418,28 +484,35 @@ def prepare_downlink_data_modulate_cmd(object_id: bytes) -> bytearray:
return bytearray(command)
def get_obc_file() -> str:
_LOGGER.info("Specify OBC file ")
input_helper = InputHelper(flash_write_file_dict)
def get_obc_file(input_dict: dict) -> str:
_LOGGER.info("Specify OBC filename")
input_helper = InputHelper(input_dict)
key = input_helper.get_key()
if key == MANUAL_INPUT:
file = input("Ploc MPSoC: Specify absolute name of flash file: ")
else:
file = flash_write_file_dict[key][1]
file = input_dict[key][1]
return file
def get_mpsoc_file() -> str:
_LOGGER.info("Specify MPSoC file")
input_helper = InputHelper(mpsoc_file_dict)
def get_mpsoc_file(input_dict: dict) -> str:
_LOGGER.info("Specify MPSoC filename")
input_helper = InputHelper(input_dict)
key = input_helper.get_key()
if key == MANUAL_INPUT:
file = input("Ploc MPSoC: Specify absolute name file: ")
else:
file = mpsoc_file_dict[key][1]
file = input_dict[key][1]
return file
def get_mpsoc_file_size() -> int:
file_size = int(input("Specify MPSoC file size: "))
if file_size <= 0:
raise ValueError("Invalid file size")
return file_size
def get_sequence_file() -> str:
_LOGGER.info("Specify sequence file")
input_helper = InputHelper(SEQ_FILE_DICT)
@ -449,3 +522,192 @@ def get_sequence_file() -> str:
else:
file = SEQ_FILE_DICT[key][1]
return file
def handle_ploc_mpsoc_hk_data(printer: FsfwTmTcPrinter, hk_data: bytes, set_id: int):
pw = PrintWrapper(printer)
if set_id == SetId.HK_ID:
fmt_str = "!IBBBBBBB"
current_idx = 0
inc_len = struct.calcsize(fmt_str)
(
status,
mode,
downlink_pwr_on,
downlink_reply_active,
downlink_jesd_sync_status,
downlink_dac_status,
cam_status,
cam_sdi_status,
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
current_idx += inc_len
pw.ilog(_LOGGER, "Received MPSoC HK")
pw.dlog(f"Status: {status}")
pw.dlog(f"Mode: {mode}")
pw.dlog(f"Downlink Power On: {downlink_pwr_on}")
pw.dlog(f"Downlink Reply Active: {downlink_reply_active}")
pw.dlog(f"Downlink JESD Sync Status: {downlink_jesd_sync_status}")
pw.dlog(f"Downlink DAC Status: {downlink_dac_status}")
pw.dlog(f"CAM Status: {cam_status}")
pw.dlog(f"CAM SDI Status: {cam_sdi_status}")
fmt_str = "!fffffffff"
inc_len = struct.calcsize(fmt_str)
(
cam_fpga_temp,
cam_soc_temp,
sysmon_temp,
sysmon_vcc_int,
sysmon_vcc_aux,
sysmon_vcc_bram,
sysmon_vcc_paux,
sysmon_vcc_pint,
sysmon_vcc_pdro,
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
current_idx += inc_len
pw.dlog(f"CAM FPGA Temperature: {cam_fpga_temp}")
pw.dlog(f"CAM SoC Temperature: {cam_soc_temp}")
pw.dlog(f"System Monitor Temperature: {sysmon_temp}")
pw.dlog(
f"SYSMON VCC INT {sysmon_vcc_int:.3f} | SYSMON VCC AUX {sysmon_vcc_aux:.3f} | "
f"SYSMON VCC BRAM {sysmon_vcc_bram:.3f}"
)
pw.dlog(
f"SYSMON VCC PAUX {sysmon_vcc_paux:.3f} | SYSMON VCC PINT {sysmon_vcc_pint:.3f} | "
f"SYSMON VCC PDRO {sysmon_vcc_pdro:.3f}"
)
fmt_str = "!fffffffffffff"
inc_len = struct.calcsize(fmt_str)
(
sysmon_mb_12v,
sysmon_mb_3v3,
sysmon_mb_1v8,
sysmon_vcc_12v,
sysmon_vcc_5v,
sysmon_vcc_3v3,
sysmon_vcc_3v3va,
sysmon_vcc_2v5ddr,
sysmon_vcc_1v2ddr,
sysmon_vcc_0v9,
sysmon_vcc_0v6vtt,
sysmon_safe_cotr_cur,
sysmon_nvm4_xo_cur,
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
current_idx += inc_len
pw.dlog(
f"SYSMON MB 12V {sysmon_mb_12v:.3f} | SYSMON MB 3V3 {sysmon_mb_3v3:.3f} | "
f"SYSMON MBA 1V8 {sysmon_mb_1v8:.3f}"
)
pw.dlog(
f"SYSMON VCC 12V {sysmon_vcc_12v:.3f} | SYSMON VCC 5V {sysmon_vcc_5v:.3f} | "
f"SYSMON VCC 3V3 {sysmon_vcc_3v3:.3f} | SYSMON VCC 3V3VA {sysmon_vcc_3v3va}"
)
pw.dlog(
f"SYSMON VCC 2V5DDR {sysmon_vcc_2v5ddr:.3f} | "
f"SYSMON VCC 1V2DDR {sysmon_vcc_1v2ddr:.3f} | "
f"SYSMON VCC 0V9 {sysmon_vcc_0v9:.3f} | "
f"SYSMON VCC 0V6VTT {sysmon_vcc_0v6vtt}"
)
pw.dlog(
f"SYSMON SAFE COTS CURR: {sysmon_safe_cotr_cur} | "
f"SYSMON NVM4XO CURR {sysmon_nvm4_xo_cur}"
)
fmt_str = "!HHBB"
inc_len = struct.calcsize(fmt_str)
(
sem_uncorrectable_errs,
sem_correctable_errs,
sem_status,
reboot_mpsoc_required,
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
pw.dlog(f"SEM IP Uncorrectable Errors: {sem_uncorrectable_errs}")
pw.dlog(f"SEM IP Correctable Errors: {sem_correctable_errs}")
pw.dlog(f"SEM IP Status: {sem_status}")
pw.dlog(f"Reboot MPSoC required: {reboot_mpsoc_required}")
else:
_LOGGER.warning(f"Unknown set ID {set_id} for MPSoC HK")
pass
@dataclasses.dataclass
class DirElement:
name: str
attr: int
size: int
def handle_mpsoc_data_reply(
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
):
pw = PrintWrapper(printer)
if action_id == ActionId.TM_MEM_READ_RPT:
header_list = [
"PLOC Memory Address",
"PLOC Mem Len",
"PLOC Read Memory Data",
]
content_list = [
"0x" + custom_data[:4].hex(),
struct.unpack("!H", custom_data[4:6])[0],
"0x" + custom_data[6:10].hex(),
]
print(header_list)
print(content_list)
printer.file_logger.info(header_list)
printer.file_logger.info(content_list)
elif action_id == ActionId.TM_CAM_CMD_RPT:
header_list = ["Camera reply string", "ACK"]
content_list = [
custom_data[: len(custom_data) - 1].decode("utf-8"),
hex(custom_data[-1]),
]
print(header_list)
print(content_list)
printer.file_logger.info(header_list)
printer.file_logger.info(content_list)
elif action_id == ActionId.TM_FLASH_DIRECTORY_CONTENT:
if len(custom_data) < 16:
_LOGGER.warning(
"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")
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 = []
expected_size = 16 + num_elements * 17
if len(custom_data) < expected_size:
_LOGGER.warning(
f"PLOC MPSoC flash directory data shorter than expected {expected_size}"
)
pw.dlog(
f"Received PLOC MPSoC flash directory content for path {dir_name_short} "
f"with {num_elements} elements"
)
# 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"
)
current_idx += 12
elem_names.append(elem_name)
for _ in range(num_elements):
elem_attrs.append(custom_data[current_idx])
current_idx += 1
for _ in range(num_elements):
elem_sizes.append(
struct.unpack("!I", custom_data[current_idx : current_idx + 4])[0]
)
current_idx += 4
for i in range(num_elements):
pw.dlog(f"{DirElement(elem_names[i], elem_attrs[i], elem_sizes[i])}")

View File

@ -181,6 +181,7 @@ PDU1_DICT = {
Pdu1ChIndex.SYRLINKS: Pdu1InfoBase.SYRLINKS,
Pdu1ChIndex.MGT: Pdu1InfoBase.MGT,
Pdu1ChIndex.SCEX: Pdu1InfoBase.SCEX,
Pdu1ChIndex.PLOC: Pdu1InfoBase.PLOC,
Pdu1ChIndex.ACS_A: Pdu1InfoBase.ACS_A,
Pdu1ChIndex.SUS_N: Pdu1InfoBase.SUS_N,
}