From 90d289f56eaa5cb3bdc412d532942d27e4122a62 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 May 2023 13:23:17 +0200 Subject: [PATCH] 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