Page 1 of 1

ESP32 CAN acceptance filter

Posted: Tue Jun 04, 2019 2:20 pm
by PhilippFu
Hello,
i'm looking for a Example how to use the CAN acceptance filter.
According to the logical circuit in the documentations from the SJA1000 CAN Controller:
acc(0,31) = ((message_bit(0,31) XOR acceptance_code(0,31)) OR acceptance_mask(0,31)
message_accepted = acc(0) AND acc(1) AND ... AND acc(31)
-> message_accepted = logical 1 => accepted
-> message_accepted = logical 0 => not accepted

I try to filter all Messages except for id = 0x30. But i don't get the right result.
  1. #define CAN_FILTER_CONFIG_ACCEPT()  {.acceptance_code = 0x30, .acceptance_mask = 0xffff8000, .single_filter = true}
How should the acceptance filter Registers described for id = 0x30?

Thank you
Philipp

Re: ESP32 CAN acceptance filter

Posted: Tue Jun 04, 2019 2:48 pm
by ESP_Dazz
You need to account for the fact that the bit field layout of the acceptance code and mask is different in single/dual filter mode and for STD/EXTD IDs.
Please refer to the following links:
https://docs.espressif.com/projects/esp ... nce-filter
https://docs.espressif.com/projects/esp ... figuration