proper post reset handling for PDEC reset
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-04-14 19:29:22 +02:00
parent 644a768778
commit 62d18826f1
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
5 changed files with 31 additions and 14 deletions

View File

@ -107,18 +107,7 @@ ReturnValue_t PdecHandler::firstLoop() {
return result;
}
// This configuration must be done while the PDEC is not held in reset.
if (OP_MODE == Modes::IRQ) {
// Configure interrupt mask register to enable interrupts
*(registerBaseAddress + PDEC_IMR_OFFSET) = pdecConfig.getImrReg();
}
result = resetFarStatFlag();
if (result != returnvalue::OK) {
// Requires reconfiguration and reinitialization of PDEC
triggerEvent(INVALID_FAR);
return result;
}
return returnvalue::OK;
return postResetOperation();
}
ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) {
@ -785,6 +774,27 @@ void PdecHandler::pdecResetNoInit() {
pdecToReset();
usleep(20);
releasePdec();
ReturnValue_t result = postResetOperation();
if (result != returnvalue::OK) {
// What can we really do here? Event was already triggered if this is due to the FAR flag
// not being reset.
sif::error << "PdecHandler::pdecResetNoInit: Post reset operation failed unexpectedly"
<< std::endl;
}
}
ReturnValue_t PdecHandler::postResetOperation() {
// This configuration must be done while the PDEC is not held in reset.
if (OP_MODE == Modes::IRQ) {
// Configure interrupt mask register to enable interrupts
*(registerBaseAddress + PDEC_IMR_OFFSET) = pdecConfig.getImrReg();
}
ReturnValue_t result = resetFarStatFlag();
if (result != returnvalue::OK) {
// Requires reconfiguration and reinitialization of PDEC
triggerEvent(INVALID_FAR);
}
return result;
}
std::string PdecHandler::getMonStatusString(uint32_t status) {

View File

@ -365,6 +365,8 @@ class PdecHandler : public SystemObject,
void pdecResetNoInit();
ReturnValue_t postResetOperation();
void initFailedHandler(ReturnValue_t reason);
std::string getMonStatusString(uint32_t status);

View File

@ -278,11 +278,14 @@ ReturnValue_t EiveSystem::sendFullRebootCommand() {
}
void EiveSystem::pdecRecoveryLogic() {
if (ptmeResetWasAttempted and ptmeResetWasAttemptedCd.hasTimedOut()) {
ptmeResetWasAttempted = false;
}
if (frameDirtyCheckCd.hasTimedOut()) {
if (frameDirtyErrorCounter >= 4) {
// If a PTME reset was already attempted and there is still an issue receiving TC frames,
// reboot the system.
if (ptmeResetWasAttemptedCd.isBusy()) {
if (ptmeResetWasAttempted) {
// Send reboot command.
sendFullRebootCommand();
} else {
@ -292,6 +295,7 @@ void EiveSystem::pdecRecoveryLogic() {
ActionMessage::setCommand(&msg, pdec::RESET_PDEC_WITH_REINIITALIZATION, dummy);
commandQueue->sendMessage(pdecHandlerQueueId, &msg);
ptmeResetWasAttemptedCd.resetTimer();
ptmeResetWasAttempted = true;
}
}
frameDirtyErrorCounter = 0;

View File

@ -40,6 +40,7 @@ class EiveSystem : public Subsystem, public HasActionsIF {
// If the PDEC reset was already attempted in the last 2 minutes, there is a high chance that
// only a full reboot will fix the issue.
Countdown ptmeResetWasAttemptedCd = Countdown(120000);
bool ptmeResetWasAttempted = false;
ActionHelper actionHelper;
PowerSwitchIF* powerSwitcher = nullptr;

2
tmtc

@ -1 +1 @@
Subproject commit 183cd859073899d7f4d7a2f485eacd17d774fe50
Subproject commit 63c584e061a8e0d27189d66fb3ac1c48d011afe7