From 84956a51d736c2a577b133cfaa4f86aeb67d62dc Mon Sep 17 00:00:00 2001 From: Max Pfeiffer Date: Sat, 16 Feb 2019 14:30:11 -0800 Subject: [PATCH 1/2] should modify CANb_CTRL2 to allow extended frames, even if global mailbox filter is unused --- FlexCAN.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FlexCAN.cpp b/FlexCAN.cpp index 2033284..0c97cde 100644 --- a/FlexCAN.cpp +++ b/FlexCAN.cpp @@ -22,6 +22,7 @@ #define FLEXCANb_IDFLT_TAB(b, n) (*(vuint32_t*)(b+0xE0+(n*4))) #define FLEXCANb_MB_MASK(b, n) (*(vuint32_t*)(b+0x880+(n*4))) #define FLEXCANb_ESR1(b) (*(vuint32_t*)(b+0x20)) +#define FLEXCANb_CTRL2(b) (*(vuint32_t*)(b+0x34)) #if defined(__MK66FX1M0__) # define INCLUDE_FLEXCAN_CAN1 @@ -216,6 +217,9 @@ void FlexCAN::begin (uint32_t baud, const CAN_filter_t &mask, uint8_t txAlt, uin setBaudRate(baud); + // need to modify CTRL2 to allow extended frames, even if global mailbox filter is unused + FLEXCANb_CTRL2(flexcanBase) = (BIT16); + // enable per-mailbox filtering FLEXCANb_MCR(flexcanBase) |= FLEXCAN_MCR_IRMQ; From d1906bb758d4abf90de72cced44fb99a31d13844 Mon Sep 17 00:00:00 2001 From: Max Pfeiffer Date: Sat, 16 Feb 2019 14:45:42 -0800 Subject: [PATCH 2/2] should modify CANb_CTRL2 to allow extended frames, even if global mailbox filter is unused --- FlexCAN.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FlexCAN.cpp b/FlexCAN.cpp index 0c97cde..1aef1fb 100644 --- a/FlexCAN.cpp +++ b/FlexCAN.cpp @@ -218,7 +218,7 @@ void FlexCAN::begin (uint32_t baud, const CAN_filter_t &mask, uint8_t txAlt, uin setBaudRate(baud); // need to modify CTRL2 to allow extended frames, even if global mailbox filter is unused - FLEXCANb_CTRL2(flexcanBase) = (BIT16); + FLEXCANb_CTRL2(flexcanBase) |= (BIT16); // enable per-mailbox filtering