Hi all,
I'm trying to get CAN FD working on a T4.1 and having trouble getting above 2Mbps. Initially I was getting garbled data at 2Mbps, but I tried bumping config.sample from 70 to 75 as I saw in an example in this thread and now have a good connection. Now I'm trying to push to 4 or 5Mbps and not getting anything at all on the other end. In that thread someone said that at or above 5Mbps, config.clock needs to be set to CLK_60MHz, but that didn't help. In fact, I can't get anything but CLK_24MHz to work at 2Mbps.
Are these configuration options documented anywhere? I have no idea what I'm changing or what values to try.
Here's my setup code:
And my message sending:
I'm trying to get CAN FD working on a T4.1 and having trouble getting above 2Mbps. Initially I was getting garbled data at 2Mbps, but I tried bumping config.sample from 70 to 75 as I saw in an example in this thread and now have a good connection. Now I'm trying to push to 4 or 5Mbps and not getting anything at all on the other end. In that thread someone said that at or above 5Mbps, config.clock needs to be set to CLK_60MHz, but that didn't help. In fact, I can't get anything but CLK_24MHz to work at 2Mbps.
Are these configuration options documented anywhere? I have no idea what I'm changing or what values to try.
Here's my setup code:
Code:
Can3FD.begin();
CANFD_timings_t config;
config.clock = CLK_40MHz;
config.baudrate = 500000;
config.baudrateFD = 4000000;
config.propdelay = 190;
config.bus_length = 1;
config.sample = 75; // 75 worked at 2mbps
Can3FD.setBaudRate(config);
Can3FD.setMaxMB(2);
Can3FD.setMB(MB0,TX,STD);
Can3FD.setMB(MB1,RX,STD);
Can3FD.setMBFilter(REJECT_ALL);
Can3FD.enableMBInterrupts();
Can3FD.setMBFilter(MB0, messageID);
Can3FD.setMBFilter(MB1, messageID+1);
Can3FD.onReceive(MB1, Can3Int);
Can3FD.mailboxStatus();
And my message sending:
Code:
void loop() {
for (int i = 1; i < 255; i++) {
CAN_message_t msg;
msg.id = messageID+1; // Arbitrary CAN ID
msg.len = 8; // Standard length
for (int j = 1; j < 8; j++) {
msg.buf[j] = 0xAA; // Fill the message with sample data
}
msg.buf[0] = i;
// Send the message
#ifdef TX_CAN1
Can1.write(msg);
#endif
#ifdef TX_CAN2
Can2.write(msg);
#endif
#ifdef TX_CAN3
CANFD_message_t FDmsg;
FDmsg.id = messageID+2;
FDmsg.len = 8;
for (int k = 1; k < 8; k++) {
FDmsg.buf[k] = 0xAA; // Fill the message with sample data
}
FDmsg.buf[0] = i;
Can3FD.write(FDmsg);
#endif
delay(100);
}
delay(5000);
}