Skip to content

Commit

Permalink
Improved reliability of transmitting through the FlexCAN driver
Browse files Browse the repository at this point in the history
Asked the driver to use only 1 tx mailbox, and increased queue size
to allow nearly two full ETP EDPO windows with max size.
  • Loading branch information
ad3154 committed Oct 12, 2023
1 parent b4ad234 commit 9af5ee8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
11 changes: 6 additions & 5 deletions src/flex_can_t4_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
namespace isobus
{
#if defined(__IMXRT1062__)
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_256> FlexCANT4Plugin::can0;
FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_256> FlexCANT4Plugin::can1;
FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_256> FlexCANT4Plugin::can2;
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_512> FlexCANT4Plugin::can0;
FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_512> FlexCANT4Plugin::can1;
FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_512> FlexCANT4Plugin::can2;
#elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_256> FlexCANT4Plugin::can0;
FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_256> FlexCANT4Plugin::can1;
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_512> FlexCANT4Plugin::can0;
FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_512> FlexCANT4Plugin::can1;
#endif

FlexCANT4Plugin::FlexCANT4Plugin(std::uint8_t channel) :
Expand Down Expand Up @@ -104,6 +104,7 @@ namespace isobus
message.id = canFrame.identifier;
message.len = canFrame.dataLength;
message.flags.extended = true;
message.seq = 1; // Try to get messages to go out sequentially...
memcpy(message.buf, canFrame.data, canFrame.dataLength);

if (0 == selectedChannel)
Expand Down
10 changes: 5 additions & 5 deletions src/flex_can_t4_plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ namespace isobus

private:
#if defined(__IMXRT1062__)
static FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_256> can0;
static FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_256> can1;
static FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_256> can2;
static FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_512> can0;
static FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_512> can1;
static FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_512> can2;
#elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
static FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_256> can0;
static FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_256> can1;
static FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_512> can0;
static FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_512> can1;
#endif
std::uint8_t selectedChannel;
bool isOpen = false;
Expand Down

0 comments on commit 9af5ee8

Please sign in to comment.