CAN ID filter problem in <Arduino_CAN.h>

Hello!
I'm trying to write a sketch that tests the CAN hardware filters on the Arduino R4 Wifi, but they don't seem to work. I want to filter messages from a single specific standard ID, but I get all the messages from the network. Does it work for anyone? I'm sharing my sketch:

#include <Arduino_CAN.h>

void setup() {
Serial.begin(115200);
while (!Serial)
;

if (!CAN.begin(CanBitRate::BR_250k)) {
Serial.println("CAN initialization error!");
while (1)
;
}
Serial.println("CAN successfully initialized.");

// Set hardware filters
CAN.setFilterMask_Standard(0x7FF); // standard mask
CAN.setFilterId_Standard(0, 0x123); // mailbox 0

}

void loop() {
if (CAN.available()) {
// Read a frame directly
arduino::CanMsg frame = CAN.read();

Serial.print("Received ID: 0x");
Serial.print(frame.id, HEX);
Serial.print(" LEN: ");
Serial.println(frame.data_length);

for (int i = 0; i < frame.data_length; i++) {
  Serial.print("Data[");
  Serial.print(i);
  Serial.print("] = ");
  Serial.println(frame.data[i], HEX);
}

}
}

Best regards!!

Hi @anazkabahn. Have you studied the example sketch that is accessed in Arduino IDE via the File > Examples > Arduino_CAN > CANReadFilter menu item?

I see that it differs from your code in that it iterates over all mailboxes and calls setFilterId_Extended / setFilterId_Standard for each one:

Give that a try and see if you then achieve the expected filtering.

Please read the pinned post re 'How to get the most from the forum', paying attention to posting code and errors as well as wiring diagrams.

Solved best regards!!!