From 9143d7c249a7c2f556f69446b65d673bd85c3700 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Fri, 9 Sep 2022 08:21:14 +0200 Subject: [PATCH] Fix: Only use a single transmit buffer when transmitting OpenCyphal/CAN frames. This prevents the dreaded unintented priority (and therefore frame order) inversion on the CAN bus. --- src/ArduinoMCP2515.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ArduinoMCP2515.cpp b/src/ArduinoMCP2515.cpp index 02a2129..868174e 100644 --- a/src/ArduinoMCP2515.cpp +++ b/src/ArduinoMCP2515.cpp @@ -133,6 +133,13 @@ bool ArduinoMCP2515::transmitCANFrame(uint32_t const id, uint8_t const * data, u return true; } +#if LIBCANARD + /* Only use a single transmit buffer in order to prevent unintentional + * priority inversion while transmitting OpenCyphal/CAN frames. + */ + return false; +#endif + if (isBitClr(_io.readRegister(Register::TXB1CTRL), bp(TXBnCTRL::TXREQ))) { _ctrl.transmit(TxB::TxB1, id, data, len);