In case you want to foward CAN FD messages to a regular CAN 2.0 bus you can use the example code below to be used in conjunction with our examples. You can customize this example for your needs.
The way it works:
In case a CAN FD messages is received on CAN1 and it exceeds the size of 8 bytes it will be split into multiple new CAN 2.0 messages with the ID 0x100h - ID 0x107h.
If the CAN FD message is 8 bytes in size or lower, it will be changed to the CAN 2.0 protocol and receive the ID 0x100h.
In this example CAN1 will only relay CAN FD messages as CAN 2.0 to CAN2, regular CAN 2.0 messages will not be relayed.
The comments within the code explain how exactly this is done.
A few caviats:
This does only work, if the receiver of those messages knows how to handle these messages. So you need to implement a solution to interpretate these messages on the receiving end.
Make sure that you use the proper CAN Timing for your devices.