CAN BUS - G120 - Filtering PGNs using masks

I am trying to filter out all CAN messages that do not relate to Fuel Messages (PGN 65266) on a J1939 CAN bus network.

As i understand SetExplicitFilters are used to filter out all messages but the ones that are allowed to pass.

SetGroupFilters are used to filter out all messages that are outside the lower and upper bound.

I need a way of searching and keeping CAN messages that CONTAIN a specific 16 bits value (PGN) that value is in the middle of the 29 bit extended CAN J1939 message. Thus a filtering with a MASK would be quite useful.

Does anybody here attempted this using the internal CAN module registers?

Have a great day,
Jean-Francois.

IIRC, you can set the filter with masks.

IIRC = if I remember correctly.

Sorry to be dumb, do you have an example of this? What is the format of the mask? Somewhat related, is there any possibility of using the hardware filtering in the Premium Libraries? J1939 can be rather busy and it seems the processor may be easily overwhelmed just doing the filtering. I still see buffer overflows with a 1000 message buffer and only two ID’s allowed (filtered). Thanks.

There are two methods found in the CAN class to handle filters, explicit and grouped. Please take a look.