diff --git a/CHANGELOG.md b/CHANGELOG.md index f5ddee34..8841cd0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ will consitute of a breaking change warranting a new major release: - Add support for MPSoC HK packet. - Add support for MPSoC Flash Directory Content Report. - 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 @@ -53,6 +54,9 @@ 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. +- Fixed correction for `GPS Altitude` in case the sensor data is out of the expected bonds. # [v2.0.5] 2023-05-11 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); diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 451fab12..481c6b09 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -152,32 +152,47 @@ 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_CYCLES; #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 */ + } + // 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 >= 10) { + startupState = StartupState::DONE; + waitCycles = 0; + } + } + if (startupState == StartupState::DONE) { + setMode(_MODE_TO_ON); + hkReport.setReportingEnabled(true); + startupState = StartupState::IDLE; + } } void PlocMPSoCHandler::doShutDown() { @@ -205,12 +220,13 @@ void PlocMPSoCHandler::doShutDown() { powerState = PowerState::OFF; #endif #endif + startupState = StartupState::IDLE; } - ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { - 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; @@ -342,7 +358,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); @@ -362,7 +377,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; @@ -386,7 +400,6 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain break; } case (mpsoc::apid::EXE_SUCCESS): - sif::debug << "recv exe success" << std::endl; *foundLen = mpsoc::SIZE_EXE_REPORT; *foundId = mpsoc::EXE_REPORT; break; @@ -461,13 +474,14 @@ 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) { 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); @@ -485,6 +499,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); @@ -786,9 +801,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; @@ -1190,7 +1211,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 a6a866ef..654cded4 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; @@ -117,7 +118,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(); @@ -183,7 +184,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 = StartupState::IDLE; enum class PowerState { OFF, BOOTING, SHUTDOWN, ON }; PowerState powerState = PowerState::OFF; diff --git a/linux/payload/plocMpscoDefs.h b/linux/payload/plocMpscoDefs.h index c42e61df..de123719 100644 --- a/linux/payload/plocMpscoDefs.h +++ b/linux/payload/plocMpscoDefs.h @@ -905,8 +905,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); }; 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; diff --git a/tmtc b/tmtc index 87e5abe8..377e98b5 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 87e5abe8ebb6a33d36445d43bcb6674b313626f1 +Subproject commit 377e98b5c2da12f10cdd12b027548a8075fdcb58