FlexCAN_T4 - FlexCAN for Teensy 4

Your sketch does not transmit any CAN frame. You have not setup the mailbox correctly.

Follow the example sketch : mailbox_filtering_example_with_interrupts.ino

Code:
Can0.begin();
  Can0.setBaudRate(250000);
  Can0.setMaxMB(NUM_TX_MAILBOXES + NUM_RX_MAILBOXES);
  for (int i = 0; i<NUM_RX_MAILBOXES; i++){
    Can0.setMB((FLEXCAN_MAILBOX)i,RX,EXT);
  }
  for (int i = NUM_RX_MAILBOXES; i<(NUM_TX_MAILBOXES + NUM_RX_MAILBOXES); i++){
    Can0.setMB((FLEXCAN_MAILBOX)i,TX,EXT);
  }
  Can0.setMBFilter(REJECT_ALL);
  Can0.enableMBInterrupts();
  Can0.onReceive(MB0,canSniff);
  Can0.onReceive(MB1,canSniff);
  Can0.onReceive(MB2,canSniff);
  Can0.setMBUserFilter(MB0,0x00,0xFF);
  Can0.setMBUserFilter(MB1,0x03,0xFF);
  Can0.setMBUserFilter(MB2,0x0B,0xFF);
  Can0.mailboxStatus();

Change Can0 to your can2
 
Your sketch does not transmit any CAN frame. You have not setup the mailbox correctly.

Follow the example sketch : mailbox_filtering_example_with_interrupts.ino

Code:
Can0.begin();
  Can0.setBaudRate(250000);
  Can0.setMaxMB(NUM_TX_MAILBOXES + NUM_RX_MAILBOXES);
  for (int i = 0; i<NUM_RX_MAILBOXES; i++){
    Can0.setMB((FLEXCAN_MAILBOX)i,RX,EXT);
  }
  for (int i = NUM_RX_MAILBOXES; i<(NUM_TX_MAILBOXES + NUM_RX_MAILBOXES); i++){
    Can0.setMB((FLEXCAN_MAILBOX)i,TX,EXT);
  }
  Can0.setMBFilter(REJECT_ALL);
  Can0.enableMBInterrupts();
  Can0.onReceive(MB0,canSniff);
  Can0.onReceive(MB1,canSniff);
  Can0.onReceive(MB2,canSniff);
  Can0.setMBUserFilter(MB0,0x00,0xFF);
  Can0.setMBUserFilter(MB1,0x03,0xFF);
  Can0.setMBUserFilter(MB2,0x0B,0xFF);
  Can0.mailboxStatus();

Change Can0 to your can2
I am struggling to understand how I have setup the mailboxes incorrectly?
On can1 I have setup a single mailbox to recieve messages and it will trigger canSniff on receive.
On can2 I have setup a single mailbox to transmit messages.

You can see these two mailboxes setup in the serial output in my last message.

Even when I hookup a cansniffer box to can2 directly (all the correct 120ohm terminations of course) it still doesn't transmit from the mailbox.

The message is stuck in the mailbox and won't transmit properly, from what I've read this is because it is not getting an ACK but both the cansniffer box and can1 should be able to ACK this.
 
Back
Top