diff --git a/vehicle/OVMS.V3/components/esp32can/src/esp32can.cpp b/vehicle/OVMS.V3/components/esp32can/src/esp32can.cpp index b27101e08..a3b9afcb5 100644 --- a/vehicle/OVMS.V3/components/esp32can/src/esp32can.cpp +++ b/vehicle/OVMS.V3/components/esp32can/src/esp32can.cpp @@ -442,7 +442,7 @@ esp_err_t esp32can::InitController() /* Set sampling * 1 -> triple; the bus is sampled three times; recommended for low/medium speed buses (class A and B) where filtering spikes on the bus line is beneficial * 0 -> single; the bus is sampled once; recommended for high speed buses (SAE class C)*/ - MODULE_ESP32CAN->BTR1.B.SAM=0x1; + MODULE_ESP32CAN->BTR1.B.SAM = (MyESP32can->m_speed < CAN_SPEED_125KBPS) ? 1 : 0; // Enable all interrupts except arbitration loss (can be ignored): uint32_t ier = 0xff & ~__CAN_IRQ_ARB_LOST; diff --git a/vehicle/OVMS.V3/components/mcp2515/src/mcp2515.cpp b/vehicle/OVMS.V3/components/mcp2515/src/mcp2515.cpp index 126a62239..2600e6b3b 100644 --- a/vehicle/OVMS.V3/components/mcp2515/src/mcp2515.cpp +++ b/vehicle/OVMS.V3/components/mcp2515/src/mcp2515.cpp @@ -217,7 +217,13 @@ esp_err_t mcp2515::Start(CAN_mode_t mode, CAN_speed_t speed) cnf1=0x41; cnf2=0xf1; cnf3=0x85; break; case CAN_SPEED_500KBPS: - cnf1=0x00; cnf2=0xf0; cnf3=0x86; + // cnf1=0x00; cnf2=0xf0; cnf3=0x86; original code + // SAE/CiA recommendation + // PROP=5, PS1=8, PS2=2, SJW=2, Sample 1x @87.5% + cnf1=0x40; cnf2=0xbc; cnf3=0x81; + // Arduino MCP_CAN lib + // PROP=6, PS1=5, PS2=4, SJW=2, Sample 3x @75% + // cnf1=0x40; cnf2=0xe5; cnf3=0x83; break; case CAN_SPEED_1000KBPS: cnf1=0x00; cnf2=0xca; cnf3=0x81;