From 42152ab711ce575ac51dac7e1eb55c3163d238f3 Mon Sep 17 00:00:00 2001 From: meggert Date: Fri, 12 May 2023 11:07:14 +0200 Subject: [PATCH 1/8] fixed gps altitude fdir --- mission/controller/acs/SensorProcessing.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mission/controller/acs/SensorProcessing.cpp b/mission/controller/acs/SensorProcessing.cpp index 4cc15a16..b106baaa 100644 --- a/mission/controller/acs/SensorProcessing.cpp +++ b/mission/controller/acs/SensorProcessing.cpp @@ -573,7 +573,7 @@ void SensorProcessing::processGps(const double gpsLatitude, const double gpsLong // Altitude FDIR if (gpsAltitude > gpsParameters->maximumFdirAltitude || - gpsAltitude < gpsParameters->maximumFdirAltitude) { + gpsAltitude < gpsParameters->minimumFdirAltitude) { altitude = gpsParameters->fdirAltitude; } else { altitude = gpsAltitude; From f71a363385b6b63e615c762bc9494d8f1ebac924 Mon Sep 17 00:00:00 2001 From: meggert Date: Fri, 12 May 2023 11:08:41 +0200 Subject: [PATCH 2/8] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fea60176..c33e49f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ will consitute of a breaking change warranting a new major release: without an additional PCDU power switch command. - The PLOC Supervisor handler now waits for the replies to the `SET_TIME` command to verify working communication. +- Fixed correction for `GPS Altitude` in case the sensor data is out of the expected bonds. # [v2.0.5] 2023-05-11 From 699fc9a861243cd428d29b4b9c9e47da8f5b2358 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 May 2023 12:14:37 +0200 Subject: [PATCH 3/8] some HK corrections --- linux/payload/PlocMpsocHandler.cpp | 2 ++ linux/payload/PlocMpsocHandler.h | 2 +- tmtc | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 1e904cd0..9c2aee4a 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -445,6 +445,7 @@ ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& loc localDataPoolMap.emplace(mpsoc::poolid::STATUS, &peStatus); localDataPoolMap.emplace(mpsoc::poolid::MODE, &peMode); localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_PWR_ON, &peDownlinkPwrOn); + localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_REPLY_ACTIIVE, &peDownlinkReplyActive); localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_JESD_SYNC_STATUS, &peDownlinkJesdSyncStatus); localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_DAC_STATUS, &peDownlinkDacStatus); localDataPoolMap.emplace(mpsoc::poolid::CAM_STATUS, &peCameraStatus); @@ -462,6 +463,7 @@ ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& loc localDataPoolMap.emplace(mpsoc::poolid::SYSMON_MB3V3, &peSysmonMb3V3); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_MB1V8, &peSysmonMb1V8); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC12V, &peSysmonVcc12V); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC5V, &peSysmonVcc5V); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC3V3, &peSysmonVcc3V3); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC3V3VA, &peSysmonVcc3V3VA); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC2V5DDR, &peSysmonVcc2V5DDR); diff --git a/linux/payload/PlocMpsocHandler.h b/linux/payload/PlocMpsocHandler.h index c9850e18..d814f086 100644 --- a/linux/payload/PlocMpsocHandler.h +++ b/linux/payload/PlocMpsocHandler.h @@ -117,7 +117,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { SpacePacketCreator creator; ploc::SpTcParams spParams = ploc::SpTcParams(creator); - PoolEntry peStatus = PoolEntry(); + PoolEntry peStatus = PoolEntry(); PoolEntry peMode = PoolEntry(); PoolEntry peDownlinkPwrOn = PoolEntry(); PoolEntry peDownlinkReplyActive = PoolEntry(); diff --git a/tmtc b/tmtc index f090c3af..87e5abe8 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit f090c3af66d1a0b760344e80053d6e83895e661a +Subproject commit 87e5abe8ebb6a33d36445d43bcb6674b313626f1 From 2b999e7fa7feaae8c1d7fc26254a421da47abfcf Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 May 2023 12:37:25 +0200 Subject: [PATCH 4/8] requires some wait cycles --- linux/payload/PlocMpsocHandler.cpp | 68 +++++++++++++++++------------- linux/payload/PlocMpsocHandler.h | 2 + linux/payload/plocMpscoDefs.h | 3 +- 3 files changed, 41 insertions(+), 32 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 9c2aee4a..227180b4 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -152,32 +152,45 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI } void PlocMPSoCHandler::doStartUp() { + if (startupState == StartupState::IDLE) { + startupState = StartupState::HW_INIT; + } + if (startupState == StartupState::HW_INIT) { #ifdef XIPHOS_Q7S #if not OBSW_MPSOC_JTAG_BOOT == 1 - switch (powerState) { - case PowerState::OFF: - commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC); - powerState = PowerState::BOOTING; - break; - case PowerState::ON: - hkReport.setReportingEnabled(true); - setMode(_MODE_TO_ON); - uartIsolatorSwitch.pullHigh(); - break; - default: - break; - } + switch (powerState) { + case PowerState::OFF: + commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC); + powerState = PowerState::BOOTING; + return; + case PowerState::ON: + uartIsolatorSwitch.pullHigh(); + startupState = StartupState::WAIT_CYCLES; + break; + default: + return; + } #else - powerState = PowerState::ON; - hkReport.setReportingEnabled(true); - setMode(_MODE_TO_ON); - uartIsolatorSwitch.pullHigh(); + uartIsolatorSwitch.pullHigh(); + startupState = StartupState::WAIT_CYCLE; #endif /* not MSPOC_JTAG_BOOT == 1 */ #else - powerState = PowerState::ON; - hkReport.setReportingEnabled(true); - setMode(_MODE_TO_ON); + startupState = StartupState::WAIT_CYCLES; + powerState = PowerState::ON; #endif /* XIPHOS_Q7S */ + } + if (startupState == StartupState::WAIT_CYCLES) { + waitCycles++; + if (waitCycles == 2) { + startupState = StartupState::DONE; + waitCycles = 0; + } + } + if (startupState == StartupState::DONE) { + setMode(_MODE_TO_ON); + hkReport.setReportingEnabled(true); + startupState = StartupState::IDLE; + } } void PlocMPSoCHandler::doShutDown() { @@ -205,11 +218,12 @@ void PlocMPSoCHandler::doShutDown() { powerState = PowerState::OFF; #endif #endif + startupState = StartupState::IDLE; } - ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { - if(getPendingCommand() == DeviceHandlerIF::NO_COMMAND_ID) { + // testCycles ++; + if (getPendingCommand() == DeviceHandlerIF::NO_COMMAND_ID) { *id = mpsoc::TC_GET_HK_REPORT; return buildCommandFromCommand(*id, nullptr, 0); } @@ -336,7 +350,6 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() { ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId, size_t* foundLen) { ReturnValue_t result = returnvalue::OK; - sif::debug << "remaining size: " << remainingSize << std::endl; SpacePacketReader spacePacket; spacePacket.setReadOnlyData(start, remainingSize); @@ -351,7 +364,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain switch (apid) { case (mpsoc::apid::ACK_SUCCESS): - sif::debug << "recv ack success" << std::endl; + sif::debug << "recv ack success" << std::endl; *foundLen = mpsoc::SIZE_ACK_REPORT; *foundId = mpsoc::ACK_REPORT; break; @@ -369,14 +382,12 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain *foundId = mpsoc::TM_CAM_CMD_RPT; break; case (mpsoc::apid::TM_HK_GET_REPORT): { - sif::debug << "recv hk report" << std::endl; *foundLen = spacePacket.getFullPacketLen(); foundPacketLen = *foundLen; *foundId = mpsoc::TM_GET_HK_REPORT; break; } case (mpsoc::apid::EXE_SUCCESS): - sif::debug << "recv exe success" << std::endl; *foundLen = mpsoc::SIZE_EXE_REPORT; *foundId = mpsoc::EXE_REPORT; break; @@ -434,9 +445,7 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const return result; } -void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() { - hkReport.setValidity(false, true); -} +void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() { hkReport.setValidity(false, true); } uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; } @@ -1151,7 +1160,6 @@ size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) { replyLen = mpsoc::SP_MAX_SIZE; break; default: { - sif::debug << "reply length " << iter->second.replyLen << std::endl; replyLen = iter->second.replyLen; break; } diff --git a/linux/payload/PlocMpsocHandler.h b/linux/payload/PlocMpsocHandler.h index d814f086..2b6548ca 100644 --- a/linux/payload/PlocMpsocHandler.h +++ b/linux/payload/PlocMpsocHandler.h @@ -183,7 +183,9 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { size_t foundPacketLen = 0; TelemetryBuffer tmBuffer; + uint32_t waitCycles = 0; + enum class StartupState { IDLE, HW_INIT, WAIT_CYCLES, DONE } startupState; enum class PowerState { OFF, BOOTING, SHUTDOWN, ON }; PowerState powerState = PowerState::OFF; diff --git a/linux/payload/plocMpscoDefs.h b/linux/payload/plocMpscoDefs.h index 20d70d66..cd17d911 100644 --- a/linux/payload/plocMpscoDefs.h +++ b/linux/payload/plocMpscoDefs.h @@ -882,8 +882,7 @@ class HkReport : public StaticLocalDataSet<36> { lp_var_t(sid.objectId, mpsoc::poolid::SEM_UNCORRECTABLE_ERRS, this); lp_var_t semCorrectableErrs = lp_var_t(sid.objectId, mpsoc::poolid::SEM_CORRECTABLE_ERRS, this); - lp_var_t semStatus = - lp_var_t(sid.objectId, mpsoc::poolid::SEM_CORRECTABLE_ERRS, this); + lp_var_t semStatus = lp_var_t(sid.objectId, mpsoc::poolid::SEM_STATUS, this); lp_var_t rebootMpsocRequired = lp_var_t(sid.objectId, mpsoc::poolid::REBOOT_MPSOC_REQUIRED, this); }; From 9391949369ea5494e128ee317680b627cdfff832 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 May 2023 12:39:54 +0200 Subject: [PATCH 5/8] speed up payload components a bit --- bsp_q7s/core/scheduling.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp_q7s/core/scheduling.cpp b/bsp_q7s/core/scheduling.cpp index f2cd8229..5866ce8c 100644 --- a/bsp_q7s/core/scheduling.cpp +++ b/bsp_q7s/core/scheduling.cpp @@ -366,7 +366,7 @@ void scheduling::initTasks() { #endif /* OBSW_ADD_PLOC_SUPERVISOR */ PeriodicTaskIF* plTask = factory->createPeriodicTask( - "PL_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc, &RR_SCHEDULING); + "PL_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, missedDeadlineFunc, &RR_SCHEDULING); plTask->addComponent(objects::CAM_SWITCHER); scheduling::addMpsocSupvHandlers(plTask); scheduling::scheduleScexDev(plTask); From 90d289f56eaa5cb3bdc412d532942d27e4122a62 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 May 2023 13:23:17 +0200 Subject: [PATCH 6/8] works now --- linux/payload/PlocMpsocHandler.cpp | 19 +++++++++++++------ linux/payload/PlocMpsocHandler.h | 3 ++- tmtc | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 227180b4..ef92c796 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -172,16 +172,18 @@ void PlocMPSoCHandler::doStartUp() { } #else uartIsolatorSwitch.pullHigh(); - startupState = StartupState::WAIT_CYCLE; + startupState = StartupState::WAIT_CYCLES; #endif /* not MSPOC_JTAG_BOOT == 1 */ #else startupState = StartupState::WAIT_CYCLES; powerState = PowerState::ON; #endif /* XIPHOS_Q7S */ } + // Need to wait, MPSoC still not booted properly, requesting HK without these wait cycles does + // not work, no replies.. if (startupState == StartupState::WAIT_CYCLES) { waitCycles++; - if (waitCycles == 2) { + if (waitCycles >= 10) { startupState = StartupState::DONE; waitCycles = 0; } @@ -222,9 +224,9 @@ void PlocMPSoCHandler::doShutDown() { } ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { - // testCycles ++; - if (getPendingCommand() == DeviceHandlerIF::NO_COMMAND_ID) { + if (not normalCmdPending) { *id = mpsoc::TC_GET_HK_REPORT; + normalCmdPending = true; return buildCommandFromCommand(*id, nullptr, 0); } return NOTHING_TO_SEND; @@ -364,7 +366,6 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain switch (apid) { case (mpsoc::apid::ACK_SUCCESS): - sif::debug << "recv ack success" << std::endl; *foundLen = mpsoc::SIZE_ACK_REPORT; *foundId = mpsoc::ACK_REPORT; break; @@ -447,7 +448,7 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() { hkReport.setValidity(false, true); } -uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; } +uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 10000; } ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) { @@ -767,9 +768,15 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) { switch (apid) { case (mpsoc::apid::EXE_SUCCESS): { + if (normalCmdPending) { + normalCmdPending = false; + } break; } case (mpsoc::apid::EXE_FAILURE): { + if (normalCmdPending) { + normalCmdPending = false; + } // TODO: Interpretation of status field in execution report sif::warning << "PlocMPSoCHandler::handleExecutionReport: Received execution failure report" << std::endl; diff --git a/linux/payload/PlocMpsocHandler.h b/linux/payload/PlocMpsocHandler.h index 2b6548ca..d201aeaf 100644 --- a/linux/payload/PlocMpsocHandler.h +++ b/linux/payload/PlocMpsocHandler.h @@ -108,6 +108,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { mpsoc::HkReport hkReport; + bool normalCmdPending = false; MessageQueueIF* eventQueue = nullptr; MessageQueueIF* commandActionHelperQueue = nullptr; @@ -185,7 +186,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { TelemetryBuffer tmBuffer; uint32_t waitCycles = 0; - enum class StartupState { IDLE, HW_INIT, WAIT_CYCLES, DONE } startupState; + enum class StartupState { IDLE, HW_INIT, WAIT_CYCLES, DONE } startupState = StartupState::IDLE; enum class PowerState { OFF, BOOTING, SHUTDOWN, ON }; PowerState powerState = PowerState::OFF; diff --git a/tmtc b/tmtc index 87e5abe8..377e98b5 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 87e5abe8ebb6a33d36445d43bcb6674b313626f1 +Subproject commit 377e98b5c2da12f10cdd12b027548a8075fdcb58 From 9715612e4608c0d49aeb2e81748c15d1cc91c15e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 May 2023 13:24:14 +0200 Subject: [PATCH 7/8] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f435358..a5944e7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,8 @@ will consitute of a breaking change warranting a new major release: without an additional PCDU power switch command. - The PLOC Supervisor handler now waits for the replies to the `SET_TIME` command to verify working communication. +- The PLOC MPSoC now waits 10 cycles before going to on. These wait cycles are necessary because + the MPSoC is not ready to process commands without this additional boot time. # [v2.0.5] 2023-05-11 From a3b119fda67b0bd3e29f95330933f470d3c87719 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 May 2023 13:26:15 +0200 Subject: [PATCH 8/8] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3580df9b..189be00e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ will consitute of a breaking change warranting a new major release: - Add ACS board for EM by default now. - Add support for MPSoC HK packet. - Dynamically enable and disable HK packets for MPSoC on `ON` and `OFF` commands. +- Increase frequency of payload handlers from 0.8 seconds to 0.5 seconds. ## Added