Hi tonton81 and all others in this Thread.
I am playing around with two teensy 4 boards and your FlexCAN_T4 library. I am using the MCP2562FD Transreceiver and sending Can Frames from one device to the other via CAN2.0 works fine on CAN1 and CAN2 
But somehow it does not work on CAN3 (not with the CAN20 nor with the CANFD class).
May I have to disconnect the onboard LED which is hardwired to Pin 13?
Im struggeing with that issue since a couple of days and i can't just see what im doing wrong, maybe you can give me a hint...
Cheers, Daniel
Code:
#include <FlexCAN_T4.h>
#define LEDPIN 16
FlexCAN_T4FD<CAN3, RX_SIZE_256, TX_SIZE_16> flexCan;
void printInfo(const CANFD_message_t& message, bool received = true, bool result = true)
{
Serial.println("*******************************");
Serial.println(received ? "* Frame Received" : "* Frame Send");
Serial.println(result ? "* Success" : "* Fail");
Serial.println("*");
Serial.print("* Id: "); Serial.print(message.id, HEX); Serial.println();
Serial.print("* Data: "); for(int i=0; i<message.len; i++){ Serial.print(message.buf[i], HEX); Serial.print(" "); } Serial.println();
Serial.println("*");
Serial.println("*******************************");
}
void frameReceivedHandler(const CANFD_message_t& message)
{
printInfo(message);
}
#define OPTION 1
#if OPTION == 0
int txId = 0x123, rxId = 0x321;
#endif
#if OPTION == 1
int txId = 0x321, rxId = 0x123;
#endif
void setup(void) {
Serial.begin(9600);
/************** Config LED **************/
pinMode(LEDPIN, OUTPUT);
delay(500);
/************ Initialize CAN ************/
flexCan.begin();
CANFD_timings_t config;
config.clock = CLK_24MHz;
config.baudrate = 1000000;
config.baudrateFD = 2000000;
config.propdelay = 190;
config.bus_length = 1;
config.sample = 87.5;
flexCan.setRegions(64);
flexCan.setBaudRate(config);
//flexCan.setBaudRate(500000);
}
void loop() {
static unsigned long timeout = millis();
CANFD_message_t message;
int result;
static int ctr = 0;
message.id = txId;
message.len = 8;
message.buf[0] = ctr;
message.buf[1] = ctr;
message.buf[2] = ctr;
message.buf[3] = ctr;
message.buf[4] = ctr;
message.buf[5] = ctr;
message.buf[6] = ctr;
message.buf[7] = ctr;
if(millis() - timeout >= 500)
{
timeout = millis();
result = flexCan.write(message);
printInfo(message, false, result);
flexCan.mailboxStatus();
/************ Blink LED ************/
if(result)
{
digitalWrite(LEDPIN, (ctr++)%2);
}
}
/************ Call event handlers ************/
if(flexCan.read(message))frameReceivedHandler(message);
}