I am using PCAN Basic for python.
I could not get the FilterMessages to work correctly with my code, so I tried to use the example code to test it out and see if I was doing something wrong. When I used the example code, it also did not filter messages.
I initialized the CAN, then closed the message filter, then customized the message filter to accept only one ID (From and To are the same ID), and then I read the messages manually and none of them had the ID I filtered for.
I attached the log to demonstrate the issue. Am I missing something?
Thanks
Example Code does not Filter Messages
Example Code does not Filter Messages
- Attachments
-
PCANBasic.log
- (5.06 KiB) Downloaded 423 times
Re: Example Code does not Filter Messages
Ok, I found out that you have to call Reset() in order to flush the un-filtered messages out of the receive queue after filtering messages.
-
- Posts: 2
- Joined: Mon 21. Oct 2019, 09:07
Re: Example Code does not Filter Messages
Thanks, after hours of debugging and unfruitfully tweaking the filters and what not this is what worked for me.
But the documentation says exactly the opposite:
But the documentation says exactly the opposite:
Please guys update the documentation to include this. It would save a lot of time.Take in account that configuring the message filter cause the CAN controller to enter the Reset state. This will affect other applications that communicate with the same PCAN hardware.
Re: Example Code does not Filter Messages
Hello,
please don't mixup apples and pears. The user amyers wanted to clear the message queues of a connection. This is done using the function CAN_Reset() as stated in the help:
please don't mixup apples and pears. The user amyers wanted to clear the message queues of a connection. This is done using the function CAN_Reset() as stated in the help:
Now, you are here quoting a remark of the function CAN_FilterMessages, which configures the acceptance mask and code registers of the CAN controller. As the help states, this causes the CAN controller to enter the "Reset state" (it has nothing to do with the CAN_Reset function, but with the behavior in the CAN controller). What do you mean with"Resets the receive and transmit queues of a PCAN Channel."
The only thing that is not correct is that the word "Reset" from "Reset state" was automatically interpreted by the help compiler as a link to the CAN_Reset function, what is wrong. This was already fixed and will be available by the next release of the library.
Best regards,
Keneth
Keneth