Merge pull request 'impl MPSoC HK parsing' (#188) from mpsoc_commands into main

Reviewed-on: #188
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
This commit is contained in:
Marius Eggert 2023-05-04 15:30:49 +02:00
commit 13fd9a7d84
2 changed files with 119 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import logging
# from pus_tm.tcp_server_objects import TCP_SEVER_SENSOR_TEMPERATURES # 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.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.tcs.rtd import RTD_NAMES, handle_rtd_hk
from eive_tmtc.tmtc.acs.star_tracker import handle_str_hk_data from eive_tmtc.tmtc.acs.star_tracker import handle_str_hk_data
from eive_tmtc.tmtc.power.plpcdu import handle_plpcdu_hk from eive_tmtc.tmtc.power.plpcdu import handle_plpcdu_hk
@ -117,6 +118,10 @@ def handle_regular_hk_print(
return handle_pdu_data( return handle_pdu_data(
printer=printer, pdu_idx=2, set_id=set_id, hk_data=hk_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: elif objb == obj_ids.ACU_HANDLER_ID:
return handle_acu_hk_data(printer=printer, hk_data=hk_data, set_id=set_id) return handle_acu_hk_data(printer=printer, hk_data=hk_data, set_id=set_id)
elif objb == obj_ids.RAD_SENSOR_ID: elif objb == obj_ids.RAD_SENSOR_ID:

View File

@ -12,6 +12,7 @@ import enum
from eive_tmtc.config.definitions import CustomServiceList from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.config.object_ids import get_object_ids, PLOC_MPSOC_ID 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 ( from tmtccmd.config.tmtc import (
tmtc_definitions_provider, tmtc_definitions_provider,
OpCodeEntry, OpCodeEntry,
@ -23,6 +24,7 @@ from tmtccmd.tc.decorator import ServiceProviderParams
from eive_tmtc.utility.input_helper import InputHelper from eive_tmtc.utility.input_helper import InputHelper
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode 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.tc.pus_8_fsfw_funccmd import create_action_cmd
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -50,6 +52,10 @@ SEQ_FILE_DICT = {
CARRIAGE_RETURN = 0xD CARRIAGE_RETURN = 0xD
class SetId(enum.IntEnum):
HK_ID = 0
class ActionId(enum.IntEnum): class ActionId(enum.IntEnum):
TC_MEM_WRITE = 1 TC_MEM_WRITE = 1
TC_MEM_READ = 2 TC_MEM_READ = 2
@ -496,3 +502,111 @@ def get_sequence_file() -> str:
else: else:
file = SEQ_FILE_DICT[key][1] file = SEQ_FILE_DICT[key][1]
return file 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.dlog("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])
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