ESP32 CAN acceptance filter

PhilippFu
Posts: 1
Joined: Tue Jun 04, 2019 1:05 pm

ESP32 CAN acceptance filter

Postby PhilippFu » Tue Jun 04, 2019 2:20 pm

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

ESP_Dazz
Posts: 308
Joined: Fri Jun 02, 2017 6:50 am

Re: ESP32 CAN acceptance filter

Postby ESP_Dazz » Tue Jun 04, 2019 2:48 pm

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

Who is online

Users browsing this forum: No registered users and 102 guests