Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: FlexCAN_T4 Send Extended CAN ID Message

Hybrid View

  1. #1
    Junior Member
    Join Date
    Sep 2019
    Location
    Chicago, IL
    Posts
    2

    FlexCAN_T4 Send Extended CAN ID Message

    Hi All-
    I am working on a project where I am trying to send and received CAN messages with extended ID's. I am using a Teensy 4.0 with the FlexCAN_T4 library. The problem I am having is getting the library to switch from standard ID's to extended. Also the message data is incorrect along with the DLC. I am looking to get the CAN ID of 0x18FEDF00, but the Teensy is sending 0x63F instead. Any suggestions on making the library switch? I hope I'm just missing something simple. Take a look at the screenshot to see the traffic on CAN as seen from Vector CANalyzer.

    Code:
    #include <FlexCAN_T4.h>
    
    FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> can1;
    CAN_message_t msg;
    
    void setup(void) {
      can1.begin();
      can1.setBaudRate(250000);
    }
    
    void loop() 
    {
      msg.flags.extended = 1;
      msg.id = 0x18FEDF00;
      msg.len = 8;
      msg.buf[0] = 55;
      msg.buf[1] = 0;
      msg.buf[2] = 0;
      msg.buf[3] = 0;
      msg.buf[4] = 0;
      msg.buf[5] = 0;
      msg.buf[6] = 0;
      msg.buf[7] = 0;
      can1.write(msg);
      delay(500);
    }
    Click image for larger version. 

Name:	can_extended.jpg 
Views:	17 
Size:	39.7 KB 
ID:	23411

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,601
    are you on the latest github version? if not try that out

  3. #3
    Junior Member
    Join Date
    Sep 2019
    Location
    Chicago, IL
    Posts
    2
    Brilliant! I really appreciate it. That was a simple fix. It works perfectly now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •