Merge branch 'cfdp-source-handler' of https://egit.irs.uni-stuttgart.de/eive/eive-obsw into cfdp-source-handler
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-09-13 13:09:35 +02:00
commit e415c35987
26 changed files with 126 additions and 52 deletions

View File

@ -25,11 +25,22 @@ will consitute of a breaking change warranting a new major release:
- Host build fixes
# [v6.5.1] 2023-09-12
- Bumped `eive-tmtc` to v5.5.0.
# [v6.5.0] 2023-09-12
## Changed
- Relaxed SUS FDIR. The devices have shown to be glitchy in orbit, but still seem to deliver
sensible raw values most of the time. Some further testing is necessary, but some changes in the
code should cause the SUS devices to remain healthy for now.
- The primary and the secondary temperature sensors for the PLOC mission boards are exchanged.
- ACS parameters for the SUSMGM (FLP) safe mode have been adjusted. This safe mode is now the
default one.
- MGM3100 Startup Configuration: Ignore bit 1 of the CMM reply, which is sometimes set to
1 in the reply for some reason.
# [v6.4.1] 2023-08-21

View File

@ -10,7 +10,7 @@
cmake_minimum_required(VERSION 3.13)
set(OBSW_VERSION_MAJOR 6)
set(OBSW_VERSION_MINOR 4)
set(OBSW_VERSION_MINOR 5)
set(OBSW_VERSION_REVISION 1)
# set(CMAKE_VERBOSE TRUE)

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 305 translations.
* @brief Auto-generated event translation file. Contains 307 translations.
* @details
* Generated on: 2023-09-07 16:12:51
* Generated on: 2023-09-12 10:51:47
*/
#include "translateEvents.h"
@ -310,6 +310,8 @@ const char *DUMP_NOK_CANCELLED_STRING = "DUMP_NOK_CANCELLED";
const char *DUMP_MISC_CANCELLED_STRING = "DUMP_MISC_CANCELLED";
const char *DUMP_HK_CANCELLED_STRING = "DUMP_HK_CANCELLED";
const char *DUMP_CFDP_CANCELLED_STRING = "DUMP_CFDP_CANCELLED";
const char *TEMPERATURE_ALL_ONES_START_STRING = "TEMPERATURE_ALL_ONES_START";
const char *TEMPERATURE_ALL_ONES_RECOVERY_STRING = "TEMPERATURE_ALL_ONES_RECOVERY";
const char *translateEvents(Event event) {
switch ((event & 0xFFFF)) {
@ -923,6 +925,10 @@ const char *translateEvents(Event event) {
return DUMP_HK_CANCELLED_STRING;
case (14314):
return DUMP_CFDP_CANCELLED_STRING;
case (14500):
return TEMPERATURE_ALL_ONES_START_STRING;
case (14501):
return TEMPERATURE_ALL_ONES_RECOVERY_STRING;
default:
return "UNKNOWN_EVENT";
}

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 171 translations.
* Generated on: 2023-09-07 16:12:51
* Generated on: 2023-09-12 10:51:47
*/
#include "translateObjects.h"

View File

@ -161,16 +161,9 @@ void ObjectFactory::produce(void* args) {
CcsdsIpCoreHandler* ipCoreHandler = nullptr;
CcsdsComponentArgs ccsdsArgs(*gpioComIF, *ipcStore, *tmStore, stores, *pusFunnel, *cfdpFunnel,
&ipCoreHandler);
createCcsdsComponents(ccsdsArgs);
#if OBSW_TM_TO_PTME == 1
if (ccsdsArgs.normalLiveTmDest != MessageQueueIF::NO_QUEUE) {
pusFunnel->addLiveDestinationByRawId("VC0 NORMAL LIVE TM", ccsdsArgs.normalLiveTmDest, 0);
}
if (ccsdsArgs.cfdpLiveTmDest != MessageQueueIF::NO_QUEUE) {
cfdpFunnel->addLiveDestinationByRawId("VC0 CFDP LIVE TM", ccsdsArgs.cfdpLiveTmDest, 0);
}
#endif
createCcsdsIpComponentsAddTmRouting(ccsdsArgs);
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
/* Test Task */
#if OBSW_ADD_TEST_CODE == 1
createTestComponents(gpioComIF);

View File

@ -111,13 +111,7 @@ void ObjectFactory::produce(void* args) {
CcsdsIpCoreHandler* ipCoreHandler = nullptr;
CcsdsComponentArgs ccsdsArgs(*gpioComIF, *ipcStore, *tmStore, stores, *pusFunnel, *cfdpFunnel,
&ipCoreHandler);
createCcsdsComponents(ccsdsArgs);
#if OBSW_TM_TO_PTME == 1
if (ccsdsArgs.liveDestination != nullptr) {
pusFunnel->addLiveDestination("VC0 LIVE TM", *ccsdsArgs.liveDestination, 0);
cfdpFunnel->addLiveDestination("VC0 LIVE TM", *ccsdsArgs.liveDestination, 0);
}
#endif
createCcsdsIpComponentsAddTmRouting(ccsdsArgs);
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
#if OBSW_ADD_SCEX_DEVICE == 1

View File

@ -1057,3 +1057,18 @@ ReturnValue_t ObjectFactory::readFirmwareVersion() {
}
return returnvalue::OK;
}
ReturnValue_t ObjectFactory::createCcsdsIpComponentsAddTmRouting(CcsdsComponentArgs& ccsdsArgs) {
CcsdsIpCoreHandler* ipCoreHandler = nullptr;
ReturnValue_t result = createCcsdsComponents(ccsdsArgs);
#if OBSW_TM_TO_PTME == 1
if (ccsdsArgs.normalLiveTmDest != MessageQueueIF::NO_QUEUE) {
ccsdsArgs.pusFunnel.addLiveDestinationByRawId("VC0 NORMAL LIVE TM", ccsdsArgs.normalLiveTmDest,
0);
}
if (ccsdsArgs.cfdpLiveTmDest != MessageQueueIF::NO_QUEUE) {
ccsdsArgs.cfdpFunnel.addLiveDestinationByRawId("VC0 CFDP LIVE TM", ccsdsArgs.cfdpLiveTmDest, 0);
}
#endif
return result;
}

View File

@ -75,6 +75,7 @@ void createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher, GpioIF& gp
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
void createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF& pwrSwitcher);
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
ReturnValue_t createCcsdsIpComponentsAddTmRouting(CcsdsComponentArgs& args);
ReturnValue_t createCcsdsComponents(CcsdsComponentArgs& args);
ReturnValue_t readFirmwareVersion();
void createMiscComponents();

View File

@ -40,6 +40,7 @@ enum : uint8_t {
COM_SUBSYSTEM = 142,
PERSISTENT_TM_STORE = 143,
SYRLINKS_COM = 144,
SUS_HANDLER = 145,
COMMON_SUBSYSTEM_ID_END
};

View File

@ -304,3 +304,5 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
14312;0x37e8;DUMP_MISC_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
14313;0x37e9;DUMP_HK_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
14314;0x37ea;DUMP_CFDP_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
14500;0x38a4;TEMPERATURE_ALL_ONES_START;MEDIUM;Detected invalid values, starting invalid message counting;mission/acs/SusHandler.h
14501;0x38a5;TEMPERATURE_ALL_ONES_RECOVERY;INFO;Detected valid values again, resetting invalid message counter. P1: Invalid message counter.;mission/acs/SusHandler.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
304 14312 0x37e8 DUMP_MISC_CANCELLED LOW P1: Number of dumped packets. P2: Total dumped bytes. mission/persistentTmStoreDefs.h
305 14313 0x37e9 DUMP_HK_CANCELLED LOW P1: Number of dumped packets. P2: Total dumped bytes. mission/persistentTmStoreDefs.h
306 14314 0x37ea DUMP_CFDP_CANCELLED LOW P1: Number of dumped packets. P2: Total dumped bytes. mission/persistentTmStoreDefs.h
307 14500 0x38a4 TEMPERATURE_ALL_ONES_START MEDIUM Detected invalid values, starting invalid message counting mission/acs/SusHandler.h
308 14501 0x38a5 TEMPERATURE_ALL_ONES_RECOVERY INFO Detected valid values again, resetting invalid message counter. P1: Invalid message counter. mission/acs/SusHandler.h

View File

@ -60,3 +60,4 @@
142;COM_SUBSYSTEM
143;PERSISTENT_TM_STORE
144;SYRLINKS_COM
145;SUS_HANDLER

1 22 MEMORY
60 142 COM_SUBSYSTEM
61 143 PERSISTENT_TM_STORE
62 144 SYRLINKS_COM
63 145 SUS_HANDLER

View File

@ -304,3 +304,5 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
14312;0x37e8;DUMP_MISC_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
14313;0x37e9;DUMP_HK_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
14314;0x37ea;DUMP_CFDP_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
14500;0x38a4;TEMPERATURE_ALL_ONES_START;MEDIUM;Detected invalid values, starting invalid message counting;mission/acs/SusHandler.h
14501;0x38a5;TEMPERATURE_ALL_ONES_RECOVERY;INFO;Detected valid values again, resetting invalid message counter. P1: Invalid message counter.;mission/acs/SusHandler.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
304 14312 0x37e8 DUMP_MISC_CANCELLED LOW P1: Number of dumped packets. P2: Total dumped bytes. mission/persistentTmStoreDefs.h
305 14313 0x37e9 DUMP_HK_CANCELLED LOW P1: Number of dumped packets. P2: Total dumped bytes. mission/persistentTmStoreDefs.h
306 14314 0x37ea DUMP_CFDP_CANCELLED LOW P1: Number of dumped packets. P2: Total dumped bytes. mission/persistentTmStoreDefs.h
307 14500 0x38a4 TEMPERATURE_ALL_ONES_START MEDIUM Detected invalid values, starting invalid message counting mission/acs/SusHandler.h
308 14501 0x38a5 TEMPERATURE_ALL_ONES_RECOVERY INFO Detected valid values again, resetting invalid message counter. P1: Invalid message counter. mission/acs/SusHandler.h

View File

@ -60,3 +60,4 @@
142;COM_SUBSYSTEM
143;PERSISTENT_TM_STORE
144;SYRLINKS_COM
145;SUS_HANDLER

1 22 MEMORY
60 142 COM_SUBSYSTEM
61 143 PERSISTENT_TM_STORE
62 144 SYRLINKS_COM
63 145 SUS_HANDLER

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 305 translations.
* @brief Auto-generated event translation file. Contains 307 translations.
* @details
* Generated on: 2023-09-07 16:12:51
* Generated on: 2023-09-12 10:51:47
*/
#include "translateEvents.h"
@ -310,6 +310,8 @@ const char *DUMP_NOK_CANCELLED_STRING = "DUMP_NOK_CANCELLED";
const char *DUMP_MISC_CANCELLED_STRING = "DUMP_MISC_CANCELLED";
const char *DUMP_HK_CANCELLED_STRING = "DUMP_HK_CANCELLED";
const char *DUMP_CFDP_CANCELLED_STRING = "DUMP_CFDP_CANCELLED";
const char *TEMPERATURE_ALL_ONES_START_STRING = "TEMPERATURE_ALL_ONES_START";
const char *TEMPERATURE_ALL_ONES_RECOVERY_STRING = "TEMPERATURE_ALL_ONES_RECOVERY";
const char *translateEvents(Event event) {
switch ((event & 0xFFFF)) {
@ -923,6 +925,10 @@ const char *translateEvents(Event event) {
return DUMP_HK_CANCELLED_STRING;
case (14314):
return DUMP_CFDP_CANCELLED_STRING;
case (14500):
return TEMPERATURE_ALL_ONES_START_STRING;
case (14501):
return TEMPERATURE_ALL_ONES_RECOVERY_STRING;
default:
return "UNKNOWN_EVENT";
}

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 175 translations.
* Generated on: 2023-09-07 16:12:51
* Generated on: 2023-09-12 10:51:47
*/
#include "translateObjects.h"

View File

@ -767,6 +767,9 @@ void AcsBoardPolling::mgmRm3100Handler(MgmRm3100& mgm) {
mgm.replyResult = result;
return;
}
// For some reason, bit 1 is sometimes set on the reply, even if it is not set for the
// command.. Ignore it for now by clearing it.
rawReply[1] &= ~(1 << 1);
if (rawReply[1] != mgmRm3100::CMM_VALUE) {
sif::error << "AcsBoardPolling: MGM RM3100 read back CMM invalid" << std::endl;
mgm.replyResult = result;

View File

@ -170,11 +170,6 @@ ReturnValue_t SusPolling::handleSusPolling() {
}
MutexGuard mg(ipcLock);
susDevs[idx].ownReply.tempRaw = ((rawReply[0] & 0x0f) << 8) | rawReply[1];
// Reply is all ones. Sensor is probably off or faulty when
// it should not be.
if (susDevs[idx].ownReply.tempRaw == 0x0fff) {
susDevs[idx].replyResult = returnvalue::FAILED;
} else {
susDevs[idx].replyResult = returnvalue::OK;
for (unsigned chIdx = 0; chIdx < 6; chIdx++) {
susDevs[idx].ownReply.channelsRaw[chIdx] =
@ -183,7 +178,6 @@ ReturnValue_t SusPolling::handleSusPolling() {
susDevs[idx].ownReply.dataWasSet = true;
}
}
}
return OK;
}

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 305 translations.
* @brief Auto-generated event translation file. Contains 307 translations.
* @details
* Generated on: 2023-09-07 16:12:51
* Generated on: 2023-09-12 10:51:47
*/
#include "translateEvents.h"
@ -310,6 +310,8 @@ const char *DUMP_NOK_CANCELLED_STRING = "DUMP_NOK_CANCELLED";
const char *DUMP_MISC_CANCELLED_STRING = "DUMP_MISC_CANCELLED";
const char *DUMP_HK_CANCELLED_STRING = "DUMP_HK_CANCELLED";
const char *DUMP_CFDP_CANCELLED_STRING = "DUMP_CFDP_CANCELLED";
const char *TEMPERATURE_ALL_ONES_START_STRING = "TEMPERATURE_ALL_ONES_START";
const char *TEMPERATURE_ALL_ONES_RECOVERY_STRING = "TEMPERATURE_ALL_ONES_RECOVERY";
const char *translateEvents(Event event) {
switch ((event & 0xFFFF)) {
@ -923,6 +925,10 @@ const char *translateEvents(Event event) {
return DUMP_HK_CANCELLED_STRING;
case (14314):
return DUMP_CFDP_CANCELLED_STRING;
case (14500):
return TEMPERATURE_ALL_ONES_START_STRING;
case (14501):
return TEMPERATURE_ALL_ONES_RECOVERY_STRING;
default:
return "UNKNOWN_EVENT";
}

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 175 translations.
* Generated on: 2023-09-07 16:12:51
* Generated on: 2023-09-12 10:51:47
*/
#include "translateObjects.h"

View File

@ -20,6 +20,9 @@ void SusHandler::doStartUp() {
}
if (internalState == InternalState::STARTUP) {
if (commandExecuted) {
if (waitingForRecovery) {
waitingForRecovery = false;
}
setMode(MODE_ON);
internalState = InternalState::NONE;
commandExecuted = false;
@ -83,15 +86,36 @@ ReturnValue_t SusHandler::scanForReply(const uint8_t *start, size_t len, DeviceC
}
ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
const auto *reply = reinterpret_cast<const acs::SusReply *>(packet);
if (reply->dataWasSet) {
if (!reply->dataWasSet) {
return returnvalue::OK;
}
if (internalState == InternalState::STARTUP) {
commandExecuted = true;
}
PoolReadGuard pg(&dataset);
// Simple FDIR variant to make the handler more robust to invalid messages which
// appear sometimes for the SUS device: Allow invalid message up to a certain threshold
// before triggering FDIR reactions.
if (reply->tempRaw == 0xfff and not waitingForRecovery) {
if (invalidMsgCounter == 0) {
triggerEvent(TEMPERATURE_ALL_ONES_START);
} else if (invalidMsgCounter == susMax1227::MAX_INVALID_MSG_COUNT) {
triggerEvent(DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT);
waitingForRecovery = true;
}
invalidMsgCounter++;
dataset.setValidity(false, true);
dataset.tempC = thermal::INVALID_TEMPERATURE;
std::memset(dataset.channels.value, 0, sizeof(dataset.channels.value));
return returnvalue::OK;
}
if (invalidMsgCounter > 0) {
triggerEvent(TEMPERATURE_ALL_ONES_RECOVERY, invalidMsgCounter);
invalidMsgCounter = 0;
}
dataset.setValidity(true, true);
dataset.tempC = max1227::getTemperature(reply->tempRaw);
std::memcpy(dataset.channels.value, reply->channelsRaw, sizeof(reply->channelsRaw));
}
return returnvalue::OK;
}

View File

@ -15,7 +15,15 @@ class SusHandler : public DeviceHandlerBase {
static constexpr DeviceCommandId_t REPLY = 0x77;
static const uint8_t INTERFACE_ID = CLASS_ID::SUS_HANDLER;
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SUS_BOARD_ASS;
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SUS_HANDLER;
//! [EXPORT] : [COMMENT] Detected invalid values, starting invalid message counting
static constexpr Event TEMPERATURE_ALL_ONES_START =
event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
//! [EXPORT] : [COMMENT] Detected valid values again, resetting invalid message counter.
//! P1: Invalid message counter.
static constexpr Event TEMPERATURE_ALL_ONES_RECOVERY =
event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO);
SusHandler(uint32_t objectId, uint8_t susIdx, object_id_t deviceCommunication,
CookieIF *comCookie);
@ -46,6 +54,8 @@ class SusHandler : public DeviceHandlerBase {
susMax1227::SusDataset dataset;
acs::SusRequest request{};
uint8_t susIdx;
bool waitingForRecovery = true;
uint32_t invalidMsgCounter = 0;
uint32_t transitionDelay = 1000;
bool goToNormalMode = false;

View File

@ -8,6 +8,14 @@
namespace susMax1227 {
// This is 16 seconds for a polling frequency of 0.4 seconds.
static constexpr uint32_t MAX_INVALID_MSG_COUNT = 40;
// Using a decrement time of 32 seconds should cause faulty device incrementation to best faster
// the decrementation, so that FDIR reactions will eventuall be triggered.
// NOTE: Not used currently, we perform the strange reply check logic in the handler and trigger
// a reboot directly using the appropriate event.
static constexpr uint32_t FAULTY_COM_DECREMENT_TIME_MS = 32000;
static const DeviceCommandId_t NONE = 0x0; // Set when no command is pending
static const DeviceCommandId_t WRITE_SETUP = 1;

View File

@ -187,9 +187,6 @@ ReturnValue_t CfdpHandler::handlePduPacket(TmTcMessage& msg) {
}
ReturnValue_t CfdpHandler::handleCfdpRequest(CommandMessage& msg) {
// TODO: Handle CFDP requests here, most importantly put requests. If a put request is received,
// check whether one is pending. If none are, start a transaction with the put request,
// otherwise store for put request inside a FIFO for later processing.
if (msg.getCommand() == CfdpMessage::PUT_REQUEST) {
sif::info << "Received CFDP put request" << std::endl;
if (srcHandler.getState() != CfdpState::IDLE) {
@ -199,7 +196,6 @@ ReturnValue_t CfdpHandler::handleCfdpRequest(CommandMessage& msg) {
}
putRequestQueue.push(CfdpMessage::getStoreId(&msg));
} else {
// TODO: Retrieve put request and remote configuration.
PutRequest putRequest;
auto accessorPair = ipcStore.getData(CfdpMessage::getStoreId(&msg));
const uint8_t* dataPtr = accessorPair.second.data();

View File

@ -86,7 +86,6 @@ EntityId REMOTE_CFDP_ID(UnsignedByteField<uint16_t>(config::EIVE_GROUND_CFDP_ENT
RemoteEntityCfg GROUND_REMOTE_CFG(REMOTE_CFDP_ID);
OneRemoteConfigProvider REMOTE_CFG_PROVIDER(GROUND_REMOTE_CFG);
HostFilesystem HOST_FS;
// EiveUserHandler USER_HANDLER(HOST_FS);
EiveFaultHandler EIVE_FAULT_HANDLER;
} // namespace cfdp

View File

@ -1,6 +1,7 @@
#include "SusFdir.h"
#include "eive/objects.h"
#include "mission/acs/susMax1227Helpers.h"
SusFdir::SusFdir(object_id_t sensorId)
: DeviceHandlerFailureIsolation(sensorId, objects::SUS_BOARD_ASS) {}

2
tmtc

@ -1 +1 @@
Subproject commit 5fc3d8de996e5640adb7205cd3897d499eb3da60
Subproject commit 8b45dd8bff5c0a31cdb2f56edc082624bf1fb936