CAN FD to CAN Converter

maxdog

New member
Hello,

I am curious if anybody has seen any examples or created a project that's essentially a CAN FD to CAN converter using the Teensy 4.0? It would only need to go one direction (CAN FD --> CAN), and apply filters before passing the data through. My strength is on the hardware side, and I struggle with the coding, so I was hoping somebody might have already invented this wheel and I could work off of that example. I did a quick search on the forum, but didn't see anything that jumped out.

Thank you for any guidance.
 
You will have to consider what you are trying to achieve by doing this.

First a couple of points just to be sure we're on the same page:
1. CAN and CAN-FD traffic can exist on the same bus. If a standard CAN node sees CAN-FD messages it will consider them errors. However, CAN-FD transmitters can transmit CAN messages the majority of the time if they so choose and so both types of node can exist on the bus at once. You simply cannot send a bunch of FD traffic or it will quickly ramp up the error flags on all the CAN hardware.
2. CAN-FD messages can have up to 64 data bytes. They also can go up to 8Mbps during data bytes.

Given these two things, I can see why a converter could be handy. This allows you to get CAN-FD traffic through to a normal CAN bus without faulting. However, how would you plan to support 64 data bytes when CAN traffic can only have 8? You would have to use some sort of partitioning scheme, such as going ahead and using the ISO-TP standard to re-encode the traffic into multiple frames. Here again you can run into issues. If the FD traffic is going rather quickly then you now have to turn a single frame into 9 or more frames on the slower CAN bus. This could easily lead to overflow conditions.

Bottom line, it's possible and not that especially difficult. But, if you don't properly factor in all the conditions you may find that things don't quite work as well as you'd hoped.

No, I'm not aware of any existing code that does exactly what you want. You could edit the code posted above, strip out all the LCD stuff, and make it forward traffic from the FD bus to one of the other CAN buses. You'd just have to figure out how to properly handle ISO-TP or some other means of fragmenting the FD messages.
 
Thank you CollinK.

At this point it appears that the "messages of interest" are all still 8 data bytes. So for now I think I am good to replicate those on the Non-FD Bus and ignore the rest...
 
Back
Top