From 7ffba2bbda562acb8444e471ffc285b2475ac526 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 17 Apr 2024 11:06:05 +0200 Subject: [PATCH] some more debugging capabilities --- linux/payload/FreshMpsocHandler.cpp | 15 ++++++++------- linux/payload/MpsocCommunication.cpp | 8 +++++++- linux/payload/MpsocCommunication.h | 2 ++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/linux/payload/FreshMpsocHandler.cpp b/linux/payload/FreshMpsocHandler.cpp index 723f366a..21c5197b 100644 --- a/linux/payload/FreshMpsocHandler.cpp +++ b/linux/payload/FreshMpsocHandler.cpp @@ -74,7 +74,6 @@ void FreshMpsocHandler::performDefaultDeviceOperation() { if (activeCmdInfo.pending and activeCmdInfo.cmdCountdown.hasTimedOut()) { sif::warning << "PlocMpsocHandler: Command " << activeCmdInfo.pendingCmd << " has timed out" << std::endl; - activeCmdInfo.reset(); cmdDoneHandler(false, mpsoc::COMMAND_TIMEOUT); } EventMessage event; @@ -301,7 +300,7 @@ void FreshMpsocHandler::handleTransitionToOn() { } } if (startupState == StartupState::DONE) { - setMode(MODE_ON); + setMode(targetMode, targetSubmode); transitionActive = false; hkReport.setReportingEnabled(true); powerState = PowerState::IDLE; @@ -350,6 +349,7 @@ void FreshMpsocHandler::dataReceived(ActionId_t actionId, const uint8_t* data, u } void FreshMpsocHandler::completionSuccessfulReceived(ActionId_t actionId) { + sif::debug << "received completion for action ID " << actionId << std::endl; switch (powerState) { case PowerState::PENDING_STARTUP: { if (actionId != supv::START_MPSOC) { @@ -373,6 +373,8 @@ void FreshMpsocHandler::completionSuccessfulReceived(ActionId_t actionId) { } void FreshMpsocHandler::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) { + sif::debug << "received completion failure for action ID " << actionId << " with code " + << returnCode << std::endl; handleActionCommandFailure(actionId, returnCode); } @@ -1059,13 +1061,12 @@ bool FreshMpsocHandler::handleHwStartup() { } } if (powerState == PowerState::DONE) { - if (mpsocBootTransitionCd.hasTimedOut()) { - // Wait a bit for the MPSoC to fully boot. - uartIsolatorSwitch.pullHigh(); - powerState = PowerState::IDLE; - } else { + // Wait a bit for the MPSoC to fully boot. + if (!mpsocBootTransitionCd.hasTimedOut()) { return false; } + uartIsolatorSwitch.pullHigh(); + powerState = PowerState::IDLE; } return true; } diff --git a/linux/payload/MpsocCommunication.cpp b/linux/payload/MpsocCommunication.cpp index b70d5243..bf68fda7 100644 --- a/linux/payload/MpsocCommunication.cpp +++ b/linux/payload/MpsocCommunication.cpp @@ -58,7 +58,13 @@ ReturnValue_t MpsocCommunication::readSerialInterface() { if (bytesRead < 0) { return returnvalue::FAILED; } - return readRingBuf.writeData(readBuf, bytesRead); + if (bytesRead > 0) { + if (MPSOC_LOW_LEVEL_RX_WIRETAPPING) { + sif::debug << "Read " << bytesRead << " bytes on the MPSoC interface" << std::endl; + } + return readRingBuf.writeData(readBuf, bytesRead); + } + return returnvalue::OK; } const SpacePacketReader& MpsocCommunication::getSpReader() const { return spReader; } diff --git a/linux/payload/MpsocCommunication.h b/linux/payload/MpsocCommunication.h index ec453b6c..e1c6d7a5 100644 --- a/linux/payload/MpsocCommunication.h +++ b/linux/payload/MpsocCommunication.h @@ -9,6 +9,8 @@ #include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h" #include "linux/payload/SerialCommunicationHelper.h" +static constexpr bool MPSOC_LOW_LEVEL_RX_WIRETAPPING = false; + class MpsocCommunication : public SystemObject { public: static const uint8_t CLASS_ID = CLASS_ID::PLOC_MPSOC_COM;