CAN Bus freestyle best practices

Hi all,

We have successfully developped a fair size application on X90CP72 mobile platform which has been running in the wild for 4 years now.
As we add more and more features to our solution, we keep loading the CAN bus that uses exclusively freestyle customs protocols and for which we have to code/decode CAN frames.
We use ArCanReceive and ArCanSend extensively with CAN Id masking when a bunch of CAN IDs are contiguous, or with one dedicated FB for each CAN ID can’t be easily filtered and masked.

As we increase the number of CAN devices, we reach high CPU loads, which seems related to the increasing async ArCAN FB calls according to the profiler.

I start to consider rewriting the CAN receive / routing layer with a bounded WHILE loop and a big switch case to route to each decoding block, in order to minimize the number of ArCANReceive FB instances.
This is not ideal and not desirable to keep the code modular.

I wonder if there are any feed back or best practices about how to best use ArCAN that I could base my design on.

Thanks you for any feed back,

Best regards.

Hi, please try to use the Can ID mask (input parameter of ArCanReceive) in order to use less FB instances for receiving the Can frames.
In general, these Can FBs are executed in the idle time.
In case the CPU load is too high some CAN frames might be lost but the cyclic execution of the system stays available.