I am working to implement a code to receive and send some messages but when I try to apply more than two filters, the application allows to receive IDs out the range. I will explain an example and show you how I have implemented this part.
This code is not exactly my code it's an approximation, but I don't put redundancies things like getting errors and things like that.
Code: Select all
// close the filter
iBuffer = PCAN_FILTER_CLOSE;
gFilter = CAN_SetValue(PCAN_USBBUS1, PCAN_MESSAGE_FILTER, &iBuffer, sizeof(iBuffer));
gFilter = CAN_FilterMessages(PCAN_USBBUS1, 36, 36, PCAN_MODE_EXTENDED);
gFilter = CAN_FilterMessages(PCAN_USBBUS1, 170, 170, PCAN_MODE_EXTENDED);
gFilter = CAN_FilterMessages(PCAN_USBBUS1, 180, 180, PCAN_MODE_EXTENDED);
gFilter = CAN_FilterMessages(PCAN_USBBUS1, 1056, 1056, PCAN_MODE_EXTENDED);
// Reading part
gStatus = CAN_ReadFD(m_devValue, &msgFD, ×tampFD);
I was reading that you can receive messages out of those ranges that you set because https://www.nxp.com/docs/en/application ... N97076.pdf and I saw this point on the help manual:
I would like to know if you know some solution to avoid this behavior.It is not guaranteed that an application only receives CAN messages in the range of FromID to ToID. This is caused by the operating principle of the SJA1000's acceptance filter. See also Philips Data Sheet "SJA1000 Stand-alone CAN-controller".
Thanks for advance.
Víctor