-
-
Notifications
You must be signed in to change notification settings - Fork 253
Issue with Can Bus Filter ID's #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What happens when you Software Filter it? like: if ((CAN.packetId() == 0x18daf110) while (CAN.available()) { |
thank you with your lib |
@mehrdad987 Filter like this: CAN.filter(0x7E8); You will ONLY recive the given ID, in this case 0x7E8. This is how it works. if you want multiple or a Range you need to make it in software like in my post above |
yep |
dont use the can.avalable it is too slow. also do this in the reciver callback. it is mutch faster and filters all ids that you want! |
also may consider this comit: for direct access of the Raw Can buffer. |
YOU MEAN THIS virtual void onReceive(void(*callback)(int));
|
Try this: But user the Lib for Raw buffer access: //Globals #include <CAN.h> int byte1; void setup() { CAN.begin(500E3); //Baud Rate } void loop() { } void onReceive(int packetSize) { CAN.readBytes(CanB, 8); // CanB is the Name of the Buffer if (CAN.packetId() == 0x220)
} } |
Hi, I'm a newbie in programming and Arduino, sorry for the dumb questions below! : Taking a look at the last code, I see that CAN.onReceive(onReceive) is a replacement to CAN.parsePacket() and CAN.available to receive CAN packets in order to get good filtering capabilities. But CAN.onReceive is only executed once because it's in the void setup() function. Also, If I'd like to filter the data buffer (ID=0x206, byte1=01 byte2=84 byte3=00 byte4,5,6,7,8=00), would it be fine if I used an IF statement inside the void loop()...or should it be inside the void onReceive(int packetSize) function?
Thanks in advance |
@zalexzperez If you want to filter packets by data, you probably want to do it in the callback function, not the |
I encountered a problem where ESP32 would freeze when using extended ID for communication. |
Fixed by #117. |
Thanks, Sandeep Mistry for the Library!
I need a little help with my Code.
I am working with an ESP32 and a TCAN334. We are facing issue with Filtering Ids. we are using the sample code provided with the library.
Without filter we are getting the data over can bus. But when we apply filters we did not receive any data.
we checked with the library, and ACR registers are correctly set.
We are trying filter with 0x18daf110 (Honda Jazz)
maybe someone can help me out.
The text was updated successfully, but these errors were encountered: