From a1cd3017c840942a7a4eeed0e44460e5df796e65 Mon Sep 17 00:00:00 2001 From: kouuta Date: Wed, 8 Mar 2023 23:32:51 +0900 Subject: [PATCH 1/2] Fix extended ID filter mistake --- src/ESP32SJA1000.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ESP32SJA1000.cpp b/src/ESP32SJA1000.cpp index 3c56fba..309e030 100644 --- a/src/ESP32SJA1000.cpp +++ b/src/ESP32SJA1000.cpp @@ -304,12 +304,12 @@ int ESP32SJA1000Class::filterExtended(long id, long mask) writeRegister(REG_ACRn(0), id >> 21); writeRegister(REG_ACRn(1), id >> 13); writeRegister(REG_ACRn(2), id >> 5); - writeRegister(REG_ACRn(3), id << 5); + writeRegister(REG_ACRn(3), id << 3); writeRegister(REG_AMRn(0), mask >> 21); writeRegister(REG_AMRn(1), mask >> 13); writeRegister(REG_AMRn(2), mask >> 5); - writeRegister(REG_AMRn(3), (mask << 5) | 0x1f); + writeRegister(REG_AMRn(3), (mask << 3) | 0x1f); modifyRegister(REG_MOD, 0x17, 0x00); // normal From b514e6b8596126a8f94f226b9906455393efd3a2 Mon Sep 17 00:00:00 2001 From: jonmon6691 Date: Thu, 28 Mar 2024 13:34:15 -0700 Subject: [PATCH 2/2] Add bit timing configurations for 667 kbaud CAN buses Register definitions maintain the library conventions for sampling modes and other bitfields in the CNF registers according to clock speed. --- src/MCP2515.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/MCP2515.cpp b/src/MCP2515.cpp index a153a76..36c160d 100644 --- a/src/MCP2515.cpp +++ b/src/MCP2515.cpp @@ -91,6 +91,7 @@ int MCP2515Class::begin(long baudRate) uint8_t cnf[3]; } CNF_MAPPER[] = { { (long)8E6, (long)1000E3, { 0x00, 0x80, 0x00 } }, + { (long)8E6, (long)666666, { 0xC0, 0xB8, 0x01 } }, { (long)8E6, (long)500E3, { 0x00, 0x90, 0x02 } }, { (long)8E6, (long)250E3, { 0x00, 0xb1, 0x05 } }, { (long)8E6, (long)200E3, { 0x00, 0xb4, 0x06 } }, @@ -104,6 +105,7 @@ int MCP2515Class::begin(long baudRate) { (long)8E6, (long)5E3, { 0x1f, 0xbf, 0x07 } }, { (long)16E6, (long)1000E3, { 0x00, 0xd0, 0x82 } }, + { (long)16E6, (long)666666, { 0xC0, 0xF8, 0x81 } }, { (long)16E6, (long)500E3, { 0x00, 0xf0, 0x86 } }, { (long)16E6, (long)250E3, { 0x41, 0xf1, 0x85 } }, { (long)16E6, (long)200E3, { 0x01, 0xfa, 0x87 } },