From a9efedfc8602a5839cae75a128f3807381f37292 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 24 Mar 2023 00:59:41 +0100 Subject: [PATCH 1/5] Make syrlinks COM more reliable --- bsp_q7s/core/ObjectFactory.cpp | 6 +- common/config/eive/eventSubsystemIds.h | 1 + common/config/eive/objects.h | 3 +- fsfw | 2 +- linux/devices/CMakeLists.txt | 3 +- linux/devices/SusPolling.cpp | 2 +- linux/devices/SusPolling.h | 2 +- linux/devices/SyrlinksComHandler.cpp | 206 ++++++++++++++++++ linux/devices/SyrlinksComHandler.h | 52 +++++ .../startracker/ArcsecDatalinkLayer.cpp | 3 + linux/devices/startracker/StrComHandler.cpp | 19 +- linux/devices/startracker/StrComHandler.h | 1 - 12 files changed, 280 insertions(+), 20 deletions(-) create mode 100644 linux/devices/SyrlinksComHandler.cpp create mode 100644 linux/devices/SyrlinksComHandler.h diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 27d3225a..608bf254 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -596,12 +597,13 @@ void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) { syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); syrlinksUartCookie->setParityEven(); + new SyrlinksComHandler(objects::SYRLINKS_COM_HANDLER); auto* syrlinksAssy = new SyrlinksAssembly(objects::SYRLINKS_ASSY); syrlinksAssy->connectModeTreeParent(satsystem::com::SUBSYSTEM); auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HANDLER); auto syrlinksHandler = - new SyrlinksHandler(objects::SYRLINKS_HANDLER, objects::UART_COM_IF, syrlinksUartCookie, - pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir); + new SyrlinksHandler(objects::SYRLINKS_HANDLER, objects::SYRLINKS_COM_HANDLER, + syrlinksUartCookie, pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir); syrlinksHandler->setPowerSwitcher(pwrSwitcher); syrlinksHandler->connectModeTreeParent(*syrlinksAssy); #if OBSW_DEBUG_SYRLINKS == 1 diff --git a/common/config/eive/eventSubsystemIds.h b/common/config/eive/eventSubsystemIds.h index bbe9569a..624cd317 100644 --- a/common/config/eive/eventSubsystemIds.h +++ b/common/config/eive/eventSubsystemIds.h @@ -39,6 +39,7 @@ enum : uint8_t { TCS_CONTROLLER = 141, COM_SUBSYSTEM = 142, PERSISTENT_TM_STORE = 143, + SYRLINKS_COM = 144, COMMON_SUBSYSTEM_ID_END }; diff --git a/common/config/eive/objects.h b/common/config/eive/objects.h index 33eb9ad1..667067bb 100644 --- a/common/config/eive/objects.h +++ b/common/config/eive/objects.h @@ -123,8 +123,7 @@ enum commonObjects : uint32_t { SUS_11_R_LOC_XBYMZB_PT_ZB = 0x44120043, SYRLINKS_HANDLER = 0x445300A3, - // might be obsolete, was not used in Q7S FM SW - // CCSDS_IP_CORE_BRIDGE = 0x73500000, + SYRLINKS_COM_HANDLER = 0x445300A4, /* 0x49 ('I') for Communication Interfaces */ ACS_BOARD_POLLING_TASK = 0x49060004, diff --git a/fsfw b/fsfw index f8a7c1d4..cf6150cc 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit f8a7c1d4ed621a3375db0da9b9e9f8d5484abbc1 +Subproject commit cf6150cc184656481eaeb2beff23cd8e92a6ada9 diff --git a/linux/devices/CMakeLists.txt b/linux/devices/CMakeLists.txt index 8b23566b..7dbda12b 100644 --- a/linux/devices/CMakeLists.txt +++ b/linux/devices/CMakeLists.txt @@ -11,7 +11,8 @@ target_sources( ScexDleParser.cpp ScexHelper.cpp RwPollingTask.cpp - AcsBoardPolling.cpp) + AcsBoardPolling.cpp + SyrlinksComHandler.cpp) add_subdirectory(ploc) diff --git a/linux/devices/SusPolling.cpp b/linux/devices/SusPolling.cpp index 9ee0051a..dac0255b 100644 --- a/linux/devices/SusPolling.cpp +++ b/linux/devices/SusPolling.cpp @@ -77,7 +77,7 @@ ReturnValue_t SusPolling::sendMessage(CookieIF* cookie, const uint8_t* sendData, susDevs[susIdx].mode = susReq->mode; } if (state == InternalState::IDLE) { - state = InternalState::BUSY; + state = InternalState::IS_BUSY; semaphore->release(); } return OK; diff --git a/linux/devices/SusPolling.h b/linux/devices/SusPolling.h index 3afb1d9d..e9bcf59d 100644 --- a/linux/devices/SusPolling.h +++ b/linux/devices/SusPolling.h @@ -18,7 +18,7 @@ class SusPolling : public SystemObject, public ExecutableObjectIF, public Device ReturnValue_t initialize() override; private: - enum class InternalState { IDLE, BUSY } state = InternalState::IDLE; + enum class InternalState { IDLE, IS_BUSY } state = InternalState::IDLE; struct SusDev { SpiCookie* cookie = nullptr; diff --git a/linux/devices/SyrlinksComHandler.cpp b/linux/devices/SyrlinksComHandler.cpp new file mode 100644 index 00000000..3d8f8175 --- /dev/null +++ b/linux/devices/SyrlinksComHandler.cpp @@ -0,0 +1,206 @@ +#include "SyrlinksComHandler.h" + +#include +#include +#include +#include +#include +#include +#include + +using namespace returnvalue; + +SyrlinksComHandler::SyrlinksComHandler(object_id_t objectId) + : SystemObject(objectId), ringBuf(2048, true) { + lock = MutexFactory::instance()->createMutex(); + semaphore = SemaphoreFactory::instance()->createBinarySemaphore(); + semaphore->acquire(); +} + +ReturnValue_t SyrlinksComHandler::performOperation(uint8_t opCode) { + while (true) { + lock->lockMutex(); + state = State::SLEEPING; + lock->unlockMutex(); + readOneReply(); + semaphore->acquire(); + } + return returnvalue::OK; +} + +ReturnValue_t SyrlinksComHandler::initializeInterface(CookieIF *cookie) { + if (cookie == nullptr) { + return returnvalue::FAILED; + } + SerialCookie *serCookie = dynamic_cast(cookie); + if (serCookie == nullptr) { + return DeviceCommunicationIF::INVALID_COOKIE_TYPE; + } + // comCookie = serCookie; + std::string devname = serCookie->getDeviceFile(); + /* Get file descriptor */ + serialPort = open(devname.c_str(), O_RDWR); + if (serialPort < 0) { + sif::warning << "SyrlinksComHandler: open call failed with error [" << errno << ", " + << strerror(errno) << std::endl; + return returnvalue::FAILED; + } + // Setting up UART parameters + serial::setStopbits(tty, serCookie->getStopBits()); + serial::setParity(tty, serCookie->getParity()); + serial::setBitsPerWord(tty, BitsPerWord::BITS_8); + tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control + serial::enableRead(tty); + serial::ignoreCtrlLines(tty); + + // Use non-canonical mode and clear echo flag + tty.c_lflag &= ~(ICANON | ECHO); + + // Non-blocking mode, use polling + tty.c_cc[VTIME] = 0; + tty.c_cc[VMIN] = 0; + + serial::setBaudrate(tty, serCookie->getBaudrate()); + if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { + sif::warning << "ScexUartReader::initializeInterface: tcsetattr call failed with error [" + << errno << ", " << strerror(errno) << std::endl; + } + // Flush received and unread data + tcflush(serialPort, TCIOFLUSH); + return returnvalue::OK; +} + +ReturnValue_t SyrlinksComHandler::sendMessage(CookieIF *cookie, const uint8_t *sendData, + size_t sendLen) { + { + MutexGuard mg(lock); + if (state != State::SLEEPING) { + return BUSY; + } + } + serial::flushRxBuf(serialPort); + + ssize_t writtenBytes = write(serialPort, sendData, sendLen); + if (writtenBytes != static_cast(sendLen)) { + sif::warning << "StrComHandler: Sending packet failed" << std::endl; + return returnvalue::FAILED; + } + { + MutexGuard mg(lock); + state = State::ACTIVE; + } + semaphore->release(); + return returnvalue::OK; +} + +ReturnValue_t SyrlinksComHandler::getSendSuccess(CookieIF *cookie) { return returnvalue::OK; } + +ReturnValue_t SyrlinksComHandler::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { + return returnvalue::OK; +} + +ReturnValue_t SyrlinksComHandler::handleSerialReception() { + ssize_t bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), + static_cast(recBuf.size())); + if (bytesRead == 0) { + return NO_SERIAL_DATA_READ; + } else if (bytesRead < 0) { + sif::warning << "SyrlinksComHandler: read call failed with error [" << errno << ", " + << strerror(errno) << "]" << std::endl; + return FAILED; + } else if (bytesRead >= static_cast(recBuf.size())) { + sif::error << "SyrlinksComHandler: Receive buffer too small for " << bytesRead << " bytes" + << std::endl; + return FAILED; + } else if (bytesRead > 0) { + // sif::info << "Received " << bytesRead << " bytes from the STR" << std::endl; + // arrayprinter::print(recBuf.data(), bytesRead); + ringBuf.writeData(recBuf.data(), bytesRead); + } + return OK; +} + +ReturnValue_t SyrlinksComHandler::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, + size_t *size) { + MutexGuard mg(lock); + if (replyResult != returnvalue::OK) { + ReturnValue_t tmp = replyResult; + replyResult = returnvalue::OK; + return tmp; + } + if (replyLen == 0) { + *size = 0; + return returnvalue::OK; + } + *buffer = ipcBuf.data(); + *size = replyLen; + replyLen = 0; + return returnvalue::OK; +} + +ReturnValue_t SyrlinksComHandler::readOneReply() { + ReturnValue_t result; + uint32_t nextDelayMs = 1; + replyTimeout.resetTimer(); + while (true) { + handleSerialReception(); + result = tryReadingOneSyrlinksReply(); + if (result == returnvalue::OK) { + return returnvalue::OK; + } + if (replyTimeout.hasTimedOut()) { + { + MutexGuard mg(lock); + replyResult = DeviceCommunicationIF::NO_REPLY_RECEIVED; + } + return returnvalue::FAILED; + } + TaskFactory::delayTask(nextDelayMs); + if (nextDelayMs < 32) { + nextDelayMs *= 2; + } + } +} +ReturnValue_t SyrlinksComHandler::tryReadingOneSyrlinksReply() { + size_t bytesToRead = ringBuf.getAvailableReadData(); + if (bytesToRead == 0) { + return returnvalue::OK; + } + bool startMarkerFound = false; + size_t startIdx = 0; + ringBuf.readData(recBuf.data(), bytesToRead); + for (size_t idx = 0; idx < bytesToRead; idx++) { + if (recBuf[idx] == START_MARKER) { + if (startMarkerFound) { + // Probably lost a packet. Discard broken packet. + sif::warning << "SyrlinksComHandler: Detected 2 consecutive start markers" << std::endl; + ringBuf.deleteData(idx); + } else { + startMarkerFound = true; + startIdx = idx; + } + } + if (recBuf[idx] == END_MARKER) { + if (startMarkerFound) { + { + MutexGuard mg(lock); + replyLen = idx - startIdx; + } + // Copy detected packet to IPC buffer so it can be passed back to the device handler. + if (replyLen > ipcBuf.size()) { + sif::error << "SyrlinksComHandler: Detected reply too large" << std::endl; + ringBuf.deleteData(idx); + return returnvalue::FAILED; + } + std::memcpy(ipcBuf.data(), recBuf.data() + startIdx, replyLen); + ringBuf.deleteData(idx); + return returnvalue::OK; + } else { + // Probably lost a packet. Discard broken packet. + sif::warning << "SyrlinksComHandler: Detected 2 consecutive end markers" << std::endl; + ringBuf.deleteData(idx); + } + } + } + return NO_PACKET_FOUND; +} diff --git a/linux/devices/SyrlinksComHandler.h b/linux/devices/SyrlinksComHandler.h new file mode 100644 index 00000000..c86b52c9 --- /dev/null +++ b/linux/devices/SyrlinksComHandler.h @@ -0,0 +1,52 @@ +#ifndef LINUX_DEVICES_SYRLINKSCOMHANDLER_H_ +#define LINUX_DEVICES_SYRLINKSCOMHANDLER_H_ + +#include +#include +#include +#include +#include +#include + +class SyrlinksComHandler : public DeviceCommunicationIF, + public ExecutableObjectIF, + public SystemObject { + public: + SyrlinksComHandler(object_id_t objectId); + + private: + static constexpr char START_MARKER = '<'; + static constexpr char END_MARKER = '>'; + + //! [EXPORT] : [SKIP] + static constexpr ReturnValue_t NO_SERIAL_DATA_READ = returnvalue::makeCode(2, 0); + static constexpr ReturnValue_t NO_PACKET_FOUND = returnvalue::makeCode(2, 1); + + enum class State { SLEEPING, ACTIVE } state = State::SLEEPING; + + MutexIF *lock; + SemaphoreIF *semaphore; + int serialPort = 0; + struct termios tty {}; + Countdown replyTimeout{}; + std::array recBuf{}; + SimpleRingBuffer ringBuf; + std::array ipcBuf{}; + size_t replyLen = 0; + ReturnValue_t replyResult = returnvalue::OK; + + ReturnValue_t handleSerialReception(); + + ReturnValue_t performOperation(uint8_t opCode) override; + + ReturnValue_t initializeInterface(CookieIF *cookie) override; + ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) override; + ReturnValue_t getSendSuccess(CookieIF *cookie) override; + ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override; + ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) override; + + ReturnValue_t readOneReply(); + ReturnValue_t tryReadingOneSyrlinksReply(); +}; + +#endif /* LINUX_DEVICES_SYRLINKSCOMHANDLER_H_ */ diff --git a/linux/devices/startracker/ArcsecDatalinkLayer.cpp b/linux/devices/startracker/ArcsecDatalinkLayer.cpp index eb62cec1..77c0f49f 100644 --- a/linux/devices/startracker/ArcsecDatalinkLayer.cpp +++ b/linux/devices/startracker/ArcsecDatalinkLayer.cpp @@ -7,6 +7,9 @@ ArcsecDatalinkLayer::~ArcsecDatalinkLayer() {} ReturnValue_t ArcsecDatalinkLayer::checkRingBufForFrame(const uint8_t** decodedFrame, size_t& frameLen) { size_t currentLen = decodeRingBuf.getAvailableReadData(); + if (currentLen == 0) { + return returnvalue::OK; + } decodeRingBuf.readData(rxAnalysisBuffer, currentLen); for (size_t idx = 0; idx < currentLen; idx++) { enum arc_dec_result decResult = diff --git a/linux/devices/startracker/StrComHandler.cpp b/linux/devices/startracker/StrComHandler.cpp index 85be7871..7a9055d8 100644 --- a/linux/devices/startracker/StrComHandler.cpp +++ b/linux/devices/startracker/StrComHandler.cpp @@ -155,9 +155,7 @@ ReturnValue_t StrComHandler::startImageDownload(std::string path) { return returnvalue::OK; } -void StrComHandler::stopProcess() { - terminate = true; -} +void StrComHandler::stopProcess() { terminate = true; } void StrComHandler::setDownloadImageName(std::string filename) { downloadImage.filename = filename; @@ -652,10 +650,9 @@ ReturnValue_t StrComHandler::sendMessage(CookieIF* cookie, const uint8_t* sendDa const uint8_t* txFrame; size_t frameLen; datalinkLayer.encodeFrame(sendData, sendLen, &txFrame, frameLen); - size_t bytesWritten = write(serialPort, txFrame, frameLen); - if (bytesWritten != frameLen) { - sif::warning << "ScexUartReader::sendMessage: Sending ping command to solar experiment failed" - << std::endl; + ssize_t bytesWritten = write(serialPort, txFrame, frameLen); + if (bytesWritten != static_cast(frameLen)) { + sif::warning << "StrComHandler: Sending packet failed" << std::endl; return returnvalue::FAILED; } // Hacky, but the alternatives look bleak. The raw data contains the information we need @@ -746,12 +743,12 @@ ReturnValue_t StrComHandler::handleSerialReception() { if (bytesRead == 0) { return NO_SERIAL_DATA_READ; } else if (bytesRead < 0) { - sif::warning << "PlocSupvHelper::performOperation: read call failed with error [" << errno - << ", " << strerror(errno) << "]" << std::endl; + sif::warning << "StrComHandler: read call failed with error [" << errno << ", " + << strerror(errno) << "]" << std::endl; return FAILED; } else if (bytesRead >= static_cast(recBuf.size())) { - sif::error << "PlocSupvHelper::performOperation: Receive buffer too small for " << bytesRead - << " bytes" << std::endl; + sif::error << "StrComHandler: Receive buffer too small for " << bytesRead << " bytes" + << std::endl; return FAILED; } else if (bytesRead > 0) { // sif::info << "Received " << bytesRead << " bytes from the STR" << std::endl; diff --git a/linux/devices/startracker/StrComHandler.h b/linux/devices/startracker/StrComHandler.h index 85637c1f..b581678c 100644 --- a/linux/devices/startracker/StrComHandler.h +++ b/linux/devices/startracker/StrComHandler.h @@ -28,7 +28,6 @@ class StrComHandler : public SystemObject, public DeviceCommunicationIF, public public: static const uint8_t INTERFACE_ID = CLASS_ID::STR_HELPER; - static const ReturnValue_t BUSY = MAKE_RETURN_CODE(0); //! [EXPORT] : [COMMENT] SD card specified in path string not mounted static const ReturnValue_t SD_NOT_MOUNTED = MAKE_RETURN_CODE(1); //! [EXPORT] : [COMMENT] Specified file does not exist on filesystem From d85fb1811248bf992d94c4bbb2d5ed8db161d74a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 24 Mar 2023 01:01:29 +0100 Subject: [PATCH 2/5] fix new shadowing warnings --- linux/devices/AcsBoardPolling.cpp | 2 +- linux/devices/AcsBoardPolling.h | 2 +- linux/devices/ImtqPollingTask.cpp | 2 +- linux/devices/ImtqPollingTask.h | 2 +- linux/devices/RwPollingTask.cpp | 2 +- linux/devices/RwPollingTask.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/linux/devices/AcsBoardPolling.cpp b/linux/devices/AcsBoardPolling.cpp index adcbbf19..04fe92df 100644 --- a/linux/devices/AcsBoardPolling.cpp +++ b/linux/devices/AcsBoardPolling.cpp @@ -221,7 +221,7 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send } } if (state == InternalState::IDLE) { - state = InternalState::BUSY; + state = InternalState::IS_BUSY; } } semaphore->release(); diff --git a/linux/devices/AcsBoardPolling.h b/linux/devices/AcsBoardPolling.h index e3c3bd24..73195527 100644 --- a/linux/devices/AcsBoardPolling.h +++ b/linux/devices/AcsBoardPolling.h @@ -20,7 +20,7 @@ class AcsBoardPolling : public SystemObject, ReturnValue_t initialize() override; private: - enum class InternalState { IDLE, BUSY } state = InternalState::IDLE; + enum class InternalState { IDLE, IS_BUSY } state = InternalState::IDLE; MutexIF* ipcLock; static constexpr MutexIF::TimeoutType LOCK_TYPE = MutexIF::TimeoutType::WAITING; static constexpr uint32_t LOCK_TIMEOUT = 20; diff --git a/linux/devices/ImtqPollingTask.cpp b/linux/devices/ImtqPollingTask.cpp index eccb0898..ca7c75ff 100644 --- a/linux/devices/ImtqPollingTask.cpp +++ b/linux/devices/ImtqPollingTask.cpp @@ -245,7 +245,7 @@ ReturnValue_t ImtqPollingTask::sendMessage(CookieIF* cookie, const uint8_t* send if (state != InternalState::IDLE) { return returnvalue::FAILED; } - state = InternalState::BUSY; + state = InternalState::IS_BUSY; } semaphore->release(); diff --git a/linux/devices/ImtqPollingTask.h b/linux/devices/ImtqPollingTask.h index 592433c9..32497753 100644 --- a/linux/devices/ImtqPollingTask.h +++ b/linux/devices/ImtqPollingTask.h @@ -23,7 +23,7 @@ class ImtqPollingTask : public SystemObject, private: static constexpr ReturnValue_t NO_REPLY_AVAILABLE = returnvalue::makeCode(2, 0); - enum class InternalState { IDLE, BUSY } state = InternalState::IDLE; + enum class InternalState { IDLE, IS_BUSY } state = InternalState::IDLE; imtq::RequestType currentRequest = imtq::RequestType::MEASURE_NO_ACTUATION; SemaphoreIF* semaphore; diff --git a/linux/devices/RwPollingTask.cpp b/linux/devices/RwPollingTask.cpp index 7dff31bb..45528178 100644 --- a/linux/devices/RwPollingTask.cpp +++ b/linux/devices/RwPollingTask.cpp @@ -147,7 +147,7 @@ ReturnValue_t RwPollingTask::sendMessage(CookieIF* cookie, const uint8_t* sendDa rwCookie->currentRampTime = rampTime; rwCookie->specialRequest = specialRequest; if (state == InternalState::IDLE) { - state = InternalState::BUSY; + state = InternalState::IS_BUSY; semaphore->release(); } } diff --git a/linux/devices/RwPollingTask.h b/linux/devices/RwPollingTask.h index 8a3cc9e4..0131f2b4 100644 --- a/linux/devices/RwPollingTask.h +++ b/linux/devices/RwPollingTask.h @@ -41,7 +41,7 @@ class RwPollingTask : public SystemObject, public ExecutableObjectIF, public Dev ReturnValue_t initialize() override; private: - enum class InternalState { IDLE, BUSY } state = InternalState::IDLE; + enum class InternalState { IDLE, IS_BUSY } state = InternalState::IDLE; SemaphoreIF* semaphore; bool debugMode = false; bool modeAndSpeedWasSet = false; From fd235488f7d491177cd9c3b602d090ab7305af7e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 24 Mar 2023 01:19:08 +0100 Subject: [PATCH 3/5] schedule new COM helper --- bsp_q7s/core/scheduling.cpp | 29 +++++++++++++++++++++------- linux/devices/SyrlinksComHandler.cpp | 2 +- mission/core/pollingSeqTables.cpp | 10 ++++------ 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/bsp_q7s/core/scheduling.cpp b/bsp_q7s/core/scheduling.cpp index 8d216554..57f0b741 100644 --- a/bsp_q7s/core/scheduling.cpp +++ b/bsp_q7s/core/scheduling.cpp @@ -204,12 +204,13 @@ void scheduling::initTasks() { scheduling::printAddObjectError("CFDP_STORE_AND_TM", objects::CFDP_STORE_AND_TM_TASK); } + // TODO: Use user priorities for this task. #if OBSW_ADD_CFDP_COMPONENTS == 1 PeriodicTaskIF* cfdpTask = factory->createPeriodicTask( - "CFDP Handler", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc); + "CFDP", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc); result = cfdpTask->addComponent(objects::CFDP_HANDLER); if (result != returnvalue::OK) { - scheduling::printAddObjectError("CFDP Handler", objects::CFDP_HANDLER); + scheduling::printAddObjectError("CFDP", objects::CFDP_HANDLER); } #endif @@ -231,7 +232,7 @@ void scheduling::initTasks() { #if OBSW_ADD_RW == 1 PeriodicTaskIF* rwPolling = factory->createPeriodicTask( - "RW_POLLING_TASK", 85, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); + "RW_POLLING_TASK", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); result = rwPolling->addComponent(objects::RW_POLLING_TASK); if (result != returnvalue::OK) { scheduling::printAddObjectError("RW_POLLING_TASK", objects::RW_POLLING_TASK); @@ -306,6 +307,15 @@ void scheduling::initTasks() { } #endif +#if OBSW_ADD_SYRLINKS == 1 + PeriodicTaskIF* syrlinksCom = factory->createPeriodicTask( + "SYRLINKS_COM", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); + result = syrlinksCom->addComponent(objects::SYRLINKS_COM_HANDLER); + if (result != returnvalue::OK) { + scheduling::printAddObjectError("SYRLINKS_COM", objects::SYRLINKS_COM_HANDLER); + } +#endif + #if OBSW_ADD_STAR_TRACKER == 1 // Relatively high priority to make sure STR COM works well. PeriodicTaskIF* strHelperTask = factory->createPeriodicTask( @@ -316,6 +326,7 @@ void scheduling::initTasks() { } #endif /* OBSW_ADD_STAR_TRACKER == 1 */ + // TODO: Use regular scheduler for this task #if OBSW_ADD_PLOC_MPSOC == 1 PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask( "PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); @@ -325,6 +336,7 @@ void scheduling::initTasks() { } #endif /* OBSW_ADD_PLOC_MPSOC */ + // TODO: Use regular scheduler for this task #if OBSW_ADD_PLOC_SUPERVISOR == 1 PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask( "PLOC_SUPV_HELPER", 10, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); @@ -335,7 +347,7 @@ void scheduling::initTasks() { #endif /* OBSW_ADD_PLOC_SUPERVISOR */ PeriodicTaskIF* plTask = factory->createPeriodicTask( - "PL_TASK", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc); + "PL_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc); plTask->addComponent(objects::CAM_SWITCHER); scheduling::addMpsocSupvHandlers(plTask); scheduling::scheduleScexDev(plTask); @@ -402,6 +414,9 @@ void scheduling::initTasks() { #if OBSW_ADD_ACS_BOARD == 1 acsBrdPolling->startTask(); #endif +#if OBSW_ADD_SYRLINKS == 1 + syrlinksCom->startTask(); +#endif #if OBSW_ADD_MGT == 1 imtqPolling->startTask(); #endif @@ -487,7 +502,7 @@ void scheduling::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction #if OBSW_ADD_I2C_TEST_CODE == 0 FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask( - "I2C_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.4, missedDeadlineFunc); + "I2C_PST", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.4, missedDeadlineFunc); result = pst::pstI2cProcessingSystem(i2cPst); if (result != returnvalue::OK) { if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) { @@ -527,11 +542,11 @@ void scheduling::createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction } result = pusHighPrio->addComponent(objects::EVENT_MANAGER); if (result != returnvalue::OK) { - scheduling::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER); + scheduling::printAddObjectError("EVENT_MGMT", objects::EVENT_MANAGER); } result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT); if (result != returnvalue::OK) { - scheduling::printAddObjectError("PUS_9", objects::PUS_SERVICE_9_TIME_MGMT); + scheduling::printAddObjectError("PUS_TIME", objects::PUS_SERVICE_9_TIME_MGMT); } taskVec.push_back(pusHighPrio); diff --git a/linux/devices/SyrlinksComHandler.cpp b/linux/devices/SyrlinksComHandler.cpp index 3d8f8175..dc977072 100644 --- a/linux/devices/SyrlinksComHandler.cpp +++ b/linux/devices/SyrlinksComHandler.cpp @@ -22,8 +22,8 @@ ReturnValue_t SyrlinksComHandler::performOperation(uint8_t opCode) { lock->lockMutex(); state = State::SLEEPING; lock->unlockMutex(); - readOneReply(); semaphore->acquire(); + readOneReply(); } return returnvalue::OK; } diff --git a/mission/core/pollingSeqTables.cpp b/mission/core/pollingSeqTables.cpp index 523e5226..2c0e13c2 100644 --- a/mission/core/pollingSeqTables.cpp +++ b/mission/core/pollingSeqTables.cpp @@ -21,13 +21,11 @@ ReturnValue_t pst::pstSyrlinks(FixedTimeslotTaskIF *thisSequence) { uint32_t length = thisSequence->getPeriodMs(); -#if OBSW_ADD_SYRLINKS == 1 thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); -#endif + thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.5, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.5, DeviceHandlerIF::GET_READ); static_cast(length); From e8e01cf198f330338833f5cc9f363fad7b6cb39b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 24 Mar 2023 01:20:38 +0100 Subject: [PATCH 4/5] update gneerates files --- bsp_hosted/fsfwconfig/events/translateEvents.cpp | 6 +++--- bsp_hosted/fsfwconfig/objects/translateObjects.cpp | 8 ++++---- generators/bsp_hosted_events.csv | 2 +- generators/bsp_hosted_objects.csv | 2 +- generators/bsp_hosted_returnvalues.csv | 1 + generators/bsp_hosted_subsystems.csv | 1 + generators/bsp_q7s_events.csv | 2 +- generators/bsp_q7s_objects.csv | 2 +- generators/bsp_q7s_returnvalues.csv | 3 ++- generators/bsp_q7s_subsystems.csv | 1 + generators/events/translateEvents.cpp | 6 +++--- generators/objects/translateObjects.cpp | 8 ++++---- linux/fsfwconfig/events/translateEvents.cpp | 6 +++--- linux/fsfwconfig/objects/translateObjects.cpp | 8 ++++---- tmtc | 2 +- 15 files changed, 31 insertions(+), 27 deletions(-) diff --git a/bsp_hosted/fsfwconfig/events/translateEvents.cpp b/bsp_hosted/fsfwconfig/events/translateEvents.cpp index 2bbb0e0b..ec9a3cdd 100644 --- a/bsp_hosted/fsfwconfig/events/translateEvents.cpp +++ b/bsp_hosted/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 279 translations. * @details - * Generated on: 2023-03-22 01:14:08 + * Generated on: 2023-03-24 01:19:39 */ #include "translateEvents.h" @@ -172,7 +172,7 @@ const char *FIRMWARE_UPDATE_SUCCESSFUL_STRING = "FIRMWARE_UPDATE_SUCCESSFUL"; const char *FIRMWARE_UPDATE_FAILED_STRING = "FIRMWARE_UPDATE_FAILED"; const char *STR_HELPER_READING_REPLY_FAILED_STRING = "STR_HELPER_READING_REPLY_FAILED"; const char *STR_HELPER_COM_ERROR_STRING = "STR_HELPER_COM_ERROR"; -const char *STR_HELPER_REPLY_TIMEOUT_STRING = "STR_HELPER_REPLY_TIMEOUT"; +const char *STR_COM_REPLY_TIMEOUT_STRING = "STR_COM_REPLY_TIMEOUT"; const char *STR_HELPER_DEC_ERROR_STRING = "STR_HELPER_DEC_ERROR"; const char *POSITION_MISMATCH_STRING = "POSITION_MISMATCH"; const char *STR_HELPER_FILE_NOT_EXISTS_STRING = "STR_HELPER_FILE_NOT_EXISTS"; @@ -617,7 +617,7 @@ const char *translateEvents(Event event) { case (12510): return STR_HELPER_COM_ERROR_STRING; case (12511): - return STR_HELPER_REPLY_TIMEOUT_STRING; + return STR_COM_REPLY_TIMEOUT_STRING; case (12513): return STR_HELPER_DEC_ERROR_STRING; case (12514): diff --git a/bsp_hosted/fsfwconfig/objects/translateObjects.cpp b/bsp_hosted/fsfwconfig/objects/translateObjects.cpp index fc9207cf..44ab12ac 100644 --- a/bsp_hosted/fsfwconfig/objects/translateObjects.cpp +++ b/bsp_hosted/fsfwconfig/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 169 translations. - * Generated on: 2023-03-22 01:14:08 + * Generated on: 2023-03-24 01:19:39 */ #include "translateObjects.h" @@ -86,6 +86,7 @@ const char *RTD_13_IC16_PLPCDU_HEATSPREADER_STRING = "RTD_13_IC16_PLPCDU_HEATSPR const char *RTD_14_IC17_TCS_BOARD_STRING = "RTD_14_IC17_TCS_BOARD"; const char *RTD_15_IC18_IMTQ_STRING = "RTD_15_IC18_IMTQ"; const char *SYRLINKS_HANDLER_STRING = "SYRLINKS_HANDLER"; +const char *SYRLINKS_COM_HANDLER_STRING = "SYRLINKS_COM_HANDLER"; const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF"; const char *DUMMY_COM_IF_STRING = "DUMMY_COM_IF"; const char *SCEX_UART_READER_STRING = "SCEX_UART_READER"; @@ -171,7 +172,6 @@ const char *LOG_STORE_AND_TM_TASK_STRING = "LOG_STORE_AND_TM_TASK"; const char *HK_STORE_AND_TM_TASK_STRING = "HK_STORE_AND_TM_TASK"; const char *CFDP_STORE_AND_TM_TASK_STRING = "CFDP_STORE_AND_TM_TASK"; const char *DOWNLINK_RAM_STORE_STRING = "DOWNLINK_RAM_STORE"; -const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE"; const char *THERMAL_TEMP_INSERTER_STRING = "THERMAL_TEMP_INSERTER"; const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE"; const char *NO_OBJECT_STRING = "NO_OBJECT"; @@ -338,6 +338,8 @@ const char *translateObject(object_id_t object) { return RTD_15_IC18_IMTQ_STRING; case 0x445300A3: return SYRLINKS_HANDLER_STRING; + case 0x445300A4: + return SYRLINKS_COM_HANDLER_STRING; case 0x49000001: return ARDUINO_COM_IF_STRING; case 0x49000002: @@ -508,8 +510,6 @@ const char *translateObject(object_id_t object) { return CFDP_STORE_AND_TM_TASK_STRING; case 0x73040004: return DOWNLINK_RAM_STORE_STRING; - case 0x73500000: - return CCSDS_IP_CORE_BRIDGE_STRING; case 0x90000003: return THERMAL_TEMP_INSERTER_STRING; case 0xCAFECAFE: diff --git a/generators/bsp_hosted_events.csv b/generators/bsp_hosted_events.csv index a881cd63..806ec930 100644 --- a/generators/bsp_hosted_events.csv +++ b/generators/bsp_hosted_events.csv @@ -166,7 +166,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 12508;0x30dc;FIRMWARE_UPDATE_FAILED;LOW;Firmware update failed;linux/devices/startracker/StrComHandler.h 12509;0x30dd;STR_HELPER_READING_REPLY_FAILED;LOW;Failed to read communication interface reply data P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/devices/startracker/StrComHandler.h 12510;0x30de;STR_HELPER_COM_ERROR;LOW;Unexpected stop of decoding sequence P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/devices/startracker/StrComHandler.h -12511;0x30df;STR_HELPER_REPLY_TIMEOUT;LOW;Star tracker did not send a valid reply for a certain timeout. P1: Position of upload or download packet for which the packet wa sent. P2: Timeout;linux/devices/startracker/StrComHandler.h +12511;0x30df;STR_COM_REPLY_TIMEOUT;LOW;Star tracker did not send a valid reply for a certain timeout. P1: Position of upload or download packet for which the packet wa sent. P2: Timeout;linux/devices/startracker/StrComHandler.h 12513;0x30e1;STR_HELPER_DEC_ERROR;LOW;Error during decoding of received reply occurred P1: Return value of decoding function P2: Position of upload/download packet, or address of flash write/read request;linux/devices/startracker/StrComHandler.h 12514;0x30e2;POSITION_MISMATCH;LOW;Position mismatch P1: The expected position and thus the position for which the image upload/download failed;linux/devices/startracker/StrComHandler.h 12515;0x30e3;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not exist P1: Internal state of str helper;linux/devices/startracker/StrComHandler.h diff --git a/generators/bsp_hosted_objects.csv b/generators/bsp_hosted_objects.csv index 6d73e97c..a30fc9d8 100644 --- a/generators/bsp_hosted_objects.csv +++ b/generators/bsp_hosted_objects.csv @@ -78,6 +78,7 @@ 0x44420030;RTD_14_IC17_TCS_BOARD 0x44420031;RTD_15_IC18_IMTQ 0x445300A3;SYRLINKS_HANDLER +0x445300A4;SYRLINKS_COM_HANDLER 0x49000001;ARDUINO_COM_IF 0x49000002;DUMMY_COM_IF 0x49010006;SCEX_UART_READER @@ -163,7 +164,6 @@ 0x73040002;HK_STORE_AND_TM_TASK 0x73040003;CFDP_STORE_AND_TM_TASK 0x73040004;DOWNLINK_RAM_STORE -0x73500000;CCSDS_IP_CORE_BRIDGE 0x90000003;THERMAL_TEMP_INSERTER 0xCAFECAFE;DUMMY_INTERFACE 0xFFFFFFFF;NO_OBJECT diff --git a/generators/bsp_hosted_returnvalues.csv b/generators/bsp_hosted_returnvalues.csv index 243ff603..ec172097 100644 --- a/generators/bsp_hosted_returnvalues.csv +++ b/generators/bsp_hosted_returnvalues.csv @@ -321,6 +321,7 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x3404;DC_InvalidCookieType;No description;4;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h 0x3405;DC_NotActive;No description;5;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h 0x3406;DC_TooMuchData;No description;6;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h +0x3407;DC_Busy;No description;7;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h 0x3601;CFDP_InvalidTlvType;No description;1;CFDP;fsfw/src/fsfw/cfdp/definitions.h 0x3602;CFDP_InvalidDirectiveField;No description;2;CFDP;fsfw/src/fsfw/cfdp/definitions.h 0x3603;CFDP_InvalidPduDatafieldLen;No description;3;CFDP;fsfw/src/fsfw/cfdp/definitions.h diff --git a/generators/bsp_hosted_subsystems.csv b/generators/bsp_hosted_subsystems.csv index 02e8acd1..83d9bdbc 100644 --- a/generators/bsp_hosted_subsystems.csv +++ b/generators/bsp_hosted_subsystems.csv @@ -59,3 +59,4 @@ 141;TCS_CONTROLLER 142;COM_SUBSYSTEM 143;PERSISTENT_TM_STORE +144;SYRLINKS_COM diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index a881cd63..806ec930 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -166,7 +166,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 12508;0x30dc;FIRMWARE_UPDATE_FAILED;LOW;Firmware update failed;linux/devices/startracker/StrComHandler.h 12509;0x30dd;STR_HELPER_READING_REPLY_FAILED;LOW;Failed to read communication interface reply data P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/devices/startracker/StrComHandler.h 12510;0x30de;STR_HELPER_COM_ERROR;LOW;Unexpected stop of decoding sequence P1: Return code of failed communication interface read call P1: Upload/download position for which the read call failed;linux/devices/startracker/StrComHandler.h -12511;0x30df;STR_HELPER_REPLY_TIMEOUT;LOW;Star tracker did not send a valid reply for a certain timeout. P1: Position of upload or download packet for which the packet wa sent. P2: Timeout;linux/devices/startracker/StrComHandler.h +12511;0x30df;STR_COM_REPLY_TIMEOUT;LOW;Star tracker did not send a valid reply for a certain timeout. P1: Position of upload or download packet for which the packet wa sent. P2: Timeout;linux/devices/startracker/StrComHandler.h 12513;0x30e1;STR_HELPER_DEC_ERROR;LOW;Error during decoding of received reply occurred P1: Return value of decoding function P2: Position of upload/download packet, or address of flash write/read request;linux/devices/startracker/StrComHandler.h 12514;0x30e2;POSITION_MISMATCH;LOW;Position mismatch P1: The expected position and thus the position for which the image upload/download failed;linux/devices/startracker/StrComHandler.h 12515;0x30e3;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not exist P1: Internal state of str helper;linux/devices/startracker/StrComHandler.h diff --git a/generators/bsp_q7s_objects.csv b/generators/bsp_q7s_objects.csv index 0c248ea8..68be8ef2 100644 --- a/generators/bsp_q7s_objects.csv +++ b/generators/bsp_q7s_objects.csv @@ -77,6 +77,7 @@ 0x44420030;RTD_14_IC17_TCS_BOARD 0x44420031;RTD_15_IC18_IMTQ 0x445300A3;SYRLINKS_HANDLER +0x445300A4;SYRLINKS_COM_HANDLER 0x49000000;ARDUINO_COM_IF 0x49010005;GPIO_IF 0x49010006;SCEX_UART_READER @@ -168,6 +169,5 @@ 0x73040002;HK_STORE_AND_TM_TASK 0x73040003;CFDP_STORE_AND_TM_TASK 0x73040004;DOWNLINK_RAM_STORE -0x73500000;CCSDS_IP_CORE_BRIDGE 0x90000003;THERMAL_TEMP_INSERTER 0xFFFFFFFF;NO_OBJECT diff --git a/generators/bsp_q7s_returnvalues.csv b/generators/bsp_q7s_returnvalues.csv index e582cfbc..4d7aa958 100644 --- a/generators/bsp_q7s_returnvalues.csv +++ b/generators/bsp_q7s_returnvalues.csv @@ -321,6 +321,7 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x3404;DC_InvalidCookieType;No description;4;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h 0x3405;DC_NotActive;No description;5;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h 0x3406;DC_TooMuchData;No description;6;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h +0x3407;DC_Busy;No description;7;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h 0x3601;CFDP_InvalidTlvType;No description;1;CFDP;fsfw/src/fsfw/cfdp/definitions.h 0x3602;CFDP_InvalidDirectiveField;No description;2;CFDP;fsfw/src/fsfw/cfdp/definitions.h 0x3603;CFDP_InvalidPduDatafieldLen;No description;3;CFDP;fsfw/src/fsfw/cfdp/definitions.h @@ -474,6 +475,7 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x53b7;STRH_StartrackerNotRunningFirmware;Star tracker must be in firmware mode to run this command;183;STR_HANDLER;linux/devices/startracker/StarTrackerHandler.h 0x53b8;STRH_StartrackerNotRunningBootloader;Star tracker must be in bootloader mode to run this command;184;STR_HANDLER;linux/devices/startracker/StarTrackerHandler.h 0x5400;DWLPWRON_NoReplyAvailable;No description;0;DWLPWRON_CMD;linux/devices/ImtqPollingTask.h +0x5401;DWLPWRON_NoPacketFound;No description;1;DWLPWRON_CMD;linux/devices/SyrlinksComHandler.h 0x5402;DWLPWRON_InvalidCrc;No description;2;DWLPWRON_CMD;linux/devices/ScexHelper.h 0x54e0;DWLPWRON_InvalidMode;Received command has invalid JESD mode (valid modes are 0 - 5);224;DWLPWRON_CMD;linux/devices/devicedefinitions/PlocMPSoCDefinitions.h 0x54e1;DWLPWRON_InvalidLaneRate;Received command has invalid lane rate (valid lane rate are 0 - 9);225;DWLPWRON_CMD;linux/devices/devicedefinitions/PlocMPSoCDefinitions.h @@ -491,7 +493,6 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path 0x58a1;SUSS_ErrorLockMutex;No description;161;SUS_HANDLER;mission/devices/LegacySusHandler.h 0x59a0;IPCI_PapbBusy;No description;160;CCSDS_IP_CORE_BRIDGE;linux/ipcore/PapbVcInterface.h 0x5aa0;PTME_UnknownVcId;No description;160;PTME;linux/ipcore/Ptme.h -0x5c00;STRHLP_Busy;No description;0;STR_HELPER;linux/devices/startracker/StrComHandler.h 0x5c01;STRHLP_SdNotMounted;SD card specified in path string not mounted;1;STR_HELPER;linux/devices/startracker/StrComHandler.h 0x5c02;STRHLP_FileNotExists;Specified file does not exist on filesystem;2;STR_HELPER;linux/devices/startracker/StrComHandler.h 0x5c03;STRHLP_PathNotExists;Specified path does not exist;3;STR_HELPER;linux/devices/startracker/StrComHandler.h diff --git a/generators/bsp_q7s_subsystems.csv b/generators/bsp_q7s_subsystems.csv index 02e8acd1..83d9bdbc 100644 --- a/generators/bsp_q7s_subsystems.csv +++ b/generators/bsp_q7s_subsystems.csv @@ -59,3 +59,4 @@ 141;TCS_CONTROLLER 142;COM_SUBSYSTEM 143;PERSISTENT_TM_STORE +144;SYRLINKS_COM diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index 2bbb0e0b..ec9a3cdd 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 279 translations. * @details - * Generated on: 2023-03-22 01:14:08 + * Generated on: 2023-03-24 01:19:39 */ #include "translateEvents.h" @@ -172,7 +172,7 @@ const char *FIRMWARE_UPDATE_SUCCESSFUL_STRING = "FIRMWARE_UPDATE_SUCCESSFUL"; const char *FIRMWARE_UPDATE_FAILED_STRING = "FIRMWARE_UPDATE_FAILED"; const char *STR_HELPER_READING_REPLY_FAILED_STRING = "STR_HELPER_READING_REPLY_FAILED"; const char *STR_HELPER_COM_ERROR_STRING = "STR_HELPER_COM_ERROR"; -const char *STR_HELPER_REPLY_TIMEOUT_STRING = "STR_HELPER_REPLY_TIMEOUT"; +const char *STR_COM_REPLY_TIMEOUT_STRING = "STR_COM_REPLY_TIMEOUT"; const char *STR_HELPER_DEC_ERROR_STRING = "STR_HELPER_DEC_ERROR"; const char *POSITION_MISMATCH_STRING = "POSITION_MISMATCH"; const char *STR_HELPER_FILE_NOT_EXISTS_STRING = "STR_HELPER_FILE_NOT_EXISTS"; @@ -617,7 +617,7 @@ const char *translateEvents(Event event) { case (12510): return STR_HELPER_COM_ERROR_STRING; case (12511): - return STR_HELPER_REPLY_TIMEOUT_STRING; + return STR_COM_REPLY_TIMEOUT_STRING; case (12513): return STR_HELPER_DEC_ERROR_STRING; case (12514): diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index bac4cde7..66041cbc 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 173 translations. - * Generated on: 2023-03-22 01:14:08 + * Generated on: 2023-03-24 01:19:39 */ #include "translateObjects.h" @@ -85,6 +85,7 @@ const char *RTD_13_IC16_PLPCDU_HEATSPREADER_STRING = "RTD_13_IC16_PLPCDU_HEATSPR const char *RTD_14_IC17_TCS_BOARD_STRING = "RTD_14_IC17_TCS_BOARD"; const char *RTD_15_IC18_IMTQ_STRING = "RTD_15_IC18_IMTQ"; const char *SYRLINKS_HANDLER_STRING = "SYRLINKS_HANDLER"; +const char *SYRLINKS_COM_HANDLER_STRING = "SYRLINKS_COM_HANDLER"; const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF"; const char *GPIO_IF_STRING = "GPIO_IF"; const char *SCEX_UART_READER_STRING = "SCEX_UART_READER"; @@ -176,7 +177,6 @@ const char *LOG_STORE_AND_TM_TASK_STRING = "LOG_STORE_AND_TM_TASK"; const char *HK_STORE_AND_TM_TASK_STRING = "HK_STORE_AND_TM_TASK"; const char *CFDP_STORE_AND_TM_TASK_STRING = "CFDP_STORE_AND_TM_TASK"; const char *DOWNLINK_RAM_STORE_STRING = "DOWNLINK_RAM_STORE"; -const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE"; const char *THERMAL_TEMP_INSERTER_STRING = "THERMAL_TEMP_INSERTER"; const char *NO_OBJECT_STRING = "NO_OBJECT"; @@ -340,6 +340,8 @@ const char *translateObject(object_id_t object) { return RTD_15_IC18_IMTQ_STRING; case 0x445300A3: return SYRLINKS_HANDLER_STRING; + case 0x445300A4: + return SYRLINKS_COM_HANDLER_STRING; case 0x49000000: return ARDUINO_COM_IF_STRING; case 0x49010005: @@ -522,8 +524,6 @@ const char *translateObject(object_id_t object) { return CFDP_STORE_AND_TM_TASK_STRING; case 0x73040004: return DOWNLINK_RAM_STORE_STRING; - case 0x73500000: - return CCSDS_IP_CORE_BRIDGE_STRING; case 0x90000003: return THERMAL_TEMP_INSERTER_STRING; case 0xFFFFFFFF: diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index 2bbb0e0b..ec9a3cdd 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 279 translations. * @details - * Generated on: 2023-03-22 01:14:08 + * Generated on: 2023-03-24 01:19:39 */ #include "translateEvents.h" @@ -172,7 +172,7 @@ const char *FIRMWARE_UPDATE_SUCCESSFUL_STRING = "FIRMWARE_UPDATE_SUCCESSFUL"; const char *FIRMWARE_UPDATE_FAILED_STRING = "FIRMWARE_UPDATE_FAILED"; const char *STR_HELPER_READING_REPLY_FAILED_STRING = "STR_HELPER_READING_REPLY_FAILED"; const char *STR_HELPER_COM_ERROR_STRING = "STR_HELPER_COM_ERROR"; -const char *STR_HELPER_REPLY_TIMEOUT_STRING = "STR_HELPER_REPLY_TIMEOUT"; +const char *STR_COM_REPLY_TIMEOUT_STRING = "STR_COM_REPLY_TIMEOUT"; const char *STR_HELPER_DEC_ERROR_STRING = "STR_HELPER_DEC_ERROR"; const char *POSITION_MISMATCH_STRING = "POSITION_MISMATCH"; const char *STR_HELPER_FILE_NOT_EXISTS_STRING = "STR_HELPER_FILE_NOT_EXISTS"; @@ -617,7 +617,7 @@ const char *translateEvents(Event event) { case (12510): return STR_HELPER_COM_ERROR_STRING; case (12511): - return STR_HELPER_REPLY_TIMEOUT_STRING; + return STR_COM_REPLY_TIMEOUT_STRING; case (12513): return STR_HELPER_DEC_ERROR_STRING; case (12514): diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index bac4cde7..66041cbc 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 173 translations. - * Generated on: 2023-03-22 01:14:08 + * Generated on: 2023-03-24 01:19:39 */ #include "translateObjects.h" @@ -85,6 +85,7 @@ const char *RTD_13_IC16_PLPCDU_HEATSPREADER_STRING = "RTD_13_IC16_PLPCDU_HEATSPR const char *RTD_14_IC17_TCS_BOARD_STRING = "RTD_14_IC17_TCS_BOARD"; const char *RTD_15_IC18_IMTQ_STRING = "RTD_15_IC18_IMTQ"; const char *SYRLINKS_HANDLER_STRING = "SYRLINKS_HANDLER"; +const char *SYRLINKS_COM_HANDLER_STRING = "SYRLINKS_COM_HANDLER"; const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF"; const char *GPIO_IF_STRING = "GPIO_IF"; const char *SCEX_UART_READER_STRING = "SCEX_UART_READER"; @@ -176,7 +177,6 @@ const char *LOG_STORE_AND_TM_TASK_STRING = "LOG_STORE_AND_TM_TASK"; const char *HK_STORE_AND_TM_TASK_STRING = "HK_STORE_AND_TM_TASK"; const char *CFDP_STORE_AND_TM_TASK_STRING = "CFDP_STORE_AND_TM_TASK"; const char *DOWNLINK_RAM_STORE_STRING = "DOWNLINK_RAM_STORE"; -const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE"; const char *THERMAL_TEMP_INSERTER_STRING = "THERMAL_TEMP_INSERTER"; const char *NO_OBJECT_STRING = "NO_OBJECT"; @@ -340,6 +340,8 @@ const char *translateObject(object_id_t object) { return RTD_15_IC18_IMTQ_STRING; case 0x445300A3: return SYRLINKS_HANDLER_STRING; + case 0x445300A4: + return SYRLINKS_COM_HANDLER_STRING; case 0x49000000: return ARDUINO_COM_IF_STRING; case 0x49010005: @@ -522,8 +524,6 @@ const char *translateObject(object_id_t object) { return CFDP_STORE_AND_TM_TASK_STRING; case 0x73040004: return DOWNLINK_RAM_STORE_STRING; - case 0x73500000: - return CCSDS_IP_CORE_BRIDGE_STRING; case 0x90000003: return THERMAL_TEMP_INSERTER_STRING; case 0xFFFFFFFF: diff --git a/tmtc b/tmtc index 2263938b..b17c413e 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 2263938b8b1324b309a44d70c291800050ff4178 +Subproject commit b17c413e8f1d7a827b2fdd02b642a3bbebb2738c From 21159107d785c0b19a22baccb8aba74af83096d8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 24 Mar 2023 02:34:38 +0100 Subject: [PATCH 5/5] done --- CHANGELOG.md | 6 ++++++ bsp_hosted/fsfwconfig/events/translateEvents.cpp | 4 ++-- bsp_hosted/fsfwconfig/objects/translateObjects.cpp | 2 +- bsp_q7s/OBSWConfig.h.in | 1 - bsp_q7s/core/scheduling.cpp | 10 +++++----- generators/bsp_hosted_events.csv | 1 - generators/bsp_q7s_events.csv | 1 - generators/events/translateEvents.cpp | 4 ++-- generators/objects/translateObjects.cpp | 2 +- linux/devices/SyrlinksComHandler.cpp | 13 ++++++++----- linux/devices/SyrlinksComHandler.h | 2 +- linux/devices/startracker/ArcsecDatalinkLayer.cpp | 2 +- linux/fsfwconfig/events/translateEvents.cpp | 4 ++-- linux/fsfwconfig/objects/translateObjects.cpp | 2 +- mission/core/pollingSeqTables.cpp | 8 ++++++-- .../devicedefinitions/SyrlinksDefinitions.h | 1 - mission/system/fdir/SyrlinksFdir.cpp | 14 ++++---------- tmtc | 2 +- 18 files changed, 41 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ae35a8d..1858110a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ will consitute of a breaking change warranting a new major release: ## Fixed - STR: Fix weird issues on datalink layer data reception which sometimes occur. +- Syrlinks FDIR: Fully allow FDIR to do more recoveries. Assembly should take care of preventing + the switch to go off. ## Changed @@ -28,6 +30,10 @@ will consitute of a breaking change warranting a new major release: - `StrHelper` renamed to `StrComHandler`, is now a `DeviceHandlerIF` directly and does not wrap a separate UART COM interface anymore. - TCS: Local pool variables are members now. +- Syrlinks: Create dedicated COM helper which uses a ring buffer to parse the Syrlinks datalinklayer + and should make communication more reliable even on high CPU loads. +- Syrlinks: Two communication cycles per PST. +- Fine-tuning of various task priorities. # [v1.39.1] 2023-03-22 diff --git a/bsp_hosted/fsfwconfig/events/translateEvents.cpp b/bsp_hosted/fsfwconfig/events/translateEvents.cpp index ec9a3cdd..70abd388 100644 --- a/bsp_hosted/fsfwconfig/events/translateEvents.cpp +++ b/bsp_hosted/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 279 translations. + * @brief Auto-generated event translation file. Contains 278 translations. * @details - * Generated on: 2023-03-24 01:19:39 + * Generated on: 2023-03-24 02:13:12 */ #include "translateEvents.h" diff --git a/bsp_hosted/fsfwconfig/objects/translateObjects.cpp b/bsp_hosted/fsfwconfig/objects/translateObjects.cpp index 44ab12ac..e275784d 100644 --- a/bsp_hosted/fsfwconfig/objects/translateObjects.cpp +++ b/bsp_hosted/fsfwconfig/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 169 translations. - * Generated on: 2023-03-24 01:19:39 + * Generated on: 2023-03-24 02:13:12 */ #include "translateObjects.h" diff --git a/bsp_q7s/OBSWConfig.h.in b/bsp_q7s/OBSWConfig.h.in index 1dff8f7f..6f4e82e3 100644 --- a/bsp_q7s/OBSWConfig.h.in +++ b/bsp_q7s/OBSWConfig.h.in @@ -14,7 +14,6 @@ /*******************************************************************/ #define OBSW_ENABLE_PERIODIC_HK 0 -#define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0 // This switch will cause the SW to command the EIVE system object to safe mode. This will // trigger a lot of events, so it can make sense to disable this for debugging purposes #define OBSW_COMMAND_SAFE_MODE_AT_STARTUP 1 diff --git a/bsp_q7s/core/scheduling.cpp b/bsp_q7s/core/scheduling.cpp index 57f0b741..2579c258 100644 --- a/bsp_q7s/core/scheduling.cpp +++ b/bsp_q7s/core/scheduling.cpp @@ -81,7 +81,7 @@ void scheduling::initTasks() { #endif PeriodicTaskIF* coreCtrlTask = factory->createPeriodicTask( - "CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc); + "CORE_CTRL", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc); result = coreCtrlTask->addComponent(objects::CORE_CONTROLLER); if (result != returnvalue::OK) { scheduling::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER); @@ -120,7 +120,7 @@ void scheduling::initTasks() { #if OBSW_ADD_TCPIP_SERVERS == 1 #if OBSW_ADD_TMTC_UDP_SERVER == 1 PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask( - "UDP_TMTC_POLLING", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + "UDP_TMTC_POLLING", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); result = udpPollingTask->addComponent(objects::UDP_TMTC_POLLING_TASK); if (result != returnvalue::OK) { scheduling::printAddObjectError("UDP_POLLING", objects::UDP_TMTC_POLLING_TASK); @@ -128,7 +128,7 @@ void scheduling::initTasks() { #endif #if OBSW_ADD_TMTC_TCP_SERVER == 1 PeriodicTaskIF* tcpPollingTask = factory->createPeriodicTask( - "TCP_TMTC_POLLING", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); + "TCP_TMTC_POLLING", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); result = tcpPollingTask->addComponent(objects::TCP_TMTC_POLLING_TASK); if (result != returnvalue::OK) { scheduling::printAddObjectError("UDP_POLLING", objects::TCP_TMTC_POLLING_TASK); @@ -309,7 +309,7 @@ void scheduling::initTasks() { #if OBSW_ADD_SYRLINKS == 1 PeriodicTaskIF* syrlinksCom = factory->createPeriodicTask( - "SYRLINKS_COM", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); + "SYRLINKS_COM", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); result = syrlinksCom->addComponent(objects::SYRLINKS_COM_HANDLER); if (result != returnvalue::OK) { scheduling::printAddObjectError("SYRLINKS_COM", objects::SYRLINKS_COM_HANDLER); @@ -487,7 +487,7 @@ void scheduling::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction /* Polling Sequence Table Default */ #if OBSW_ADD_SPI_TEST_CODE == 0 FixedTimeslotTaskIF* syrlinksPst = factory.createFixedTimeslotTask( - "SYRLINKS", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc); + "SYRLINKS", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc); result = pst::pstSyrlinks(syrlinksPst); if (result != returnvalue::OK) { if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) { diff --git a/generators/bsp_hosted_events.csv b/generators/bsp_hosted_events.csv index 806ec930..5d76bdab 100644 --- a/generators/bsp_hosted_events.csv +++ b/generators/bsp_hosted_events.csv @@ -239,7 +239,6 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 13630;0x353e;SUPV_UPDATE_PROGRESS;INFO;Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written;linux/devices/ploc/PlocSupvUartMan.h 13631;0x353f;HDLC_FRAME_REMOVAL_ERROR;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h 13632;0x3540;HDLC_CRC_ERROR;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h -13700;0x3584;FDIR_REACTION_IGNORED;MEDIUM;No description;mission/devices/devicedefinitions/SyrlinksDefinitions.h 13701;0x3585;TX_ON;INFO;Transmitter is on now. P1: Submode, P2: Current default datarate.;mission/devices/devicedefinitions/SyrlinksDefinitions.h 13702;0x3586;TX_OFF;INFO;Transmitter is off now.;mission/devices/devicedefinitions/SyrlinksDefinitions.h 13800;0x35e8;MISSING_PACKET;LOW;No description;mission/devices/devicedefinitions/ScexDefinitions.h diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index 806ec930..5d76bdab 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -239,7 +239,6 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 13630;0x353e;SUPV_UPDATE_PROGRESS;INFO;Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written;linux/devices/ploc/PlocSupvUartMan.h 13631;0x353f;HDLC_FRAME_REMOVAL_ERROR;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h 13632;0x3540;HDLC_CRC_ERROR;INFO;No description;linux/devices/ploc/PlocSupvUartMan.h -13700;0x3584;FDIR_REACTION_IGNORED;MEDIUM;No description;mission/devices/devicedefinitions/SyrlinksDefinitions.h 13701;0x3585;TX_ON;INFO;Transmitter is on now. P1: Submode, P2: Current default datarate.;mission/devices/devicedefinitions/SyrlinksDefinitions.h 13702;0x3586;TX_OFF;INFO;Transmitter is off now.;mission/devices/devicedefinitions/SyrlinksDefinitions.h 13800;0x35e8;MISSING_PACKET;LOW;No description;mission/devices/devicedefinitions/ScexDefinitions.h diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index ec9a3cdd..70abd388 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 279 translations. + * @brief Auto-generated event translation file. Contains 278 translations. * @details - * Generated on: 2023-03-24 01:19:39 + * Generated on: 2023-03-24 02:13:12 */ #include "translateEvents.h" diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index 66041cbc..87d9bcd4 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 173 translations. - * Generated on: 2023-03-24 01:19:39 + * Generated on: 2023-03-24 02:13:12 */ #include "translateObjects.h" diff --git a/linux/devices/SyrlinksComHandler.cpp b/linux/devices/SyrlinksComHandler.cpp index dc977072..35478d11 100644 --- a/linux/devices/SyrlinksComHandler.cpp +++ b/linux/devices/SyrlinksComHandler.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -23,6 +24,7 @@ ReturnValue_t SyrlinksComHandler::performOperation(uint8_t opCode) { state = State::SLEEPING; lock->unlockMutex(); semaphore->acquire(); + // Stopwatch watch; readOneReply(); } return returnvalue::OK; @@ -113,7 +115,7 @@ ReturnValue_t SyrlinksComHandler::handleSerialReception() { << std::endl; return FAILED; } else if (bytesRead > 0) { - // sif::info << "Received " << bytesRead << " bytes from the STR" << std::endl; + // sif::debug << "Received " << bytesRead << " bytes from the Syrlinks" << std::endl; // arrayprinter::print(recBuf.data(), bytesRead); ringBuf.writeData(recBuf.data(), bytesRead); } @@ -164,7 +166,7 @@ ReturnValue_t SyrlinksComHandler::readOneReply() { ReturnValue_t SyrlinksComHandler::tryReadingOneSyrlinksReply() { size_t bytesToRead = ringBuf.getAvailableReadData(); if (bytesToRead == 0) { - return returnvalue::OK; + return NO_PACKET_FOUND; } bool startMarkerFound = false; size_t startIdx = 0; @@ -184,7 +186,7 @@ ReturnValue_t SyrlinksComHandler::tryReadingOneSyrlinksReply() { if (startMarkerFound) { { MutexGuard mg(lock); - replyLen = idx - startIdx; + replyLen = idx - startIdx + 1; } // Copy detected packet to IPC buffer so it can be passed back to the device handler. if (replyLen > ipcBuf.size()) { @@ -192,13 +194,14 @@ ReturnValue_t SyrlinksComHandler::tryReadingOneSyrlinksReply() { ringBuf.deleteData(idx); return returnvalue::FAILED; } + // sif::debug << "Detected Syrlinks reply with length " << replyLen << std::endl; std::memcpy(ipcBuf.data(), recBuf.data() + startIdx, replyLen); - ringBuf.deleteData(idx); + ringBuf.deleteData(idx + 1); return returnvalue::OK; } else { // Probably lost a packet. Discard broken packet. sif::warning << "SyrlinksComHandler: Detected 2 consecutive end markers" << std::endl; - ringBuf.deleteData(idx); + ringBuf.deleteData(idx + 1); } } } diff --git a/linux/devices/SyrlinksComHandler.h b/linux/devices/SyrlinksComHandler.h index c86b52c9..39e8f312 100644 --- a/linux/devices/SyrlinksComHandler.h +++ b/linux/devices/SyrlinksComHandler.h @@ -28,7 +28,7 @@ class SyrlinksComHandler : public DeviceCommunicationIF, SemaphoreIF *semaphore; int serialPort = 0; struct termios tty {}; - Countdown replyTimeout{}; + Countdown replyTimeout = Countdown(2000); std::array recBuf{}; SimpleRingBuffer ringBuf; std::array ipcBuf{}; diff --git a/linux/devices/startracker/ArcsecDatalinkLayer.cpp b/linux/devices/startracker/ArcsecDatalinkLayer.cpp index 77c0f49f..29043e32 100644 --- a/linux/devices/startracker/ArcsecDatalinkLayer.cpp +++ b/linux/devices/startracker/ArcsecDatalinkLayer.cpp @@ -8,7 +8,7 @@ ReturnValue_t ArcsecDatalinkLayer::checkRingBufForFrame(const uint8_t** decodedF size_t& frameLen) { size_t currentLen = decodeRingBuf.getAvailableReadData(); if (currentLen == 0) { - return returnvalue::OK; + return DEC_IN_PROGRESS; } decodeRingBuf.readData(rxAnalysisBuffer, currentLen); for (size_t idx = 0; idx < currentLen; idx++) { diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index ec9a3cdd..70abd388 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 279 translations. + * @brief Auto-generated event translation file. Contains 278 translations. * @details - * Generated on: 2023-03-24 01:19:39 + * Generated on: 2023-03-24 02:13:12 */ #include "translateEvents.h" diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index 66041cbc..87d9bcd4 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 173 translations. - * Generated on: 2023-03-24 01:19:39 + * Generated on: 2023-03-24 02:13:12 */ #include "translateObjects.h" diff --git a/mission/core/pollingSeqTables.cpp b/mission/core/pollingSeqTables.cpp index 2c0e13c2..1b8f6e89 100644 --- a/mission/core/pollingSeqTables.cpp +++ b/mission/core/pollingSeqTables.cpp @@ -24,8 +24,12 @@ ReturnValue_t pst::pstSyrlinks(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.5, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.5, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.25, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.25, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.4, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0.7, DeviceHandlerIF::GET_READ); static_cast(length); diff --git a/mission/devices/devicedefinitions/SyrlinksDefinitions.h b/mission/devices/devicedefinitions/SyrlinksDefinitions.h index 0e25501a..b0f1e95e 100644 --- a/mission/devices/devicedefinitions/SyrlinksDefinitions.h +++ b/mission/devices/devicedefinitions/SyrlinksDefinitions.h @@ -10,7 +10,6 @@ enum class ParameterId : uint8_t { DATARATE = 0 }; static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYRLINKS; -static constexpr Event FDIR_REACTION_IGNORED = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM); //! [EXPORT] : [COMMENT] Transmitter is on now. P1: Submode, P2: Current default datarate. static constexpr Event TX_ON = event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO); //! [EXPORT] : [COMMENT] Transmitter is off now. diff --git a/mission/system/fdir/SyrlinksFdir.cpp b/mission/system/fdir/SyrlinksFdir.cpp index 2bdbd21d..999b5ad0 100644 --- a/mission/system/fdir/SyrlinksFdir.cpp +++ b/mission/system/fdir/SyrlinksFdir.cpp @@ -23,8 +23,7 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) { case DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT: // We'll try a recovery as long as defined in MAX_REBOOT. // Might cause some AssemblyBase cycles, so keep number low. - // handleRecovery(event->getEvent()); - triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0); + handleRecovery(event->getEvent()); break; case DeviceHandlerIF::DEVICE_INTERPRETING_REPLY_FAILED: case DeviceHandlerIF::DEVICE_READING_REPLY_FAILED: @@ -33,8 +32,7 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) { case DeviceHandlerIF::DEVICE_BUILDING_COMMAND_FAILED: // These faults all mean that there were stupid replies from a device. if (strangeReplyCount.incrementAndCheck()) { - // handleRecovery(event->getEvent()); - triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0); + handleRecovery(event->getEvent()); } break; case DeviceHandlerIF::DEVICE_SENDING_COMMAND_FAILED: @@ -48,7 +46,6 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) { // else if (missedReplyCount.incrementAndCheck()) { handleRecovery(event->getEvent()); - // triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0); } break; case StorageManagerIF::GET_DATA_FAILED: @@ -81,7 +78,6 @@ ReturnValue_t SyrlinksFdir::eventReceived(EventMessage* event) { case Fuse::POWER_BELOW_LOW_LIMIT: // Device might got stuck during boot, retry. handleRecovery(event->getEvent()); - triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0); break; //****Thermal***** case ThermalComponentIF::COMPONENT_TEMP_LOW: @@ -113,14 +109,12 @@ void SyrlinksFdir::eventConfirmed(EventMessage* event) { case DeviceHandlerIF::DEVICE_REQUESTING_REPLY_FAILED: case DeviceHandlerIF::DEVICE_MISSED_REPLY: if (missedReplyCount.incrementAndCheck()) { - // handleRecovery(event->getEvent()); - triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0); + handleRecovery(event->getEvent()); } break; case PowerSwitchIF::SWITCH_WENT_OFF: // This means the switch went off only for one device. - // handleRecovery(event->getEvent()); - triggerEvent(syrlinks::FDIR_REACTION_IGNORED, event->getEvent(), 0); + handleRecovery(event->getEvent()); break; default: break; diff --git a/tmtc b/tmtc index b17c413e..8115a39d 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b17c413e8f1d7a827b2fdd02b642a3bbebb2738c +Subproject commit 8115a39d66e219a7c6f5cdd1d4fd524ebcf6bd2d