pierremolinaro / acan-t4

CAN / CANFD Arduino Library for Teensy 4.0
MIT License
17 stars 4 forks source link

Receive filters with CANFD #8

Open syrinxtech opened 8 months ago

syrinxtech commented 8 months ago

Has anyone gotten the CANFD receive filters to work? I've been using this great library for awhile now and the only way I can process incoming CANFD frames is to use an "accept-all" filter. For example, I have tried setting a filter for ID 0xD5 and 0xD6, along with an accept-all filter. When I receive the frames, all of the accepted data uses index 2, indicating that the accept-all filter is catching the incoming frames. I also receive data for 0xD4, 0xD5 and 0xD6. I was trying to filter out 0xD4.

I have read and studied the information provided on page 55 of the manual regarding the issues with CANFD filters. Does anyone know if this issue still exists? I'm not 100% sure I understand what it means in the manual "So we should use the legacy legacy way, filtering is done per receive Message Buffer."

Here is code I use to create the receive filters:

ACAN_T4FD_Settings settings(1000000, DataBitRateFactor::x1);
const ACANFDFilter FDFilters[] = {
  ACANFDFilter(kData, kStandard, 0xD5, procRECVFDMsg),
  ACANFDFilter(kData, kStandard, 0xD6, procRECVFDMsg),
  ACANFDFilter(kData, kStandard, procRECVFDMsg)
};
const uint8_t numFilters = 3;
errorCode = ACAN_T4::can3.beginFD(settings, FDFilters, numFilters);

Any help would be greatly appreciated.

pierremolinaro commented 8 months ago

Hello,

I agree, filtering does not work in CANFD mode. It is a bug. The chapter 55 (CANFD) of the iMXRT1060RM reference manual is awful, very very hard to read.

Give me a few days to figure out what's going on.

Pierre

Le 14 janv. 2024 à 11:40, Bryan Miller @.***> a écrit :

Has anyone gotten the CANFD receive filters to work? I've been using this great library for awhile now and the only way I can process incoming CANFD frames is to use an "accept-all" filter. For example, I have tried setting a filter for ID 0xD5 and 0xD6, along with an accept-all filter. When I receive the frames, all of the accepted data uses index 2, indicating that the accept-all filter is catching the incoming frames. I also receive data for 0xD4, 0xD5 and 0xD6. I was trying to filter out 0xD4.

I have read and studied the information provided on page 55 of the manual regarding the issues with CANFD filters. Does anyone know if this issue still exists? I'm not 100% sure I understand what it means in the manual "So we should use the legacy legacy way, filtering is done per receive Message Buffer."

Here is code I use to create the receive filters:

ACAN_T4FD_Settings settings(1000000, DataBitRateFactor::x1); const ACANFDFilter FDFilters[] = { ACANFDFilter(kData, kStandard, 0xD5, procRECVFDMsg), ACANFDFilter(kData, kStandard, 0xD6, procRECVFDMsg), ACANFDFilter(kData, kStandard, procRECVFDMsg) }; const uint8_t numFilters = 3; errorCode = ACAN_T4::can3.beginFD(settings, FDFilters, numFilters);

Any help would be greatly appreciated.

— Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan-t4/issues/8, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVCUPZCHNUH2UGMPKJDYOOY3RAVCNFSM6AAAAABB2AEOKCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA4DANRXGQZTIOA. You are receiving this because you are subscribed to this thread.

syrinxtech commented 8 months ago

Thank you very much for the response. I have a Teensy 3.2, five Teensy 4.0 and a 4.1 for testing, along with enough transceivers for every board. I would be more than happy to help test your changes. I love your code and it's so well documented. When I started working with Teensy and CANBUS, I did try out the FLEXCan library along with yours. I found that your library seemed to make more sense to me and it just worked.

pierremolinaro commented 8 months ago

Hello,

I think I have fixed the bug, I've just released a new version (1.1.6).

I have also updated the LoopBackDemoIntensiveCAN3FDFilters sketch to perform an exhautive check for all frames with 11 bit identifiers. It work, but I wonder if there isn't a bug in the reference manual?

Best Regards,

Pierre

Le 14 janv. 2024 à 16:51, Bryan Miller @.***> a écrit :

Thank you very much for the response. I have a Teensy 3.2, five Teensy 4.0 and a 4.1 for testing, along with enough transceivers for every board. I would be more than happy to help test your changes. I love your code and it's so well documented. When I started working with Teensy and CANBUS, I did try out the FLEXCan library along with yours. I found that your library seemed to make more sense to me and it just worked.

— Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan-t4/issues/8#issuecomment-1890988996, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVCD72SMNTTKDZFNCUDYOP5JDAVCNFSM6AAAAABB2AEOKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJQHE4DQOJZGY. You are receiving this because you commented.

syrinxtech commented 8 months ago

Wow, that was really quick. I have downloaded the update and will work with it shortly. I quickly reviewed the new sketch and thought it was a great idea. I'd be more than happy to upload my sender/receiver code if you think it might be worthy of adding it to the examples.

One more thing, I have read your manual 3-4 times cover to cover and if you're up for it, I would be happy to offer some suggestions on sections where I got confused as a noobie to CAN. It might help with other new users who might have the same confusion. It's the least I could do for such a cool and functional library.

syrinxtech commented 8 months ago

Pierre,

I just tried the new library and it works! I was able to filter out one of the three variables I sent from the sender. Many, many thanks. I will check out the new example and see how it looks.

pierremolinaro commented 8 months ago

Fine !

Le 14 janv. 2024 à 22:29, Bryan Miller @.***> a écrit :

Pierre,

I just tried the new library and it works! I was able to filter out one of the three variables I sent from the sender. Many, many thanks. I will check out the new example and see how it looks.

— Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan-t4/issues/8#issuecomment-1891077575, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVAXC35UIZMGAZEZ3XDYORE37AVCNFSM6AAAAABB2AEOKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJRGA3TONJXGU. You are receiving this because you commented.

pierremolinaro commented 8 months ago

Le 14 janv. 2024 à 20:02, Bryan Miller @.***> a écrit :

Wow, that was really quick. I have downloaded the update and will work with it shortly. I quickly reviewed the new sketch and thought it was a great idea. I'd be more than happy to upload my sender/receiver code if you think it might be worthy of adding it to the examples.

Yes, with pleasure. I'll keep your copyright One more thing, I have read your manual 3-4 times cover to cover and if you're up for it, I would be happy to offer some suggestions on sections where I got confused as a noobie to CAN. It might help with other new users who might have the same confusion. It's the least I could do for such a cool and functional library.

I welcome your suggestions. I'm not too fluent in English, so if you spot any mistakes or incorrect constructions, please let me know.

To answer the question in your first e-mail "So we should use the legacy legacy way, filtering is done per receive Message Buffer. » The RxFIFO should not be used in CANFD mode, so the only way is to assign a filter to every Message Buffer that is dedicaced to reception, as shown in figure 4 page 30.

Best Regards,

Pierre

— Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan-t4/issues/8#issuecomment-1891042064, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVEQR5H47CEKRZQXOD3YOQTTFAVCNFSM6AAAAABB2AEOKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJRGA2DEMBWGQ. You are receiving this because you commented.

syrinxtech commented 8 months ago

Pierre,

Do you have a Word copy of your documentation? I'd be happy to make my suggested changes and return it for your review. Feel free to email it to me.

pierremolinaro commented 7 months ago

Hello Bryan,

The documentation is written in XeLatex. I have a Mac under Sonoma, and I use the MacTeX-2023 Distribution.

Pierre

Le 15 janv. 2024 à 12:29, Bryan Miller @.***> a écrit :

Pierre,

Do you have a Word copy of your documentation? I'd be happy to make my suggested changes and return it for your review. Feel free to email it to me.

— Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan-t4/issues/8#issuecomment-1891990314, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVHKNSCBZPZLZ7HRCI3YOUHKZAVCNFSM6AAAAABB2AEOKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJRHE4TAMZRGQ. You are receiving this because you commented.

syrinxtech commented 7 months ago

Bummer. I don't have that software. I haven't worked with anything close to Latex in about 40 years. Is it possible to export it into something I can work with?

pierremolinaro commented 7 months ago

Hum, I think there is no way to translate a Latex document to Word, and to translate Word to Latex.

Can you annotate the PDF document ? On Mac, Preview can do that easily.

Pierre

Le 18 janv. 2024 à 10:04, Bryan Miller @.***> a écrit :

Bummer. I don't have that software. I haven't worked with anything close to Latex in about 40 years. Is it possible to export it into something I can work with?

— Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan-t4/issues/8#issuecomment-1898067658, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVHZ4UM3YUWQSRQRGJLYPDQRTAVCNFSM6AAAAABB2AEOKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJYGA3DONRVHA. You are receiving this because you commented.

syrinxtech commented 7 months ago

I will give that a try.

syrinxtech commented 7 months ago

Pierre, I've attached the manual with my suggested changes. I hope this helps. acan-t4-comments.pdf

pierremolinaro commented 7 months ago

Thank you very much !

I've had a quick look at your suggestions and corrections, which are very useful for improving the document.

I'll take them into account as soon as I have a bit of time to do so.

Pierre

Le 27 janv. 2024 à 14:32, Bryan Miller @.***> a écrit :

Pierre, I've attached the manual with my suggested changes. I hope this helps. acan-t4-comments.pdf https://github.com/pierremolinaro/acan-t4/files/14072418/acan-t4-comments.pdf — Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan-t4/issues/8#issuecomment-1913157451, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVHKFXNSTQRIGZERY7TYQT6XNAVCNFSM6AAAAABB2AEOKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJTGE2TONBVGE. You are receiving this because you commented.

syrinxtech commented 5 months ago

Pierre,

Don't forget to update the version number on the cover of the manual to 1.1.7.

pierremolinaro commented 5 months ago

You are right!

I have fixed the version number and done a new release.

Thanks,

Pierre

Le 24 mars 2024 à 19:17, Bryan Miller @.***> a écrit :

Pierre,

Don't forget to update the version number on the cover of the manual to 1.1.7.

— Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan-t4/issues/8#issuecomment-2016892247, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVFU6MYFU2GAWC6I5ILYZ4KE3AVCNFSM6AAAAABB2AEOKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJWHA4TEMRUG4. You are receiving this because you commented.

syrinxtech commented 5 months ago

Pierre,

I have upgraded to 1.1.8 and everything works great. I have a mixture of two Teensy 4.0's and a Teensy 4.1 working great with multiple receive filters. Great job. New manual looks great.

pierremolinaro commented 5 months ago

Thank you very much!

It's thanks to you that the manual has been improved!

Pierre

Le 27 mars 2024 à 01:06, Bryan Miller @.***> a écrit :

Pierre,

I have upgraded to 1.1.8 and everything works great. I have a mixture of two Teensy 4.0's and a Teensy 4.1 working great with multiple receive filters. Great job. New manual looks great.

— Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan-t4/issues/8#issuecomment-2021681835, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVF5TX3DJU3KIZTIXDDY2IERHAVCNFSM6AAAAABB2AEOKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRRGY4DCOBTGU. You are receiving this because you commented.