From 04c081f4aa4015265b1505e6ef5e13306bd3ae48 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Oct 2023 13:52:56 +0200 Subject: [PATCH 1/8] transition --- mission/controller/PowerController.cpp | 7 +++++++ mission/controller/PowerController.h | 1 + 2 files changed, 8 insertions(+) diff --git a/mission/controller/PowerController.cpp b/mission/controller/PowerController.cpp index 7b7db9e8..f31c589f 100644 --- a/mission/controller/PowerController.cpp +++ b/mission/controller/PowerController.cpp @@ -370,3 +370,10 @@ ReturnValue_t PowerController::calculateCoulombCounterChargeUpperThreshold() { lookUpTableOcv[0][lookUpTableIdx + 1]); return returnvalue::OK; } + +void PowerController::startTransition(Mode_t mode, Submode_t submode) { + if (mode == MODE_OFF) { + enablePl.setValidity(false, true); + } + ControllerBase::startTransition(mode, submode); +} diff --git a/mission/controller/PowerController.h b/mission/controller/PowerController.h index 1f27616d..8777fe53 100644 --- a/mission/controller/PowerController.h +++ b/mission/controller/PowerController.h @@ -22,6 +22,7 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM ReturnValue_t getParameter(uint8_t domainId, uint8_t parameterId, ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues, uint16_t startAtIndex) override; + void startTransition(Mode_t mode, Submode_t submode) override; private: bool enableHkSets = false; From f0cafedda7e035aec0b6fc89fca40bdc04a6154d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Oct 2023 14:10:51 +0200 Subject: [PATCH 2/8] this is better --- mission/controller/PowerController.cpp | 18 ++++++------------ mission/controller/PowerController.h | 1 - 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/mission/controller/PowerController.cpp b/mission/controller/PowerController.cpp index f31c589f..2a735782 100644 --- a/mission/controller/PowerController.cpp +++ b/mission/controller/PowerController.cpp @@ -100,15 +100,16 @@ void PowerController::performControlOperation() { return; } case InternalState::READY: { + if (mode != MODE_NORMAL) { + PoolReadGuard pg(&enablePl); + if (pg.getReadResult() == returnvalue::OK) { + enablePl.setValidity(false, true); + } + } if (mode != MODE_OFF) { calculateStateOfCharge(); if (mode == MODE_NORMAL) { watchStateOfCharge(); - } else { - PoolReadGuard pg(&enablePl); - if (pg.getReadResult() == returnvalue::OK) { - enablePl.setValidity(false, true); - } } } break; @@ -370,10 +371,3 @@ ReturnValue_t PowerController::calculateCoulombCounterChargeUpperThreshold() { lookUpTableOcv[0][lookUpTableIdx + 1]); return returnvalue::OK; } - -void PowerController::startTransition(Mode_t mode, Submode_t submode) { - if (mode == MODE_OFF) { - enablePl.setValidity(false, true); - } - ControllerBase::startTransition(mode, submode); -} diff --git a/mission/controller/PowerController.h b/mission/controller/PowerController.h index 8777fe53..1f27616d 100644 --- a/mission/controller/PowerController.h +++ b/mission/controller/PowerController.h @@ -22,7 +22,6 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM ReturnValue_t getParameter(uint8_t domainId, uint8_t parameterId, ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues, uint16_t startAtIndex) override; - void startTransition(Mode_t mode, Submode_t submode) override; private: bool enableHkSets = false; From b8e73637448f125aafdbde93ee57f90ce95e4c7e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Oct 2023 14:36:30 +0200 Subject: [PATCH 3/8] mpsoc debug opt --- linux/payload/PlocMpsocHandler.cpp | 25 ++++++++++++++++++++----- linux/payload/PlocMpsocHandler.h | 2 ++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 66fba6d8..94fe4588 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -348,10 +348,17 @@ void PlocMpsocHandler::fillCommandAndReplyMap() { ReturnValue_t PlocMpsocHandler::scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId, size_t* foundLen) { + // sif::debug << "received reply with length" << remainingSize << std::endl; + // arrayprinter::print(start, remainingSize); ReturnValue_t result = returnvalue::OK; SpacePacketReader spacePacket; spacePacket.setReadOnlyData(start, remainingSize); + if (DEBUG_MPSOC_COMMUNICATION) { + sif::debug << "RECV MPSOC packet. APID 0x" << std::hex << std::setw(3) << spacePacket.getApid() + << std::dec << " Size " << spacePacket.getFullPacketLen() << " SSC " + << spacePacket.getSequenceCount() << std::endl; + } if (spacePacket.isNull()) { return returnvalue::FAILED; } @@ -467,7 +474,7 @@ void PlocMpsocHandler::setNormalDatapoolEntriesInvalid() { hkReport.setValidity(false, true); } -uint32_t PlocMpsocHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 10000; } +uint32_t PlocMpsocHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 15000; } ReturnValue_t PlocMpsocHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) { @@ -700,6 +707,12 @@ ReturnValue_t PlocMpsocHandler::finishTcPrep(mpsoc::TcBase& tcBase) { rawPacket = commandBuffer; rawPacketLen = tcBase.getFullPacketLen(); sequenceCount++; + + if (DEBUG_MPSOC_COMMUNICATION) { + sif::debug << "SEND MPSOC packet. APID 0x" << std::hex << std::setw(3) << tcBase.getApid() + << " Size " << std::dec << tcBase.getFullPacketLen() << " SSC " + << tcBase.getSeqCount() << std::endl; + } return returnvalue::OK; } @@ -1223,10 +1236,12 @@ void PlocMpsocHandler::dataReceived(ActionId_t actionId, const uint8_t* data, ui void PlocMpsocHandler::completionSuccessfulReceived(ActionId_t actionId) { if (actionId == supv::ACK_REPORT) { - sif::warning - << "PlocMpsocHandler::completionSuccessfulReceived: Only received ACK report. Consider " - "increasing the MPSoC boot timer." - << std::endl; + // I seriously don't know why this happens.. + // sif::warning + // << "PlocMpsocHandler::completionSuccessfulReceived: Only received ACK report. Consider + // " + // "increasing the MPSoC boot timer." + // << std::endl; } else if (actionId != supv::EXE_REPORT) { sif::warning << "PlocMpsocHandler::completionSuccessfulReceived: Did not expect the action " << "ID " << actionId << std::endl; diff --git a/linux/payload/PlocMpsocHandler.h b/linux/payload/PlocMpsocHandler.h index 0203b942..6cce4951 100644 --- a/linux/payload/PlocMpsocHandler.h +++ b/linux/payload/PlocMpsocHandler.h @@ -17,6 +17,8 @@ #include "fsfw_hal/linux/gpio/Gpio.h" #include "fsfw_hal/linux/serial/SerialComIF.h" +static constexpr bool DEBUG_MPSOC_COMMUNICATION = true; + /** * @brief This is the device handler for the MPSoC of the payload computer. * From 0ada9562858e76baac560562d5ce5021ee0aa9b2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Oct 2023 14:46:02 +0200 Subject: [PATCH 4/8] some more debugging --- linux/payload/PlocMpsocHandler.cpp | 4 +++- linux/payload/PlocMpsocHandler.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 94fe4588..eedfb95e 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -91,6 +91,8 @@ ReturnValue_t PlocMpsocHandler::initialize() { void PlocMpsocHandler::performOperationHook() { if (commandIsPending and cmdCountdown.hasTimedOut()) { + sif::warning << "PlocMpsocHandler: Command " << getPendingCommand() << " has timed out" + << std::endl; commandIsPending = false; // TODO: Better returnvalue? cmdDoneHandler(false, returnvalue::FAILED); @@ -215,7 +217,6 @@ ReturnValue_t PlocMpsocHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) if (not commandIsPending and not specialComHelperExecuting) { *id = mpsoc::TC_GET_HK_REPORT; commandIsPending = true; - cmdCountdown.resetTimer(); return buildCommandFromCommand(*id, nullptr, 0); } return NOTHING_TO_SEND; @@ -713,6 +714,7 @@ ReturnValue_t PlocMpsocHandler::finishTcPrep(mpsoc::TcBase& tcBase) { << " Size " << std::dec << tcBase.getFullPacketLen() << " SSC " << tcBase.getSeqCount() << std::endl; } + cmdCountdown.resetTimer(); return returnvalue::OK; } diff --git a/linux/payload/PlocMpsocHandler.h b/linux/payload/PlocMpsocHandler.h index 6cce4951..216001d6 100644 --- a/linux/payload/PlocMpsocHandler.h +++ b/linux/payload/PlocMpsocHandler.h @@ -186,7 +186,7 @@ class PlocMpsocHandler : public DeviceHandlerBase, public CommandsActionsIF { }; TmMemReadReport tmMemReadReport; - Countdown cmdCountdown = Countdown(10000); + Countdown cmdCountdown = Countdown(12000); struct TelemetryBuffer { uint16_t length = 0; From aaf99b52b42e52eeaddc881648403541f61d5277 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Oct 2023 14:46:45 +0200 Subject: [PATCH 5/8] changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6d88025..d71df6e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Fixed + +- PL Enable set of the power controller is now set to invalid properly + if the power controller is not in normal mode. + # [v7.1.0] 2023-10-11 - Bumped `eive-tmtc` to v5.8.0. From 31bf896a6ce3ef7075dd1516ff4bfab3c7370cfd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Oct 2023 15:06:02 +0200 Subject: [PATCH 6/8] disable debug mode --- linux/payload/PlocMpsocHandler.cpp | 2 +- linux/payload/PlocMpsocHandler.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index eedfb95e..bca4280b 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -1507,7 +1507,7 @@ LocalPoolDataSetBase* PlocMpsocHandler::getDataSetHandle(sid_t sid) { bool PlocMpsocHandler::dontCheckQueue() { // The TC and TMs need to be handled strictly sequentially, so while a command is pending, - // more specifically while replies are still expected, do not check the queue.s + // more specifically while replies are still expected, do not check the queue. return commandIsPending; } diff --git a/linux/payload/PlocMpsocHandler.h b/linux/payload/PlocMpsocHandler.h index 216001d6..5d584943 100644 --- a/linux/payload/PlocMpsocHandler.h +++ b/linux/payload/PlocMpsocHandler.h @@ -17,7 +17,7 @@ #include "fsfw_hal/linux/gpio/Gpio.h" #include "fsfw_hal/linux/serial/SerialComIF.h" -static constexpr bool DEBUG_MPSOC_COMMUNICATION = true; +static constexpr bool DEBUG_MPSOC_COMMUNICATION = false; /** * @brief This is the device handler for the MPSoC of the payload computer. @@ -186,7 +186,7 @@ class PlocMpsocHandler : public DeviceHandlerBase, public CommandsActionsIF { }; TmMemReadReport tmMemReadReport; - Countdown cmdCountdown = Countdown(12000); + Countdown cmdCountdown = Countdown(10000); struct TelemetryBuffer { uint16_t length = 0; From 718277da283b48a38b0e040948506bb2e4554bb9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Oct 2023 15:18:32 +0200 Subject: [PATCH 7/8] remove dcommented code --- linux/payload/PlocMpsocHandler.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index bca4280b..34053c70 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -349,8 +349,6 @@ void PlocMpsocHandler::fillCommandAndReplyMap() { ReturnValue_t PlocMpsocHandler::scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId, size_t* foundLen) { - // sif::debug << "received reply with length" << remainingSize << std::endl; - // arrayprinter::print(start, remainingSize); ReturnValue_t result = returnvalue::OK; SpacePacketReader spacePacket; From c268977b3d75217effb825f01f39371499258ebc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Oct 2023 15:30:17 +0200 Subject: [PATCH 8/8] changelog --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d71df6e5..09055dd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,8 +18,9 @@ will consitute of a breaking change warranting a new major release: ## Fixed -- PL Enable set of the power controller is now set to invalid properly - if the power controller is not in normal mode. +- PL Enable set of the power controller is now set to invalid properly if the power controller + is not in normal mode. +- MPSoC debug mode. # [v7.1.0] 2023-10-11