From c881b36630b28a37c5f3164cc62b6fea82f01217 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 28 Jun 2023 15:28:27 +0200 Subject: [PATCH 1/6] prevent warning --- linux/ipcore/AxiPtmeConfig.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/linux/ipcore/AxiPtmeConfig.cpp b/linux/ipcore/AxiPtmeConfig.cpp index d3d5662a..7f044c79 100644 --- a/linux/ipcore/AxiPtmeConfig.cpp +++ b/linux/ipcore/AxiPtmeConfig.cpp @@ -26,8 +26,7 @@ ReturnValue_t AxiPtmeConfig::initialize() { } ReturnValue_t AxiPtmeConfig::writeCaduRateReg(uint8_t rateVal) { - ReturnValue_t result = returnvalue::OK; - result = mutex->lockMutex(timeoutType, mutexTimeout); + ReturnValue_t result = mutex->lockMutex(timeoutType, mutexTimeout); if (result != returnvalue::OK) { sif::warning << "AxiPtmeConfig::writeCaduRateReg: Failed to lock mutex" << std::endl; return returnvalue::FAILED; @@ -42,7 +41,6 @@ ReturnValue_t AxiPtmeConfig::writeCaduRateReg(uint8_t rateVal) { } uint8_t AxiPtmeConfig::readCaduRateReg() { - ReturnValue_t result = returnvalue::OK; MutexGuard mg(mutex); return static_cast(*(baseAddress + CADU_BITRATE_REG)); } -- 2.43.0 From 9dfdf388225f7cbc9d5e7faf4085b42aff570cf1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 28 Jun 2023 17:20:10 +0200 Subject: [PATCH 2/6] important bugfix for live channel --- linux/ipcore/PapbVcInterface.cpp | 1 - mission/com/LiveTmTask.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/linux/ipcore/PapbVcInterface.cpp b/linux/ipcore/PapbVcInterface.cpp index 404f3653..98cb1b41 100644 --- a/linux/ipcore/PapbVcInterface.cpp +++ b/linux/ipcore/PapbVcInterface.cpp @@ -34,7 +34,6 @@ ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size) { return DirectTmSinkIF::IS_BUSY; } for (size_t idx = 0; idx < size; idx++) { - // if (pollInterfaceReadiness(2, false) == returnvalue::OK) { *(vcBaseReg + DATA_REG_OFFSET) = static_cast(data[idx]); } completePacketTransfer(); diff --git a/mission/com/LiveTmTask.cpp b/mission/com/LiveTmTask.cpp index d09c6ced..b3358789 100644 --- a/mission/com/LiveTmTask.cpp +++ b/mission/com/LiveTmTask.cpp @@ -20,7 +20,7 @@ ReturnValue_t LiveTmTask::performOperation(uint8_t opCode) { readCommandQueue(); while (true) { bool performWriteOp = true; - if (mode == MODE_OFF or ptmeLocked) { + if (ptmeLocked) { performWriteOp = false; } -- 2.43.0 From 25da1316535cdc053ee96bc2036e5a082f50ccfe Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 29 Jun 2023 00:33:58 +0200 Subject: [PATCH 3/6] seems to work well --- linux/ipcore/PapbVcInterface.cpp | 27 ++++++++++++++++++++++++++- linux/ipcore/PapbVcInterface.h | 3 +++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/linux/ipcore/PapbVcInterface.cpp b/linux/ipcore/PapbVcInterface.cpp index 98cb1b41..5dcb4519 100644 --- a/linux/ipcore/PapbVcInterface.cpp +++ b/linux/ipcore/PapbVcInterface.cpp @@ -33,9 +33,21 @@ ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size) { } else { return DirectTmSinkIF::IS_BUSY; } + if (not pollReadyForOctet(MAX_BUSY_POLLS)) { + abortPacketTransfer(); + return returnvalue::FAILED; + } for (size_t idx = 0; idx < size; idx++) { + if (not pollReadyForOctet(MAX_BUSY_POLLS)) { + abortPacketTransfer(); + return returnvalue::FAILED; + } *(vcBaseReg + DATA_REG_OFFSET) = static_cast(data[idx]); } + if (not pollReadyForOctet(MAX_BUSY_POLLS)) { + abortPacketTransfer(); + return returnvalue::FAILED; + } completePacketTransfer(); return returnvalue::OK; } @@ -50,7 +62,6 @@ bool PapbVcInterface::pollReadyForPacket() const { // Check if PAPB interface is ready to receive data. Use the configuration register for this. // Bit 5, see PTME ptme_001_01-0-7-r2 Table 31. uint32_t reg = *vcBaseReg; - // bool busy = (reg >> 5) & 0b1; return (reg >> 6) & 0b1; } @@ -76,6 +87,20 @@ bool PapbVcInterface::isBusy() const { return not pollReadyForPacket(); } void PapbVcInterface::cancelTransfer() { abortPacketTransfer(); } +inline bool PapbVcInterface::pollReadyForOctet(uint32_t maxCycles) const { + uint32_t reg; + uint32_t idx = 0; + while (idx < maxCycles) { + reg = *vcBaseReg; + // Busy bit. + if (not((reg >> 5) & 0b1)) { + return true; + } + idx++; + } + return false; +} + ReturnValue_t PapbVcInterface::sendTestFrame() { /** Size of one complete transfer frame data field amounts to 1105 bytes */ uint8_t testPacket[1105]; diff --git a/linux/ipcore/PapbVcInterface.h b/linux/ipcore/PapbVcInterface.h index ba6063b5..9c6734e8 100644 --- a/linux/ipcore/PapbVcInterface.h +++ b/linux/ipcore/PapbVcInterface.h @@ -80,6 +80,7 @@ class PapbVcInterface : public VirtualChannelIF { static constexpr long int FIRST_DELAY_PAPB_POLLING_NS = 10; static constexpr long int MAX_DELAY_PAPB_POLLING_NS = 40; + static constexpr uint32_t MAX_BUSY_POLLS = 100000; LinuxLibgpioIF* gpioComIF = nullptr; /** High when external buffer memory of virtual channel is empty */ @@ -118,6 +119,8 @@ class PapbVcInterface : public VirtualChannelIF { */ inline bool pollReadyForPacket() const; + inline bool pollReadyForOctet(uint32_t maxCycles) const; + /** * @brief This function can be used for debugging to check whether there are packets in * the packet buffer of the virtual channel or not. -- 2.43.0 From 03e772246f1a5211f815ac8691da86d36b8b32e4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 29 Jun 2023 00:35:06 +0200 Subject: [PATCH 4/6] less cycles.. --- linux/ipcore/PapbVcInterface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/ipcore/PapbVcInterface.h b/linux/ipcore/PapbVcInterface.h index 9c6734e8..b5160748 100644 --- a/linux/ipcore/PapbVcInterface.h +++ b/linux/ipcore/PapbVcInterface.h @@ -80,7 +80,7 @@ class PapbVcInterface : public VirtualChannelIF { static constexpr long int FIRST_DELAY_PAPB_POLLING_NS = 10; static constexpr long int MAX_DELAY_PAPB_POLLING_NS = 40; - static constexpr uint32_t MAX_BUSY_POLLS = 100000; + static constexpr uint32_t MAX_BUSY_POLLS = 1000; LinuxLibgpioIF* gpioComIF = nullptr; /** High when external buffer memory of virtual channel is empty */ -- 2.43.0 From 4fc999e10226cf93653ab9e6dd2bb47e801707c1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 29 Jun 2023 15:03:45 +0200 Subject: [PATCH 5/6] changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5881296..116649da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,11 @@ will consitute of a breaking change warranting a new major release: - Important bugfixes for PTME. See `q7s-package` CHANGELOG. +## Changed + +- Added back PTME busy bit polling. This is necessary due to changes to the AXI APB interface + to the PTME core. + # [v5.2.0] 2023-06-29 ## Fixed -- 2.43.0 From 56ea9af615e97dfc22c1113f52f94d701dcbef0c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 29 Jun 2023 15:06:25 +0200 Subject: [PATCH 6/6] add documentation of initial delay --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 6b06283c..ce57c33f 100644 --- a/README.md +++ b/README.md @@ -964,6 +964,12 @@ used by other software components to read the current chip and copy. This is a configuration scripts which runs after the Network Time Protocol has run. This script currently sets the static IP address `192.168.133.10` and starts the `can` interface. +## Initial boot delay + +You can create a file named `boot_delays_secs.txt` inside the home folder to delay the OBSW boot +for 6 seconds if the file is empty of for the number of seconds specified inside the file. This +can be helpful if something inside the OBSW leads to an immediate crash of the OBC. + ## PCDU Connect to serial console of P60 Dock -- 2.43.0