Hi,
I finally understood how Dual Mode Filter works.
Fully tested and it works very well, I'm getting only the expected ID's
Setup: ESP32 mini (mhetesp32devkit) + SN65HVD230 + PlatformIO VSCode + PEAK USB-CAN sniffer to simulate CAN messages
Lib CAN by Michael Wagner (miwagner):
https://github.com/miwagner/ESP32-Arduino-CAN
// CAN bus
/* WEMOS_R05 - GPIO17:Data_CAN0_TXD #define GPIO16_Data_CAN0_TXD */
/* WEMOS_R06 - GPIO16:Data_CAN0_RXD #define GPIO17_Data_CAN0_RXD */
CAN_cfg.speed = CAN_SPEED_500KBPS;
CAN_cfg.tx_pin_id = GPIO_NUM_16; // Tx CAN SN65HVD230
CAN_cfg.rx_pin_id = GPIO_NUM_17; // Rx CAN SN65HVD230
CAN_cfg.rx_queue = xQueueCreate(rx_queue_size, sizeof(CAN_frame_t));
PDO_Rec_Timeout_alarm_ref = 5; // Alarm if PDO is not received 5 times pooling time expected
PDO_Rec_Timeout_fault_ref = 15; // Fault if PDO is not received 10 times pooling time expected
CAN_all_1st_Rec_detected = CAN_Auto_Reset_Done = LOW;
// ESP32 hardware Dual Filter Mode is used
CAN_filter_t p_filter;
p_filter.FM = Dual_Mode;
// ID's received by Filter 1: 0x120, 0x129, 0x12B
p_filter.ACR0 = 0x24; // ACR0 0x24
p_filter.ACR1 = 0x00; // ACR1 0x00
p_filter.AMR0 = 0x01; // AMR0 0x01
p_filter.AMR1 = 0x7F; // AMR1 0x7F
// ID's received by Filter 2: 0x290, 0x540, 0x550
p_filter.ACR2 = 0x52; // ACR2 0x52
p_filter.ACR3 = 0x00; // ACR3 0x00
p_filter.AMR2 = 0xFA; // AMR2 0xFA
p_filter.AMR3 = 0x1F; // AMR3 0x1F
// Config Filter
ESP32Can.CANConfigFilter(&p_filter);
// Init CAN Module
ESP32Can.CANInit();
// ID1: 0x120, 20ms, CAN_Engine_Speed_rpm, CAN_Throttle_Handle_Position
// ID2: 0x129, 20ms, CAN_Gear_Position, CAN_Clutch_On
// ID3: 0x12B, 10ms, Bike_Speed_front_kmh, Bike_Speed_rear_kmh
// ID4: 0x290, 10ms, CAN_Brake_Front_signal, CAN_Brake_Rear_signal, CAN_Brake_Light
// ID5: 0x540, 10ms, CAN_Oil_Temp_DegC
// ID6: 0x550, 20ms, CAN_Water_Temp_DegC, CAN_High_Beam, CAN_Low_Beam, CAN_Turn_R, CAN_Turn_L, CAN_Turn_Hazard
I made a EXCEL to better explain.
Hoping this helps.