device commands

This commit is contained in:
Jakob Meier 2022-03-31 11:36:50 +02:00
parent c1a8170945
commit 5ac8912dd2
9 changed files with 127 additions and 30 deletions

View File

@ -13,7 +13,7 @@
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" />
<option name="PARAMETERS" value="-s ploc_mpsoc -t 6 -l" />
<option name="PARAMETERS" value="-s ploc_mpsoc -t 6" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />

View File

@ -13,7 +13,7 @@
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" />
<option name="PARAMETERS" value="-s syrlinks -l -t 6" />
<option name="PARAMETERS" value="-s syrlinks -t 6" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />

View File

@ -6,16 +6,16 @@
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="C:\Users\jakob\AppData\Local\Programs\Python\Python39\python.exe" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="false" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" />
<option name="PARAMETERS" value="-s ccsds_handler -l -t 8 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />

View File

@ -6,9 +6,9 @@
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="C:\Users\jakob\AppData\Local\Programs\Python\Python39\python.exe" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="false" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />

View File

@ -350,6 +350,18 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
"Syrlinks Handler: Read TX AGC value low byte ",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"12": (
"Syrlinks Handler: Write LCL config",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"13": (
"Syrlinks Handler: Read RX status registers",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"14": (
"Syrlinks Handler: Read LCL config register",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
}
service_syrlinks_handler_tuple = (
"Syrlinks Handler",

View File

@ -461,6 +461,10 @@ def add_rad_sens_cmds(cmd_dict: ServiceOpCodeDictT):
"0": ("Radiation Sensor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"1": ("Radiation Sensor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
"2": ("Radiation Sensor: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"3": ("Radiation Sensor: Start conversions", {OpCodeDictKeys.TIMEOUT: 2.0}),
"4": ("Radiation Sensor: Read conversions", {OpCodeDictKeys.TIMEOUT: 2.0}),
"5": ("Radiation Sensor: Enable debug output", {OpCodeDictKeys.TIMEOUT: 2.0}),
"6": ("Radiation Sensor: Disable debug putput", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_rad_sensor_tuple = ("Radiation Sensor", op_code_dict_srv_rad_sensor)
cmd_dict[CustomServiceList.RAD_SENSOR.value] = service_rad_sensor_tuple
@ -468,18 +472,21 @@ def add_rad_sens_cmds(cmd_dict: ServiceOpCodeDictT):
def add_ploc_mpsoc_cmds(cmd_dict: ServiceOpCodeDictT):
op_code_dict_srv_ploc_mpsoc = {
"0": ("Ploc MPSoC: Memory write", {OpCodeDictKeys.TIMEOUT: 2.0}),
"1": ("Ploc MPSoC: Memory read", {OpCodeDictKeys.TIMEOUT: 2.0}),
"2": ("Ploc MPSoC: Flash write", {OpCodeDictKeys.TIMEOUT: 2.0}),
"3": ("Ploc MPSoC: Flash delete", {OpCodeDictKeys.TIMEOUT: 2.0}),
"4": ("Ploc MPSoC: Replay start", {OpCodeDictKeys.TIMEOUT: 2.0}),
"5": ("Ploc MPSoC: Replay stop", {OpCodeDictKeys.TIMEOUT: 2.0}),
"6": ("Ploc MPSoC: Downlink pwr on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"7": ("Ploc MPSoC: Downlink pwr off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"8": ("Ploc MPSoC: Replay write sequence", {OpCodeDictKeys.TIMEOUT: 2.0}),
"9": ("Ploc MPSoC: OBSW reset sequence count", {OpCodeDictKeys.TIMEOUT: 2.0}),
"10": ("Ploc MPSoC: Read DEADBEEF address", {OpCodeDictKeys.TIMEOUT: 2.0}),
"11": ("Ploc MPSoC: Mode replay", {OpCodeDictKeys.TIMEOUT: 2.0}),
"0": ("Ploc MPSoC: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"1": ("Ploc MPSoC: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"2": ("Ploc MPSoC: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
"3": ("Ploc MPSoC: Memory write", {OpCodeDictKeys.TIMEOUT: 2.0}),
"4": ("Ploc MPSoC: Memory read", {OpCodeDictKeys.TIMEOUT: 2.0}),
"5": ("Ploc MPSoC: Flash write", {OpCodeDictKeys.TIMEOUT: 2.0}),
"6": ("Ploc MPSoC: Flash delete", {OpCodeDictKeys.TIMEOUT: 2.0}),
"7": ("Ploc MPSoC: Replay start", {OpCodeDictKeys.TIMEOUT: 2.0}),
"8": ("Ploc MPSoC: Replay stop", {OpCodeDictKeys.TIMEOUT: 2.0}),
"9": ("Ploc MPSoC: Downlink pwr on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"10": ("Ploc MPSoC: Downlink pwr off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"11": ("Ploc MPSoC: Replay write sequence", {OpCodeDictKeys.TIMEOUT: 2.0}),
"12": ("Ploc MPSoC: OBSW reset sequence count", {OpCodeDictKeys.TIMEOUT: 2.0}),
"13": ("Ploc MPSoC: Read DEADBEEF address", {OpCodeDictKeys.TIMEOUT: 2.0}),
"14": ("Ploc MPSoC: Mode replay", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_ploc_mpsoc_tuple = ("Ploc MPSoC", op_code_dict_srv_ploc_mpsoc)
cmd_dict[CustomServiceList.PLOC_MPSOC.value] = service_ploc_mpsoc_tuple

View File

@ -14,6 +14,7 @@ from tmtccmd.utility.logger import get_console_logger
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand
from utility.input_helper import InputHelper
from tmtccmd.tc.service_200_mode import pack_mode_data, Modes
LOGGER = get_console_logger()
@ -69,6 +70,25 @@ def pack_ploc_mpsoc_commands(
)
if op_code == "0":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC MPSoC: Set mode off")
)
command = pack_mode_data(object_id, Modes.OFF, 0)
command = PusTelecommand(service=200, subservice=1, ssc=9, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC MPSoC: Set mode on")
)
command = pack_mode_data(object_id, Modes.ON, 0)
command = PusTelecommand(service=200, subservice=1, ssc=10, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "2":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Mode Normal"))
command = pack_mode_data(object_id, Modes.NORMAL, 0)
command = PusTelecommand(service=200, subservice=1, ssc=11, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: TC mem write test"))
memory_address = int(input("PLOC MPSoC: Tc Mem Write: Type memory address: 0x"), 16)
memory_data = int(input("PLOC MPSoC: Tc Mem Write: Type memory data: 0x"), 16)
@ -79,59 +99,59 @@ def pack_ploc_mpsoc_commands(
)
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "1":
elif op_code == "4":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: TC mem read test"))
command = prepare_mem_read_command(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "2":
elif op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Flash write"))
command = prepare_flash_write_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "3":
elif op_code == "6":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Flash delete"))
command = prepare_flash_delete_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "4":
elif op_code == "7":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Replay start"))
command = prepare_replay_start_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "5":
elif op_code == "8":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Replay stop"))
command = object_id + struct.pack('!I', CommandIds.TC_REPLAY_STOP)
command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "6":
elif op_code == "9":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Downlink pwr on"))
command = prepare_downlink_pwr_on_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "7":
elif op_code == "10":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Downlink pwr off"))
command = object_id + struct.pack('!I', CommandIds.TC_DOWNLINK_PWR_OFF)
command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "8":
elif op_code == "11":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Replay write sequence"))
command = prepare_replay_write_sequence_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "9":
elif op_code == "12":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Reset OBSW sequence count"))
command = object_id + struct.pack('!I', CommandIds.OBSW_RESET_SEQ_COUNT)
command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "10":
elif op_code == "13":
num_words = 1
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Read DEADBEEF address"))
command = object_id + struct.pack('!I', CommandIds.TC_MEM_READ) + struct.pack("!I", MemAddresses.DEADBEEF) + \
struct.pack('!H', num_words)
command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "11":
elif op_code == "14":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Tc mode replay"))
command = object_id + struct.pack('!I', CommandIds.TC_MODE_REPLAY)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)

View File

@ -5,6 +5,8 @@
@author J. Meier
@date 01.07.2021
"""
import struct
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
@ -12,6 +14,13 @@ from spacepackets.ecss.tc import PusTelecommand
from pus_tc.service_200_mode import pack_mode_data
class CommandIds:
START_CONVERSIONS = 2
READ_CONVERSIONS = 3
ENABLE_DEBUG_OUTPUT = 4
DISABLE_DEBUG_OUTPUT = 5
def pack_rad_sensor_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft(
(
@ -37,3 +46,27 @@ def pack_rad_sensor_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
mode_data = pack_mode_data(object_id, 0, 0)
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Start conversions"))
command = object_id + struct.pack('!I', CommandIds.START_CONVERSIONS)
command = PusTelecommand(service=8, subservice=128, ssc=43, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "4":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Read conversions"))
command = object_id + struct.pack('!I', CommandIds.READ_CONVERSIONS)
command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Enable debug output"))
command = object_id + struct.pack('!I', CommandIds.ENABLE_DEBUG_OUTPUT)
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "6":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Disable debug output"))
command = object_id + struct.pack('!I', CommandIds.DISABLE_DEBUG_OUTPUT)
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -11,6 +11,7 @@ from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.service_3_housekeeping import make_sid, generate_one_hk_command
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc.service_200_mode import pack_mode_data, Modes
import struct
class SetIds:
@ -26,6 +27,9 @@ class CommandIds:
READ_TX_WAVEFORM = bytearray([0x0, 0x0, 0x0, 0x8])
READ_TX_AGC_VALUE_HIGH_BYTE = bytearray([0x0, 0x0, 0x0, 0x9])
READ_TX_AGC_VALUE_LOW_BYTE = bytearray([0x0, 0x0, 0x0, 0x9])
WRITE_LCL_CONFIG = 11
READ_LCL_CONFIG_REGISTER = 12
READ_RX_STATUS_REGISTERS = 2
def pack_syrlinks_command(
@ -106,3 +110,24 @@ def pack_syrlinks_command(
command = object_id + CommandIds.READ_TX_AGC_VALUE_LOW_BYTE
command = PusTelecommand(service=8, subservice=128, ssc=16, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "12":
tc_queue.appendleft(
(QueueCommands.PRINT, "Syrlinks: Write LCL config")
)
command = object_id + struct.pack('!I', CommandIds.WRITE_LCL_CONFIG)
command = PusTelecommand(service=8, subservice=128, ssc=17, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "13":
tc_queue.appendleft(
(QueueCommands.PRINT, "Syrlinks: Read RX status registers")
)
command = object_id + struct.pack('!I', CommandIds.READ_RX_STATUS_REGISTERS)
command = PusTelecommand(service=8, subservice=128, ssc=18, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "14":
tc_queue.appendleft(
(QueueCommands.PRINT, "Syrlinks: Read LCL config register")
)
command = object_id + struct.pack('!I', CommandIds.READ_LCL_CONFIG_REGISTER)
command = PusTelecommand(service=8, subservice=128, ssc=19, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())