From c291caba7dc270faba10b40ae47a76b793101f72 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 19 Jan 2023 11:01:59 +0100 Subject: [PATCH 1/8] comment --- linux/ipcore/PdecConfig.cpp | 4 ++++ mission/devices/Max31865EiveHandler.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/linux/ipcore/PdecConfig.cpp b/linux/ipcore/PdecConfig.cpp index 321e5940..21de4610 100644 --- a/linux/ipcore/PdecConfig.cpp +++ b/linux/ipcore/PdecConfig.cpp @@ -9,8 +9,12 @@ PdecConfig::~PdecConfig() {} void PdecConfig::initialize() { uint32_t word = 0; word |= (VERSION_ID << 30); + + // Setting the bypass flag and the control command flag should not have any + // implication on the operation of the PDEC IP Core word |= (BYPASS_FLAG << 29); word |= (CONTROL_COMMAND_FLAG << 28); + word |= (RESERVED_FIELD_A << 26); word |= (SPACECRAFT_ID << 16); word |= (VIRTUAL_CHANNEL << 10); diff --git a/mission/devices/Max31865EiveHandler.cpp b/mission/devices/Max31865EiveHandler.cpp index db6f5a83..95dbe214 100644 --- a/mission/devices/Max31865EiveHandler.cpp +++ b/mission/devices/Max31865EiveHandler.cpp @@ -100,6 +100,7 @@ void Max31865EiveHandler::simpleCommand(EiveMax31855::RtdCommands cmd) { rawPacket = cmdBuf.data(); rawPacketLen = 1; } + void Max31865EiveHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { if (getMode() == _MODE_TO_NORMAL) { if (state != InternalState::ACTIVE) { From cc6c25cba6caaf05a6fb6925e7d56aff5265afc4 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 19 Jan 2023 13:20:24 +0100 Subject: [PATCH 2/8] command to rewrite config of RTDs --- linux/devices/Max31865RtdLowlevelHandler.cpp | 10 ++++++++-- mission/devices/Max31865EiveHandler.cpp | 7 +++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/linux/devices/Max31865RtdLowlevelHandler.cpp b/linux/devices/Max31865RtdLowlevelHandler.cpp index 38a9ac11..e75dfbee 100644 --- a/linux/devices/Max31865RtdLowlevelHandler.cpp +++ b/linux/devices/Max31865RtdLowlevelHandler.cpp @@ -143,7 +143,7 @@ ReturnValue_t Max31865RtdReader::periodicReadHandling() { auto result = returnvalue::OK; MutexGuard mg(readerMutex); if (mg.getLockResult() != returnvalue::OK) { - sif::warning << "Max31865RtdReader::periodicReadReqHandling: Mutex lock failed" << std::endl; + sif::warning << "Max31865RtdReader::periodicReadHandling: Mutex lock failed" << std::endl; return returnvalue::FAILED; } // Now read the RTD values @@ -282,7 +282,13 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se } break; } - case (EiveMax31855::RtdCommands::CFG): + case (EiveMax31855::RtdCommands::CFG): { + ReturnValue_t result = writeCfgReg(rtdCookie->spiCookie, BASE_CFG); + if (result != returnvalue::OK) { + handleSpiError(rtdCookie, result, "writeCfgReg"); + } + break; + } default: { // TODO: Only implement if needed break; diff --git a/mission/devices/Max31865EiveHandler.cpp b/mission/devices/Max31865EiveHandler.cpp index 95dbe214..433f7b58 100644 --- a/mission/devices/Max31865EiveHandler.cpp +++ b/mission/devices/Max31865EiveHandler.cpp @@ -69,7 +69,8 @@ ReturnValue_t Max31865EiveHandler::buildCommandFromCommand(DeviceCommandId_t dev switch (cmdTyped) { case (EiveMax31855::RtdCommands::ON): case (EiveMax31855::RtdCommands::ACTIVE): - case (EiveMax31855::RtdCommands::OFF): { + case (EiveMax31855::RtdCommands::OFF): + case (EiveMax31855::RtdCommands::CFG): { simpleCommand(cmdTyped); break; } @@ -77,9 +78,6 @@ ReturnValue_t Max31865EiveHandler::buildCommandFromCommand(DeviceCommandId_t dev case (EiveMax31855::RtdCommands::HIGH_TRESHOLD): { break; } - case (EiveMax31855::RtdCommands::CFG): { - break; - } default: return NOTHING_TO_SEND; } @@ -118,6 +116,7 @@ void Max31865EiveHandler::fillCommandAndReplyMap() { insertInCommandMap(EiveMax31855::RtdCommands::ON); insertInCommandMap(EiveMax31855::RtdCommands::ACTIVE); insertInCommandMap(EiveMax31855::RtdCommands::OFF); + insertInCommandMap(EiveMax31855::RtdCommands::CFG); insertInReplyMap(EiveMax31855::RtdCommands::EXCHANGE_SET_ID, 200, &sensorDataset, 0, true); } From 586cca2f39a294e52d54bdc62b8198cb998c5e6a Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 19 Jan 2023 13:22:05 +0100 Subject: [PATCH 3/8] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 43e6f0ce..88731237 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 43e6f0cefa2fd5dfe1f885ca9b818e1486dda568 +Subproject commit 887312371bbc7aad5f8fba1532cf5fc0d2d0470d From 111a91d98e3e120426047533922a6b046069bb42 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 19 Jan 2023 16:42:47 +0100 Subject: [PATCH 4/8] periodically rewrite config byte --- linux/devices/Max31865RtdLowlevelHandler.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux/devices/Max31865RtdLowlevelHandler.cpp b/linux/devices/Max31865RtdLowlevelHandler.cpp index e75dfbee..eb15f8f8 100644 --- a/linux/devices/Max31865RtdLowlevelHandler.cpp +++ b/linux/devices/Max31865RtdLowlevelHandler.cpp @@ -154,6 +154,10 @@ ReturnValue_t Max31865RtdReader::periodicReadHandling() { if (rtdIsActive(rtd->idx)) { uint16_t rtdVal = 0; bool faultBitSet = false; + result = writeCfgReg(rtd->spiCookie, BASE_CFG); + if (result != returnvalue::OK) { + handleSpiError(rtd, result, "writeCfgReg"); + } result = readRtdVal(rtd->spiCookie, rtdVal, faultBitSet); if (result != returnvalue::OK) { handleSpiError(rtd, result, "readRtdVal"); From 3751646c2ba7d7265aacbd01707071050f0a425a Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 19 Jan 2023 17:04:43 +0100 Subject: [PATCH 5/8] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 88731237..f3c0b756 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 887312371bbc7aad5f8fba1532cf5fc0d2d0470d +Subproject commit f3c0b7567aec22db02a07d76548617b8d163fb29 From 5670af71988b4c960ab402570f5113eff9462af9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 20 Jan 2023 10:44:44 +0100 Subject: [PATCH 6/8] bump changelog --- CHANGELOG.md | 1 + linux/devices/Max31865RtdLowlevelHandler.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 152bbead..495842c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ list yields a list of all related PRs for each release. - The ACS Controller Gyro Sets (raw and processed) and the MEKF dataset are diagnostics now. - Bumped FSFW for Service 11 improvement which includes size and CRC check for contained TC - Syrlinks module now always included for both EM and FM +- RTD: Config is now written before each temperature request. ## Fixed diff --git a/linux/devices/Max31865RtdLowlevelHandler.cpp b/linux/devices/Max31865RtdLowlevelHandler.cpp index eb15f8f8..14ef9659 100644 --- a/linux/devices/Max31865RtdLowlevelHandler.cpp +++ b/linux/devices/Max31865RtdLowlevelHandler.cpp @@ -156,7 +156,7 @@ ReturnValue_t Max31865RtdReader::periodicReadHandling() { bool faultBitSet = false; result = writeCfgReg(rtd->spiCookie, BASE_CFG); if (result != returnvalue::OK) { - handleSpiError(rtd, result, "writeCfgReg"); + handleSpiError(rtd, result, "writeCfgReg"); } result = readRtdVal(rtd->spiCookie, rtdVal, faultBitSet); if (result != returnvalue::OK) { @@ -287,11 +287,11 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se break; } case (EiveMax31855::RtdCommands::CFG): { - ReturnValue_t result = writeCfgReg(rtdCookie->spiCookie, BASE_CFG); - if (result != returnvalue::OK) { - handleSpiError(rtdCookie, result, "writeCfgReg"); - } - break; + ReturnValue_t result = writeCfgReg(rtdCookie->spiCookie, BASE_CFG); + if (result != returnvalue::OK) { + handleSpiError(rtdCookie, result, "writeCfgReg"); + } + break; } default: { // TODO: Only implement if needed From d2fe685a74c8e5a45b207ff0dced4ccc0c8d8481 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 20 Jan 2023 12:28:09 +0100 Subject: [PATCH 7/8] bump submodules --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index accaf855..bd189518 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit accaf855ee53d3dc429d7bcdf1b7b89768c166b6 +Subproject commit bd189518b6f91f25db1845e2657101e6bf46eec0 diff --git a/tmtc b/tmtc index f3c0b756..2b5ad32f 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit f3c0b7567aec22db02a07d76548617b8d163fb29 +Subproject commit 2b5ad32fdd56d38e8318027b67d091d9e0ea3aba From fecfa4b1c3fbde3e86d0833cdade30bf440e1b31 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 20 Jan 2023 12:29:17 +0100 Subject: [PATCH 8/8] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 495842c3..afe50bc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,9 @@ list yields a list of all related PRs for each release. previous range setting was wrong. Also fixed a small error properly set internal state on shut-down. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/342 +- `Max31865RtdLowlevelHandler.cpp`: For each RTD device, the config is now re-written before + every read. This seems to fix some issue with invalid temperature sensor readings. + PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/345 # [v1.19.0] 10.01.2023