How to Set CAN Message Filtering?

Hello, Any advice on how to filter messages in Arduino Unor R4 Mini.

Ar.

I am using the SN65HVD230 breakout module as per the guide, but unlike the MCP_2515, the library in this guide does not seem to provide features such as CAN.init_Mask and CAN.init_Filt.

Do you have any advice or anything?

1 Like

Welcome! There are several posts on line that may answer your question. Use the Search Forum and look for "CAN BUS message filtering" It may not give you an exact answer but it will give you at least a starting point. The masking should be the same the setup will be different with the R4.

1 Like

does not look like they have implemented it in the drivers :frowning:
however looking at section 30 of the user guide for the uC the filter feature is available.

The acceptance filter of CAN is implemented with 8 acceptance masks (one mask for every four mailboxes). Masks independently enabled or disabled for each mailbox. You can try manually write the Mask Registers (MKRk) (k = 0 to 7)

If you have success implementing it from scratch (ie by setting the respective registers for the CAN filtering), please post back an example as a contribution to the community! :slight_smile: :+1:

Happy coding!

2 Likes

or more easily set the group masks.
looking at the related header files (https://github.com/arduino/ArduinoCore-renesas/blob/main/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp) while there is no dedicated routine to change the mask value, you may, should you wish to do so, update the mask value within the CPP file itself to enable the masking.

Please make a copy of the cpp, before making any changes as I have not clue how that would impact your board should it be incorrect!

Thx, your advice. i will try and reply.

1 Like

Thank you for your detailed advice.
I'll study a little more, try it, and if I succeed, I'll post an example.

That's right, good advice, you have to follow it to the letter to obtain good results.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.