Double CAN communication problem using Teensy 4.0

63 Views Asked by At

I'm working on an arduino project with a Teensy 4.0. I am trying to setup two different communications through the Can1 and Can2, using the FlexCanT4 library. For both of them i am setting the clock to 60MHz. If i setup Can1 and then Can2 setting both the clock to 60MHz, the Can1 stops working, and only Can2 remains alive.

So, i am asking, why does this happen? What the clock for the Can stands for? And what is the default value of the clock if i do not set it explicitly?

If i setup only the Can1 communication or only the Can2, there is no problem. Also, if i do NOT set the clock for both of them, no problem, all works fine.

This is the setup code:

#include <FlexCAN_T4.h>

FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_16> Can2;
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> Can1;


void setup(){



Can1.begin();
Can1.setBaudRate(125000);
Can1.setClock(CLK_60MHz);
Can1.setMaxMB(60);
Can1.enableFIFO();
Can1.enableFIFOInterrupt();
Can1.onReceive(Can1Sniff);

Can2.begin();
Can2.setBaudRate(1000000);
Can2.setClock(CLK_60MHz);
Can2.setMaxMB(60);
Can2.enableFIFO();
Can2.enableFIFOInterrupt();
Can2.onReceive(Can2Sniff);

}
0

There are 0 best solutions below