IFCT - Improved Flexcan Teensy Library

Status
Not open for further replies.

tonton81

Well-known member
Hi, I decided to work on a different twist of the current libraries and forks of collin80, teachop, and pawelsky, and rework most of the existing code from scratch into a new library that has, currently, these features:

Before you ask, I'm currently doing it on a 3.6 and only for FLEXCAN0 until it matures, only then I would add CAN1 support and 3.2 registers
Debug will be enabled for initial version for any testers interested on testing, and suggesting other ideas to implement.
Secondly, I havn't added masking/filter support yet as I work on the structure, but by default I enable both in FIFO mode and mailbox mode all frames accepted, again, until it matures, then they will be added

1) FIFO (enabled or disabled dynamically), with interrupt capability (enableFIFOInterrupt/disableFIFOInterrupt)

2) Dynamic mailbox setup support: setMB(MB9, TX) (transmit mailbox), or setMB(MB9,RX,IDE) (setup an extended ID reception box)

3) Individual mailbox interrupt enabling (*.enableMBInterrupt(MB5)/*.disableMBInterrupt(MB5);

4) there is a pollFIFO() function that can give a user direct access to the FIFO frames, and at the same time, disable MB/FIFO interrupts, for as long as you poll frames.
This allows users to access frames directly rather than handling in their callbacks. The interrupts are restored when pollFIFO is called with a 0 overload. (myCAN.pollFIFO(msg, 1))(disable interrupt)(CAN.pollFIFO(msg, 0))(enable interrupt)

5) Callbacks, you have a global callback, and, if necessary, I've added individual mailbox callbacks as well!
Code:
    void onReceive(const IFCTMBNUM &mb_num, _MB_ptr handler); /* individual mailbox callback function */
    void onReceive(_MB_ptr handler); /* global callback function */
This allows you to handle specific mailboxes with interrupts. everything else goes in global callback, including the individual which goes to both.

6) The constructor is pretty basic with only 2 initializers:
Code:
IFCT myCAN = IFCT(); // initialized default, 1Mbps on Can0
// or
IFCT myCAN = IFCT(1000000,FLEXCAN0_BASE); // initialize with 1Mbps on Can0 (register base address);
// or just do baud alone
IFCT myCAN = IFCT(1000000);

7) The .write(...) function has been redesigned. There is an attempt to scan for transmit buffers that are available, if none are available, it checks 2 more times before returning to user (0) that a transmit wasnt possible.
This has FIFO check routine for adaptation.

8) The .read(...) function has been redesigned. FIFO check routine optimizes mailbox reading. read(...) is not meant to read the FIFO buffer, use pollFIFO for that. However, the new way the read() function is done is it goes incrementally up each mailbox each read, so every time you request a read(), it never hits the same mailbox twice, ensuring even data requests. Should it encouter any TX buffers, it will skip them till the next available read buffer. Should nothing be readable (no data) within 2 cycles, the function is exited with a return of 0 as it should.

9) By default, when you enable FIFO, the library will setup FIFO for you with the 8 remaining mailboxes as transmit buffers. When you disable FIFO, the library will setup the first 4 mailboxes for Standard IDs and the next 4 for Extended IDs, remaining 8 for TX buffers. Should you want to change specific ones later on, just use setMB.

simple sending in the main loop :

Code:
  msg.flags.extended = random(0,2);
  msg.flags.remote = 0;
  msg.len = 8;
  msg.id = random(0x69, 0x178);
  msg.buf[0] = random(0, 255);
  msg.buf[1] = random(0, 255);
  msg.buf[2] = random(0, 255);
  msg.buf[3] = random(0, 255);
  msg.buf[4] = random(0, 255);
  msg.buf[5] = random(0, 255);
  msg.buf[6] = random(0, 255);
  msg.buf[7] = random(0, 255);
  CAN.write(msg);

and reading mailboxes:
Code:
    if (CAN.read(msg)) {
      Serial.print("  LEN: "); Serial.print(msg.len);
      Serial.print(" EXT: "); Serial.print(msg.flags.extended);
      Serial.print(" REMOTE: "); Serial.print(msg.rtr);
      Serial.print(" TS: "); Serial.print(msg.timestamp);
      Serial.print(" ID: "); Serial.print(msg.id);
      Serial.print(" Buffer: ");
      for ( uint8_t i = 0; i < msg.len; i++ ) {
        Serial.print(msg.buf[i], HEX); Serial.print(" ");
      } Serial.println();
    }


Here is the All / Individual callbacks tests:

Code:
  CAN.enableFIFO(0);
  CAN.enableFIFOInterrupt(0);
  CAN.onReceive(myMSG);
  CAN.onReceive(MB1, MB1cb);

Output:

Code:
MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 61237 ID: 256 Buffer: BE 14 0 64 80 40 20 10 
MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 61360 ID: 256 Buffer: BF 14 0 64 80 40 20 10 
*** MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 61360 ID: 256 Buffer: BF 14 0 64 80 40 20 10 
MB 4  LEN: 8 EXT: 1 REMOTE: 0 TS: 44858 ID: 291 Buffer: A 14 0 64 80 40 20 10 
MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 61481 ID: 256 Buffer: C0 14 0 64 80 40 20 10 
MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 61603 ID: 256 Buffer: C1 14 0 64 80 40 20 10 
*** MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 61603 ID: 256 Buffer: C1 14 0 64 80 40 20 10 
MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 12683 ID: 256 Buffer: C3 14 0 64 80 40 20 10 
MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 12804 ID: 256 Buffer: C4 14 0 64 80 40 20 10 
*** MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 12804 ID: 256 Buffer: C4 14 0 64 80 40 20 10 
MB 4  LEN: 8 EXT: 1 REMOTE: 0 TS: 61845 ID: 291 Buffer: A 14 0 64 80 40 20 10 
MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 12927 ID: 256 Buffer: C5 14 0 64 80 40 20 10 
MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 13049 ID: 256 Buffer: C6 14 0 64 80 40 20 10 
*** MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 13049 ID: 256 Buffer: C6 14 0 64 80 40 20 10 
MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 29664 ID: 256 Buffer: C8 14 0 64 80 40 20 10 
MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 29787 ID: 256 Buffer: C9 14 0 64 80 40 20 10 
*** MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 29787 ID: 256 Buffer: C9 14 0 64 80 40 20 10

*** MB1 dipicts code printed from MB1 callback
without the *** dipicts normal catchall callback
An individual callback frame will be in both.

And here is the receiving MCU receiving the loop sends:
Code:
LEN: 8 EXT: 1 REMOTE: 0 TS: 11536 ID: 354 Buffer: 11 82 57 4F 4A 4C 8D 21 
LEN: 8 EXT: 1 REMOTE: 0 TS: 31544 ID: 268 Buffer: 82 46 4F F1 DA 9C 7D A6 
LEN: 8 EXT: 0 REMOTE: 0 TS: 51550 ID: 173 Buffer: B0 52 F4 7D 2 5F E5 C6 
LEN: 8 EXT: 0 REMOTE: 0 TS: 6021 ID: 288 Buffer: 4C F4 AB 2F B8 88 CE 21 
LEN: 8 EXT: 1 REMOTE: 0 TS: 26028 ID: 351 Buffer: 18 24 39 C4 E5 51 39 3E 
LEN: 8 EXT: 0 REMOTE: 0 TS: 46035 ID: 361 Buffer: B1 B1 F2 C1 BA FE 56 44 
LEN: 8 EXT: 0 REMOTE: 0 TS: 506 ID: 319 Buffer: DF 6 54 7 E2 DA D3 59 
LEN: 8 EXT: 1 REMOTE: 0 TS: 20512 ID: 140 Buffer: 61 41 A 44 59 B6 DA 72 
LEN: 8 EXT: 0 REMOTE: 0 TS: 40519 ID: 353 Buffer: 23 D0 92 2A EE F7 71 2E 
LEN: 8 EXT: 1 REMOTE: 0 TS: 60527 ID: 153 Buffer: DB 1A BC 57 F3 A7 9F 2C 
LEN: 8 EXT: 1 REMOTE: 0 TS: 14998 ID: 226 Buffer: 61 B5 3E D8 CB 40 14 E0 
LEN: 8 EXT: 1 REMOTE: 0 TS: 35005 ID: 221 Buffer: 61 FB 14 B0 1C 85 D 19 
LEN: 8 EXT: 0 REMOTE: 0 TS: 55012 ID: 232 Buffer: 47 F8 14 23 C7 32 D1 5B 
LEN: 8 EXT: 1 REMOTE: 0 TS: 9483 ID: 261 Buffer: AB A2 93 E8 F3 9 59 73 
LEN: 8 EXT: 1 REMOTE: 0 TS: 29490 ID: 198 Buffer: 35 70 C0 84 27 A5 50 DC 
LEN: 8 EXT: 1 REMOTE: 0 TS: 49497 ID: 112 Buffer: 69 D5 36 56 95 F0 B5 54 
LEN: 8 EXT: 0 REMOTE: 0 TS: 3969 ID: 171 Buffer: DE A5 98 48 14 C5 34 F7 
LEN: 8 EXT: 0 REMOTE: 0 TS: 23976 ID: 208 Buffer: 13 50 E7 34 6A 41 D3 81 
LEN: 8 EXT: 0 REMOTE: 0 TS: 43983 ID: 195 Buffer: 22 4 FE 31 71 12 F1 1F

One of a good ideas is that in FIFO mode, we can setMB a mailbox with a reception interrupt box, keep FIFO interrupts off, and when you receive a match in your mailbox you could trigger the poll method to collect all your frames in ordered fashion. Mailboxes have interrupt priority over FIFO, I've tested an extended frame reception on MB9 with FIFO enabled and was able to do what I want when the callback fired :)
pollFIFO would be very useful for external libraries, where you can pass the frames directly to another function without touching your callback

By the way, I'm testing also with Fusion's dual can transceiver breakout from Tindie

2016-11-12T15 59 10.613Z-candual.jpg



Current Compilation:

Blank Sketch:
Code:
Sketch uses 9200 bytes (0%) of program storage space. Maximum is 1048576 bytes.
Global variables use 4212 bytes (1%) of dynamic memory, leaving 257932 bytes for local variables. Maximum is 262144 bytes.

IFCT Library Demo Sketch:
Code:
Sketch uses 20348 bytes (1%) of program storage space. Maximum is 1048576 bytes.
Global variables use 5416 bytes (2%) of dynamic memory, leaving 256728 bytes for local variables. Maximum is 262144 bytes.

Flexcan_Library Demo compilation:
Code:
Sketch uses 16924 bytes (1%) of program storage space. Maximum is 1048576 bytes.
Global variables use 7624 bytes (2%) of dynamic memory, leaving 254520 bytes for local variables. Maximum is 262144 bytes.

looks like a 1200 byte memory difference :) betweeen blank sketch
The fork demo is 2K difference between mine as well


Here's a video of it in action:
https://www.youtube.com/watch?v=9H0HKlfSoRY


I should have it up on github sometime today
 
Last edited:
Morning Tony. Ok just loaded up a T3.5 and a T3.6 with the test sketch. The only difference is that I am using Waveshare SN65HVD230 CAN Board. I do have the Fusion boards as well - thank you but wanted to give it a shot with different transceivers just in case :)

It is working like a charm no issues, just as advertise. Now for some testing with some sensors in the loop which will come later in the day I hope :). Will keep you posted as the effort progresses.
 
I've updated the library to support 3.2,3.5, and 3.6 with alternate pins

Updates:
1) Can0 and Can1 are initialized (for Teensy 3.6, otherwise Can0 can be used on teensy 3.5 and 3.2 devices)
2) Alternate pins, 3.6 don't have any but, new function is as follows:
Can0.setRX(ALT); // sets alternate RX pin on pinout card for T3.5
Can0.setTX(ALT); // sets alternate TX pin (29) on pinout card for T3.5
To set default pins, just call DEF or leave blank: Can0.setRX(); && Can0.setTX();
By default, library uses default pins.
3) Library memory usage only grew 20 bytes difference from yesturday's compile, for dual can and multiple teensy support (3.6)
Yesturday:
Code:
Sketch uses 20348 bytes (1%) of program storage space. Maximum is 1048576 bytes.
Global variables use 5416 bytes (2%) of dynamic memory, leaving 256728 bytes for local variables. Maximum is 262144 bytes.

Today: (3.6)
Code:
Sketch uses 19292 bytes (1%) of program storage space. Maximum is 1048576 bytes.
Global variables use 5436 bytes (2%) of dynamic memory, leaving 256708 bytes for local variables. Maximum is 262144 bytes.

Teensy 3.5:
Code:
Sketch uses 18992 bytes (3%) of program storage space. Maximum is 524288 bytes.
Global variables use 5380 bytes (2%) of dynamic memory, leaving 256756 bytes for local variables. Maximum is 262136 bytes.

Teensy 3.2:
Code:
Sketch uses 17832 bytes (6%) of program storage space. Maximum is 262144 bytes.
Global variables use 5044 bytes (7%) of dynamic memory, leaving 60492 bytes for local variables. Maximum is 65536 bytes.

4) No more constructors needed. you can use the library immediately as soon as you #include <IFCT.h>. Can0 and Can1 will be available as needed.
 
ok So here is a question showing my stupidity.

The message length is limited to 8 bytes. For a T3.5/T3.6 I could send two floats in 4 byte chucks. 0-3 for first float and 4-7 for second float. So I guess the next question is what is the easiest way to do this for encoding and decoding a float.

I think I could use something like this for decoding each 4 bytes:
Code:
float f;
uchar b[] = {b3, b2, b1, b0};
memcpy(&f, &b, sizeof(f));
return f;

For some reason I am drawing a blank on the other way around.


Why you might ask am I doing this. As a test of I attached a BME280 pressure sensor and want to send the temp and pressure. Any suggestions - even just point me in the right direction.

Thanks
Mike
 
i found this off stack overflow site

Code:
char data[sizeof(float)];
float f = 0.6f;

memcpy(data, &f, sizeof f);    // send data

float g;
memcpy(&g, data, sizeof g);    // receive data
 
That's easier than what I just found. This is from an mbed site but should work for arm as well. Here it is for reference:
Code:
7

#include "mbed.h"
 
union Float {
    float    m_float;
    uint8_t  m_bytes[sizeof(float)];
};
 
float        pi;
uint8_t      bytes[sizeof(float)];
Float        myFloat;
 
int main()
{
    pi = 3.141565f;
    
    printf("\r\n*******************************************\r\n");
    printf("*******************************************\r\n\r\n");
    printf("pi = %.6f\r\n", pi);
    printf("bytes = [ %d, %d, %d, %d]\r\n", bytes[0], bytes[1], bytes[2], bytes[3]);
  
    printf("\r\n***** Conversion by using type casting *****\r\n\r\n");
    
   *(float*)(bytes) = pi;  // convert float to bytes
    printf("bytes = [ 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x ]\r\n", bytes[0], bytes[1], bytes[2], bytes[3]);
    
    // send bytes over data channel ..
    
    // receive bytes ..
        
    pi = *(float*)(bytes);  // convert bytes back to float
    printf("pi = %.6f\r\n", pi); 
 
    printf("\r\n********* Conversion by using union *********\r\n\r\n");
       
    myFloat.m_float = pi;   // assign a float to union
    printf("myFloat.m_Float = %.6f\r\n", myFloat.m_float);
    printf("myFloat.m_Bytes = [ 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x ]\r\n", myFloat.m_bytes[0], myFloat.m_bytes[1], myFloat.m_bytes[2], myFloat.m_bytes[3]);  // get the bytes   
    
    // send bytes over the data channel ..
    
    // receive bytes and assign them to the union bytes: myFloat.m_bytes[0] = received_bytes[0] ..        
   
    pi = myFloat.m_float;   // get the float back from the union
    printf("pi = %.6f\r\n", pi);    
}

UPDATE: Ok Tony. That code you gave me works no problem for sending and receiving. Have some more work to do to send the other 4 bytes and then convert the catch all sketches into proper sender and receiver. I am using the T3.5 as the sender and the T3.6 as the receiver. :)

Then after that going to try a GPS :) I know getting ambitious. Think there will more code for the BME and GPS combined than the CAN stuff. Maybe :)
 
Last edited:
Just tested it:
Code:
void setup() {
  Serial.begin(115200);
  delay(1000);
  pinMode(2, OUTPUT); digitalWrite(2, 0);


  char data[sizeof(float)];
  Serial.print("Data buffer size: "); Serial.println(sizeof(data));

  float f = 0.6f;

  memcpy(data, &f, sizeof f);    // send data

  /* verify the bytes */
  Serial.print("Data bytes: ");
  for ( uint8_t i = 0; i < sizeof(data); i++ ) {
    Serial.print(data[i], DEC); Serial.print(" ");
  } Serial.println();

  float g;
  memcpy(&g, data, sizeof g);    // receive data

  Serial.println(g, DEC);

  while (1);

output:
Code:
Data buffer size: 4
Data bytes: 154 153 25 63 
0.6000000238

So, all thats needed is to send the 4 char bytes data[0] -> data[3] to CAN_message_t struct msg.buf[0] -> msg.buf[3], then use Can0.write(msg) to send it out :)
 
Morning Tony. Thought I would publish what I had so far for the BME280 test:

A. For the slave, i.e, sender, sending pressure and temperature:
Code:
#include <IFCT.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

IFCT CAN = IFCT();

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme; // I2C

void setup() {
  Serial.begin(115200);
  delay(5000);
  
    bool status;
    // default settings
    // (you can also pass in a Wire library object like &Wire2)
    status = bme.begin();  
    if (!status) {
        Serial.println("Could not find a valid BME280 sensor, check wiring!");
        while (1);
    }
    
    Serial.println("-- Default Test --");

    Serial.println();

}

void loop() {
  CAN_message_t msg; // setup a temporary storage buffer

  delay(20);

  msg.flags.extended = 0;  //1 = extended frame 
  msg.flags.remote = 0;
  msg.len = 8;
  msg.id = 0x69;

  float f = bme.readPressure() / 100.0F;
  Serial.print(f, 2);
  char data[sizeof(float)];
  memcpy(data, &f, sizeof f);    // send data
  
  f = bme.readTemperature();
  Serial.print(", "); Serial.println(f, 2);
  char data1[sizeof(float)];
  memcpy(data1, &f, sizeof f);    // send data
  
  for(uint8_t i = 0; i<4; i++){
    msg.buf[i] = data[i];
    msg.buf[i+4] = data1[i];
  }
  
  CAN.setMB(MB9, TX);  //Add ,IDE for extended frames.
  CAN.write(msg);
  
  static uint32_t _timer = millis();
  if ( millis() - _timer > 4000 ) {
    pinMode(13, OUTPUT); digitalWrite(13, !digitalRead(13));
    Serial.print("*HEARTBEAT* "); Serial.println(millis());
    _timer = millis();
  }
}

B. For the Master, I am using the following. It is basically the catch all with some modifications:
Code:
#include <IFCT.h>

IFCT CAN = IFCT();

void setup() {
  Serial.begin(115200);
  delay(1000);
  pinMode(2, OUTPUT); digitalWrite(2, 0);

  CAN.enableFIFO(1); // turn on fifo
  CAN.enableFIFOInterrupt(0); //  <---- interrupt off, we use pollFIFO // FIFO -------------->>>>>>>>
  //CAN.onReceive(myMSG);
  CAN.onReceive(MB9, MB9cb);
}
// the "slave" transmitter is broadcasting 5 STD IDs and 1 EXT ID every second ------------------>>>>

void loop() {
  CAN_message_t msg; // setup a temporary storage buffer

  static uint32_t _timer3 = millis();
  if ( millis() - _timer3 > 10 ) {
    while ( FLEXCAN0_IFLAG1 & FLEXCAN_IMASK1_BUF5M && FLEXCAN0_MCR & FLEXCAN_MCR_FEN ) {
      CAN.pollFIFO(msg, 0); // <--- here, 1 FIFO interrupts will be disabled (if enabled) and restored when overload is 0.
      Serial.print("*  LEN: "); Serial.print(msg.len);
      Serial.print(" EXT: "); Serial.print(msg.flags.extended);
      Serial.print(" REMOTE: "); Serial.print(msg.rtr);
      Serial.print(" TS: "); Serial.print(msg.timestamp);
      Serial.print(" ID: "); Serial.print(msg.id);
      Serial.print(" Buffer: ");
      for ( uint8_t i = 0; i < msg.len; i++ ) {
        Serial.print(msg.buf[i], HEX); Serial.print(" ");
      } Serial.println();
      
      char data[sizeof(float)];
      char data1[sizeof(float)];
      for(uint8_t i=0; i<4; i++){
        data[i] = msg.buf[i];
        data1[i] = msg.buf[i+4];
      }
      float pressure;
      memcpy(&pressure, data, sizeof pressure);    // receive data
      Serial.print(pressure);
    
      float temp;
      memcpy(&temp, data1, sizeof temp);    // receive data
      Serial.print(", "); Serial.println(temp);
    }
    _timer3 = millis();
  }

  //  Serial.println(FLEXCAN0_IMASK1);


  delay(20);


  msg.flags.extended = random(0, 2);
  msg.flags.remote = 0;
  msg.len = 8;
  msg.id = random(0x69, 0x178);
  msg.buf[0] = random(0, 255);
  msg.buf[1] = random(0, 255);
  msg.buf[2] = random(0, 255);
  msg.buf[3] = random(0, 255);
  msg.buf[4] = random(0, 255);
  msg.buf[5] = random(0, 255);
  msg.buf[6] = random(0, 255);
  msg.buf[7] = random(0, 255);
  CAN.write(msg);

  // here we sending can frames randomly <---------

  static uint32_t _timer = millis();
  if ( millis() - _timer > 4000 ) {
    pinMode(13, OUTPUT); digitalWrite(13, !digitalRead(13));
    Serial.print("*HEARTBEAT* "); Serial.println(millis());
    //Need this otherwise defaults to pollFIFO
    static bool moo = 1;
    if ( moo ) {
            CAN.setMB(MB9, RX);  //add ,IDE for extended frames
            CAN.enableMBInterrupt(MB9); // <--- enable per mailbox interrupt
    }
    _timer = millis();
  }
}



void MB9cb(const CAN_message_t &msg) { // <--- mailbox 1 callback
  Serial.print("*** MB "); Serial.print(msg.mb);
  Serial.print("  LEN: "); Serial.print(msg.len);
  Serial.print(" EXT: "); Serial.print(msg.flags.extended);
  Serial.print(" REMOTE: "); Serial.print(msg.rtr);
  Serial.print(" TS: "); Serial.print(msg.timestamp);
  Serial.print(" ID: "); Serial.print(msg.id);
  Serial.print(" Buffer: ");
  for ( uint8_t i = 0; i < msg.len; i++ ) {
    Serial.print(msg.buf[i], HEX); Serial.print(" ");
  } Serial.println();

      char data[sizeof(float)];
      char data1[sizeof(float)];
      for(uint8_t i=0; i<4; i++){
        data[i] = msg.buf[i];
        data1[i] = msg.buf[i+4];
      }
      float pressure;
      memcpy(&pressure, data, sizeof pressure);    // receive data
      Serial.print(pressure);
    
      float temp;
      memcpy(&temp, data1, sizeof temp);    // receive data
      Serial.print(", "); Serial.println(temp);
}




void myMSG(const CAN_message_t &msg) { // global callback
  Serial.print("**MB "); Serial.print(msg.mb);
  Serial.print("  LEN: "); Serial.print(msg.len);
  Serial.print(" EXT: "); Serial.print(msg.flags.extended);
  Serial.print(" REMOTE: "); Serial.print(msg.rtr);
  Serial.print(" TS: "); Serial.print(msg.timestamp);
  Serial.print(" ID: "); Serial.print(msg.id);
  Serial.print(" Buffer: ");
  for ( uint8_t i = 0; i < msg.len; i++ ) {
    Serial.print(msg.buf[i], HEX); Serial.print(" ");
  } Serial.println();

      char data[sizeof(float)];
      char data1[sizeof(float)];
      for(uint8_t i=0; i<4; i++){
        data[i] = msg.buf[i];
        data1[i] = msg.buf[i+4];
      }
      float pressure;
      memcpy(&pressure, data, sizeof pressure);    // receive data
      Serial.print(pressure);
    
      float temp;
      memcpy(&temp, data1, sizeof temp);    // receive data
      Serial.print(", "); Serial.println(temp);
}


As for output:

Code:
The sender is basically using MB9 to send the pressure and temp data: 

1008.88, 22.79
1008.88, 22.79
1008.90, 22.79
1008.90, 22.79

On the master side you can see that the data is coming across as MB9 interrupt:
*** MB 9  LEN: 8 EXT: 0 REMOTE: 0 TS: 59817 ID: 105 Buffer: F6 35 7C 44 EC 51 B6 41 
1008.84, 22.79
*** MB 9  LEN: 8 EXT: 0 REMOTE: 0 TS: 16098 ID: 105 Buffer: 16 3A 7C 44 EC 51 B6 41 
1008.91, 22.79
*** MB 9  LEN: 8 EXT: 0 REMOTE: 0 TS: 37915 ID: 105 Buffer: 16 3A 7C 44 EC 51 B6 41 
1008.91, 22.79
*** MB 9  LEN: 8 EXT: 0 REMOTE: 0 TS: 59732 ID: 105 Buffer: 16 3A 7C 44 EC 51 B6 41 
1008.91, 22.79

NOTE: This is using your originally posted library. Wanted to get this working before make any updates.
 
Update release for this morning:
1) Added max mailbox support for non-FIFO mode, allows you to set, instead of the default 16 hardware mailboxes offered, to a lower limit, which, in some cases, depending on application, can prevent overruns by scanning less mailboxes during the arbitration process. You can use the new command setMaxMB(x), where "x" can be any value between 1 and 16, to specify how many mailboxes you want created in non-FIFO mode. Do not use this (or set it back to 16 before re-enabling FIFO) for FIFO as the hardware doesn't seem to be capable of limiting the mailboxes in FIFO mode 'properly'.

Teensy 3.5 and 3.6 have been tested so far, enjoy
 
Morning Tony. I now have the BME280 with a NEO-M8N spewing data over the can bus. Both sensors are attached to the T3.5. Now what I am trying to do is send Press/Temp data to MB9 using 1 ID. For the GPS I am currently sending LAT/LON/Speed/Heading/FIX/#Sat to using 3 IDs on MB8. Both are using std ids and interrupt based. Its not really working the way I expected, but of course I have no clue what I am doing with CAN so any help would be appreciated.

First here is the loop code that I modified from my previous post (the set just added the GPS setup info so not posting that because it is working):
Code:
void loop() {
  CAN_message_t msg; // setup a temporary storage buffer

  delay(20);

  msg.flags.extended = 0;  //1 = extended frame 
  msg.flags.remote = 0;
  msg.len = 8;
  msg.id = 0x69;
  float f = bme.readPressure() / 100.0F;
  Serial.print(f, 2);
  char data[sizeof(float)];
  memcpy(data, &f, sizeof f);    // send data
  
  f = bme.readTemperature();
  Serial.print(", "); Serial.println(f, 2);
  char data1[sizeof(float)];
  memcpy(data1, &f, sizeof f);    // send data
  
  for(uint8_t i = 0; i<4; i++){
    msg.buf[i] = data[i];
    msg.buf[i+4] = data1[i];
  }
  
  Can0.setMB(MB9, TX);  //Add ,IDE for extended frames.
  Can0.write(msg);

      if(GPS.read(&uBloxData)) {
        rtk.iTOW = uBloxData.iTOW;
        rtk.fixType = uBloxData.fixType;
        rtk.numSV = uBloxData.numSV;
        rtk.pDOP = uBloxData.pDOP * 100;
        rtk.lat1 = uBloxData.lat;
        rtk.lon1 = uBloxData.lon;
        rtk.heading = uBloxData.heading;
        rtk.gSpeed = uBloxData.gSpeed;
        rtk.hMSL = uBloxData.hMSL;
      }


  Serial.println(rtk.lat1, 6);
  msg.flags.extended = 0;  //1 = extended frame 
  msg.flags.remote = 0;
  msg.len = 8;
  msg.id = 0x01;
  f = (float) rtk.lat1;
  memcpy(data, &f, sizeof f);
  f = (float) rtk.lon1;
  memcpy(data1, &f, sizeof f);
  for(uint8_t i = 0; i<4; i++){
    msg.buf[i] = data[i];
    msg.buf[i+4] = data1[i];
  }
  Can0.setMB(MB8, TX);  //Add ,IDE for extended frames.
  Can0.write(msg);

  msg.id = 0x02;
  f = (float) rtk.fixType;
  memcpy(data, &f, sizeof f);
  f = (float) rtk.numSV;
  memcpy(data1, &f, sizeof f);
  for(uint8_t i = 0; i<4; i++){
    msg.buf[i] = data[i];
    msg.buf[i+4] = data1[i];
  }
  //Can0.setMB(MB8, TX);  
  Can0.write(msg);

  msg.id = 0x03;
  f = rtk.heading;
  memcpy(data, &f, sizeof f);
  f = (float) rtk.gSpeed;
  memcpy(data1, &f, sizeof f);
  for(uint8_t i = 0; i<4; i++){
    msg.buf[i] = data[i];
    msg.buf[i+4] = data1[i];
  }
  //Can0.setMB(MB8, TX);
  Can0.write(msg);

  static uint32_t _timer = millis();
  if ( millis() - _timer > 4000 ) {
    pinMode(13, OUTPUT); digitalWrite(13, !digitalRead(13));
    Serial.print("*HEARTBEAT* "); Serial.println(millis());
    _timer = millis();
  }
}

What is happening is that IDs 0x02 and 0x3 (GPS Data) are alternating between 9 and 8. 105 (280) is staying on MB9. But I am never seeing ID 0x01 which is the Lat/Lon. If I do only one ID per mailbox it works fine. Also I noted that I have to include the following lines in the master:
Code:
  CAN.enableFIFO(1); // turn on fifo
  CAN.enableFIFOInterrupt(0); //  <---- interrupt off, we use pollFIFO // FIFO -------------->>>>>>>>
or nothing comes across.

Here is a sample output illustrating the point:

Code:
***8 MB 8  LEN: 8 EXT: 0 REMOTE: 0 TS: 17912 ID: 105 Buffer: BB 4E 7D 44 A D7 C1 41 
1013.23, 24.23
***9 MB 9  LEN: 8 EXT: 0 REMOTE: 0 TS: 18030 ID: 1 Buffer: 52 19 23 42 1E A1 93 C2 
40.77, -73.81
***8 MB 8  LEN: 8 EXT: 0 REMOTE: 0 TS: 18143 ID: 2 Buffer: 0 0 40 40 0 0 70 41 
3.00, 15.00
***9 MB 9  LEN: 8 EXT: 0 REMOTE: 0 TS: 18267 ID: 3 Buffer: E E 73 43 F4 FD 54 3C 
243.05, 0.01
***8 MB 8  LEN: 8 EXT: 0 REMOTE: 0 TS: 39779 ID: 105 Buffer: BB 4E 7D 44 A D7 C1 41 
1013.23, 24.23
***9 MB 9  LEN: 8 EXT: 0 REMOTE: 0 TS: 39897 ID: 1 Buffer: 52 19 23 42 1E A1 93 C2 
40.77, -73.81
***8 MB 8  LEN: 8 EXT: 0 REMOTE: 0 TS: 40010 ID: 2 Buffer: 0 0 40 40 0 0 70 41 
3.00, 15.00
***9 MB 9  LEN: 8 EXT: 0 REMOTE: 0 TS: 40134 ID: 3 Buffer: E E 73 43 F4 FD 54 3C 
243.05, 0.01
***8 MB 8  LEN: 8 EXT: 0 REMOTE: 0 TS: 61646 ID: 105 Buffer: BB 4E 7D 44 A D7 C1 41 
1013.23, 24.23
***9 MB 9  LEN: 8 EXT: 0 REMOTE: 0 TS: 61764 ID: 1 Buffer: 52 19 23 42 1E A1 93 C2 
40.77, -73.81
***8 MB 8  LEN: 8 EXT: 0 REMOTE: 0 TS: 61877 ID: 2 Buffer: 0 0 40 40 0 0 70 41 
3.00, 15.00
***9 MB 9  LEN: 8 EXT: 0 REMOTE: 0 TS: 62001 ID: 3 Buffer: E E 73 43 F4 FD 54 3C 
243.05, 0.01


Thanks
Mike
 
Can0.setMB(MB8, TX); //Add ,IDE for extended frames.
Can0.setMB(MB9, TX); //Add ,IDE for extended frames.

you set the mailboxes as transmit, so MB8 & 9 are transmit interrupts

by default when fifo enabled MB8->15 are TX, Can0.mailboxStatus(); can be used to verify fifo/mailbox stats
mailboxes have priority over FIFO currently, so enabling RX boxes in FIFO mode which are default to accept all:
Can0.setMB(MB8, RX); //Add ,IDE for extended frames.
Can0.setMB(MB9, RX); //Add ,IDE for extended frames.
they should be filled before the FIFO does accepting all standard id frames

Filters will need to be implemented in later revision of library

FIFO can be disabled, where first 4 mailboxes accept standard ids, and next 4 extended, remaining 8 are for TX
mailboxes are defaulted to accept all frames, so if your just accepting standard ids you can setMBInterrupt MB0->3 to enable the data to come in

Looking back I think the code above is for your slave? than thats fine as your only transmitting there.
For the master, ext ids are taken from MB4-7, however, due to no filters setup and/or flexcan controller issue, the Extended messages tend to go over the mailboxes once and wait for you to clear the highest mailbox priority, which is MB4. Try changing your interrupt on master to Interrupt 4 when playing with extended ID's, #4 should be firing fine
 
Last edited:
Hey Tony. Redid it so not using MB8 or 9, but using 1 and 2 instead. Also turned FIFO off in the master. Additionally only sending 1 ID to each MB. Seems to break when I do more than 1. So the slave loop now looks like this:
Code:
void loop() {
  CAN_message_t msg; // setup a temporary storage buffer

  delay(20);

  msg.flags.extended = 0;  //1 = extended frame 
  msg.flags.remote = 0;
  msg.len = 8;
  msg.id = 0x69;
  float f = bme.readPressure() / 100.0F;
  Serial.print(f, 2);
  char data[sizeof(float)];
  memcpy(data, &f, sizeof f);    // send data
  
  f = bme.readTemperature();
  Serial.print(", "); Serial.println(f, 2);
  char data1[sizeof(float)];
  memcpy(data1, &f, sizeof f);    // send data
  
  for(uint8_t i = 0; i<4; i++){
    msg.buf[i] = data[i];
    msg.buf[i+4] = data1[i];
  }
  
  Can0.setMB(MB1, TX);  //Add ,IDE for extended frames.
  Can0.write(msg);

      if(GPS.read(&uBloxData)) {
        rtk.iTOW = uBloxData.iTOW;
        rtk.fixType = uBloxData.fixType;
        rtk.numSV = uBloxData.numSV;
        rtk.pDOP = uBloxData.pDOP * 100;
        rtk.lat1 = uBloxData.lat;
        rtk.lon1 = uBloxData.lon;
        rtk.heading = uBloxData.heading;
        rtk.gSpeed = uBloxData.gSpeed;
        rtk.hMSL = uBloxData.hMSL;
      }


  Serial.println(rtk.lat1, 6);
  msg.flags.extended = 0;  //1 = extended frame 
  msg.flags.remote = 0;
  msg.len = 8;
  msg.id = 0x01;
  f = (float) rtk.lat1;
  memcpy(data, &f, sizeof f);
  f = (float) rtk.lon1;
  memcpy(data1, &f, sizeof f);
  for(uint8_t i = 0; i<4; i++){
    msg.buf[i] = data[i];
    msg.buf[i+4] = data1[i];
  }
  Can0.setMB(MB2, TX);  //Add ,IDE for extended frames.
  Can0.write(msg);
 /*
  msg.flags.extended = 0;  //1 = extended frame 
  msg.flags.remote = 0;
  msg.len = 8;
  msg.id = 0x02;
  f = (float) rtk.fixType;
  memcpy(data, &f, sizeof f);
  f = (float) rtk.numSV;
  memcpy(data1, &f, sizeof f);
  for(uint8_t i = 0; i<4; i++){
    msg.buf[i] = data[i];
    msg.buf[i+4] = data1[i];
  }
  Can0.setMB(MB2, TX);  
  Can0.write(msg);

  msg.id = 0x03;
  f = rtk.heading;
  memcpy(data, &f, sizeof f);
  f = (float) rtk.gSpeed;
  memcpy(data1, &f, sizeof f);
  for(uint8_t i = 0; i<4; i++){
    msg.buf[i] = data[i];
    msg.buf[i+4] = data1[i];
  }
  //Can0.setMB(MB2, TX);
  Can0.write(msg);
*/

  Can0.mailboxStatus();
  static uint32_t _timer = millis();
  if ( millis() - _timer > 4000 ) {
    pinMode(13, OUTPUT); digitalWrite(13, !digitalRead(13));
    Serial.print("*HEARTBEAT* "); Serial.println(millis());
    _timer = millis();
  }
}
and its output is:

Code:
FIFO Disabled
	Mailboxes:
		MB0 code: RX_FULL
		MB1 code: TX_DATA (Transmitting)(Standard Frame)(ID: 0x69)(Payload: 3 88 7D 44 66 66 C6 41)
		MB2 code: TX_DATA (Transmitting)(Standard Frame)(ID: 0x1)(Payload: 3B 19 23 42 1A A1 93 C2)
		MB3 code: RX_FULL
		MB4 code: RX_FULL
		MB5 code: RX_FULL
		MB6 code: RX_FULL
		MB7 code: RX_FULL
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
1014.18, 24.80
40.774639


In the Master or Receiver end:

Code:
#include <IFCT.h>

void setup() {
  Serial.begin(115200);
  delay(1000);

  Can0.enableFIFO(0); // turn on fifo
  //Can0.enableFIFOInterrupt(0); //  <---- interrupt off, we use pollFIFO // FIFO -------------->>>>>>>>
  Can0.onReceive(myMSG);
  Can0.onReceive(MB1, MB1cb);
  Can0.onReceive(MB2, MB2cb);

}
// the "slave" transmitter is broadcasting 5 STD IDs and 1 EXT ID every second ------------------>>>>

void loop() {
   Can0.mailboxStatus(); 
  CAN_message_t msg; // setup a temporary storage buffer

  static uint32_t _timer3 = millis();
  if ( millis() - _timer3 > 10 ) {
    while ( FLEXCAN0_IFLAG1 & FLEXCAN_IMASK1_BUF5M && FLEXCAN0_MCR & FLEXCAN_MCR_FEN ) {
      Can0.pollFIFO(msg, 0); // <--- here, 1 FIFO interrupts will be disabled (if enabled) and restored when overload is 0.
      Serial.print("*  LEN: "); Serial.print(msg.len);
      Serial.print(" EXT: "); Serial.print(msg.flags.extended);
      Serial.print(" REMOTE: "); Serial.print(msg.rtr);
      Serial.print(" TS: "); Serial.print(msg.timestamp);
      Serial.print(" ID: "); Serial.print(msg.id);
      Serial.print(" Buffer: ");
      for ( uint8_t i = 0; i < msg.len; i++ ) {
        Serial.print(msg.buf[i], HEX); Serial.print(" ");
      } Serial.println();
      
      char data[sizeof(float)];
      char data1[sizeof(float)];
      for(uint8_t i=0; i<4; i++){
        data[i] = msg.buf[i];
        data1[i] = msg.buf[i+4];
      }
      float pressure;
      memcpy(&pressure, data, sizeof pressure);    // receive data
      Serial.print(pressure);
    
      float temp;
      memcpy(&temp, data1, sizeof temp);    // receive data
      Serial.print(", "); Serial.println(temp);
    }
    _timer3 = millis();
  }

  //  Serial.println(FLEXCAN0_IMASK1);


  delay(20);


  msg.flags.extended = random(0, 2);
  msg.flags.remote = 0;
  msg.len = 8;
  msg.id = random(0x69, 0x178);
  msg.buf[0] = random(0, 255);
  msg.buf[1] = random(0, 255);
  msg.buf[2] = random(0, 255);
  msg.buf[3] = random(0, 255);
  msg.buf[4] = random(0, 255);
  msg.buf[5] = random(0, 255);
  msg.buf[6] = random(0, 255);
  msg.buf[7] = random(0, 255);
  Can0.write(msg);

  // here we sending can frames randomly <---------

  static uint32_t _timer = millis();
  if ( millis() - _timer > 4000 ) {
    pinMode(13, OUTPUT); digitalWrite(13, !digitalRead(13));
    Serial.print("*HEARTBEAT* "); Serial.println(millis());
    //Need this otherwise defaults to pollFIFO
    static bool moo = 1;
    if ( moo ) {
            Can0.setMB(MB1, RX);  //add ,IDE for extended frames
            Can0.enableMBInterrupt(MB1); // <--- enable per mailbox interrupt
            Can0.setMB(MB2, RX);  //add ,IDE for extended frames
            Can0.enableMBInterrupt(MB2); // <--- enable per mailbox interrupt
    }
    _timer = millis();
  }
  Serial.println("END LOOP");
     Can0.mailboxStatus(); 

}



void MB1cb(const CAN_message_t &msg) { // <--- mailbox 1 callback
  Serial.print("*** MB "); Serial.print(msg.mb);
  Serial.print("  LEN: "); Serial.print(msg.len);
  Serial.print(" EXT: "); Serial.print(msg.flags.extended);
  Serial.print(" REMOTE: "); Serial.print(msg.rtr);
  Serial.print(" TS: "); Serial.print(msg.timestamp);
  Serial.print(" ID: "); Serial.print(msg.id);
  Serial.print(" Buffer: ");
  for ( uint8_t i = 0; i < msg.len; i++ ) {
    Serial.print(msg.buf[i], HEX); Serial.print(" ");
  } Serial.println();

      char data[sizeof(float)];
      char data1[sizeof(float)];
      for(uint8_t i=0; i<4; i++){
        data[i] = msg.buf[i];
        data1[i] = msg.buf[i+4];
      }
      float pressure;
      memcpy(&pressure, data, sizeof pressure);    // receive data
      Serial.print(pressure);
    
      float temp;
      memcpy(&temp, data1, sizeof temp);    // receive data
      Serial.print(", "); Serial.println(temp);
}

void MB2cb(const CAN_message_t &msg) { // <--- mailbox 1 callback
  Serial.print("*** MB "); Serial.print(msg.mb);
  Serial.print("  LEN: "); Serial.print(msg.len);
  Serial.print(" EXT: "); Serial.print(msg.flags.extended);
  Serial.print(" REMOTE: "); Serial.print(msg.rtr);
  Serial.print(" TS: "); Serial.print(msg.timestamp);
  Serial.print(" ID: "); Serial.print(msg.id);
  Serial.print(" Buffer: ");
  for ( uint8_t i = 0; i < msg.len; i++ ) {
    Serial.print(msg.buf[i], HEX); Serial.print(" ");
  } Serial.println();

      char data[sizeof(float)];
      char data1[sizeof(float)];
      for(uint8_t i=0; i<4; i++){
        data[i] = msg.buf[i];
        data1[i] = msg.buf[i+4];
      }
      float p;
      memcpy(&p, data, sizeof p);    // receive data
      Serial.print(p);
    
      memcpy(&p, data1, sizeof p);    // receive data
      Serial.print(", "); Serial.println(p);
}


void myMSG(const CAN_message_t &msg) { // global callback
  Serial.print("**MB "); Serial.print(msg.mb);
  Serial.print("  LEN: "); Serial.print(msg.len);
  Serial.print(" EXT: "); Serial.print(msg.flags.extended);
  Serial.print(" REMOTE: "); Serial.print(msg.rtr);
  Serial.print(" TS: "); Serial.print(msg.timestamp);
  Serial.print(" ID: "); Serial.print(msg.id);
  Serial.print(" Buffer: ");
  for ( uint8_t i = 0; i < msg.len; i++ ) {
    Serial.print(msg.buf[i], HEX); Serial.print(" ");
  } Serial.println();

      char data[sizeof(float)];
      char data1[sizeof(float)];
      for(uint8_t i=0; i<4; i++){
        data[i] = msg.buf[i];
        data1[i] = msg.buf[i+4];
      }
      float pressure;
      memcpy(&pressure, data, sizeof pressure);    // receive data
      Serial.print(pressure);
    
      float temp;
      memcpy(&temp, data1, sizeof temp);    // receive data
      Serial.print(", "); Serial.println(temp);
}
but the output doesn't seem to correspond to MB1 or 2:

Code:
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
**MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 40439 ID: 105 Buffer: B1 8A 7D 44 71 3D C6 41 
1014.17, 24.78
**MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 40554 ID: 1 Buffer: 36 19 23 42 1A A1 93 C2 
40.77, -73.81
*** MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 40554 ID: 1 Buffer: 36 19 23 42 1A A1 93 C2 
40.77, -73.81
END LOOP
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_DATA (Transmitting)(Extended Frame)(ID: 0xEA)(Payload: A4 69 B9 86 BA E6 17 7D)
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
**MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 62502 ID: 105 Buffer: D1 89 7D 44 71 3D C6 41 
1014.15, 24.78
**MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 62650 ID: 1 Buffer: 36 19 23 42 1A A1 93 C2 
40.77, -73.81
*** MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 62650 ID: 1 Buffer: 36 19 23 42 1A A1 93 C2 
40.77, -73.81
END LOOP
then after awhile all I get is the following repeating:

Code:
**MB 1  LEN: 8 EXT: 0 REMOTE**MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 5390 ID: 105 Buffer: 17 87 7D 44 D7 A3 C6 41 
1014.11, 24.83
**MB 2  LEN: 8 EXT: 0 REMOTE:**MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 49578 ID: 105 Buffer: B6 87 7D 44 D7 A3 C6 41 
1014.12, 24.83
**MB 1  LEN: 8 EXT: 0 REMOTE**MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 28174 ID: 105 Buffer: B6 87 7D 44 D7 A3 C6 41 
1014.12, 24.83
**MB 2  LEN: 8 EXT: 0 REMOTE**MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 6769 ID: 105 Buffer: 5C 89 7D 44 D7 A3 C6 41 
1014.15, 24.83
**MB 1  LEN: 8 EXT: 0 REMOTE:**MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 50900 ID: 105 Buffer: 97 85 7D 44 D7 A3 C6 41 
1014.09, 24.83
 
Set your setMB’s once, not in a tight loop. MB1&2 properly changed to transmit but you can’t control which mailbox its sent to as now you have 10 transmit buffers and write() chooses the one that isn’t busy transmitting, the output shows 2 items transmitting from id 0x69 and id 0x01.

now for the master, since mb0 and mb4 still receiving all ids before mb1&2, youll have to capture mb0 as well.
because of mailboxes catching anything, theres no guarentee your frames will only be in mb1&2, currently youd read all first 4 mailboxes to get your standard ids, using interrupt or read() function

when the filter system comes you need to take care of mailbox ordering, if you put a catchall mailbox at MB0 and specific id in 2,3 etc, 0 will consume it if its empty before the next MB gets it. With filters it’s a good idea to keep catch-ALl ID mailboxes at the end of the line, where they are done last by the hardware

if you also wanna try it out the setMaxMB(4) will set you up with 4 mailboxes (dont do this in FIFO mode)
then set the first two to RX boxes, 3&4 to transmit, this will ensure you only have 2 places to get your data
 
Good evening, oh silent ones :)

Today I worked on filtering support, and for those individuals who are uncertain on how masking is done, don't worry, the library will take care of that calculation for you automatically.
I created functions for individual mailboxes (FIFO will be later on in future). This allows you to have mailboxes accept single ID's, or up to 5 could be input for collection.

As we all know, you already have now individual mailbox interrupt and callbacks, you also have this:
Because the callback handler pointers are different, you may issue 1 or more mailboxes to an individual callback, and have all other data going to another callback.

Code:
  Can0.onReceive(MB0, myNode);
  Can0.onReceive(MB2, myNode);

In that example, 2 mailbox data will be sent to the same callback, a nice feature to contain several nodes in a single function.

The new filtering method i worked on today is as follows:
Code:
    void setMBFilter(IFCTMBFLTEN input); /* enable/disable traffic for all MBs (for individual masking) */
    void setMBFilter(IFCTMBNUM mb_num, IFCTMBFLTEN input); /* set specific MB to accept/deny traffic */
    void setMBFilter(IFCTMBNUM mb_num, uint32_t id1); /* input 1 ID to be filtered */
    void setMBFilter(IFCTMBNUM mb_num, uint32_t id1, uint32_t id2); /* input 2 ID's to be filtered */
    void setMBFilter(IFCTMBNUM mb_num, uint32_t id1, uint32_t id2, uint32_t id3); /* input 3 ID's to be filtered */
    void setMBFilter(IFCTMBNUM mb_num, uint32_t id1, uint32_t id2, uint32_t id3, uint32_t id4); /* input 4 ID's to be filtered */
    void setMBFilter(IFCTMBNUM mb_num, uint32_t id1, uint32_t id2, uint32_t id3, uint32_t id4, uint32_t id5); /* input 5 ID's to be filtered */

Like I mentioned, by default when library is loaded, all mailboxes accept traffic. The first thing you would like to do if you don't care for the other traffic is tell all the mailboxes to ignore them.
Code:
  Can0.setMBFilter(REJECT_ALL); // blocks all traffic from entering mailbox (ACCEPT_ALL restores default behaviour)

Once you rejected the traffic, your all set for filtering work!
The same feature above is available to an individual mailbox:
Code:
  Can0.setMBFilter(MB0,ACCEPT_ALL);
At this moment, you'll notice traffic is comming in only from MB0 if you followed both steps above, provided you enabled the mailbox interrupt and callback.
Next, lets say you don't want that mailbox to have all traffic, assign it the ID you want it to accept:
Code:
  Can0.setMBFilter(MB0, 0x123);

MB0 is now overridden to accept ONLY id 0x123.

Lets say, you want to accept ID's 0x1003, 0x1005, and 0x1011, you simply do this:
Code:
  Can0.setMBFilter(MB0, 0x1003, 0x1005, 0x1011);
The library will do all the work to calculate the masks and update the mailbox for you, so it's no burden to you :)

Github has been updated with the current revision, enjoy


Hope you like the mailbox provisioning I offered, here is current T3.6 demo compile report:
Code:
Sketch uses 19704 bytes (1%) of program storage space. Maximum is 1048576 bytes.
Global variables use 5456 bytes (2%) of dynamic memory, leaving 256688 bytes for local variables. Maximum is 262144 bytes.

Only a 20 byte increase :)

Tony
 
Last edited:
Another update for today, I added mailbox provisioning for ID ranges.

To allow mailbox MB2, for example, to accept ID ranges from 0x20 to 0x2A, do this:
Code:
Can0.setMBFilterRange(MB2, 0x20, 0x2A);

This will setup your reception mailbox to accept all ID's with the automated mask calculation done on the range.


Also, in case your not already aware, applying the filter to a mailbox uses the mailbox's Extended/Standard ID flag, so if you append a filter to a mailbox and the mailbox is setup as extended id (for example), your ID & mask filtering will be applied automatically as an Extended ID.


Enjoy :)

Tony
 
Today I added another feature, it was Mike's idea :)
It's actually a good idea to implement it as well. If a user wishes to send data sequentially to another node, it is recommended not using any available transmit buffer to fill for arbitration
if you have 10 mailboxes and send 5 transmits down the chain, you don't know which will be sent out first. So a new function was made for users who would like for their particular project to send to a specific mailbox so data can be sent out sequentially to the node.

Code:
Can0.write(msg); // writes to any available TX mailbox
Can0.write(MB15,msg); // writes to a specific transmit mailbox

a value is returned if successful, otherwise 0 is returned.
Github updated.
 
Mailbox Provisioning and Specific Mailboxes

Ok. Breaking this up into two parts for simplicity sake, and thanks for the blame :). On the transmit side (sensor data transmit) I am using MB0 and 1 to TX sensor data as before on a T3.5 using the following sketch (note I am using your new feature Can0.write(MB1, msg):
Code:
#include <IFCT.h>
#include <Wire.h>
#include "globals.h"
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme; // I2C

#include <ublox2.h>
#include "Streaming.h"
#include <string>

// a uBlox object, which is on Teensy hardware
// GPS serial port
UBLOX GPS(GPShwSERIAL);

// the uBlox data structure
gpsData uBloxData;

struct gps rtk;

CAN_message_t msg; // setup a storage buffer

void setup() {
  Serial.begin(115200);
  delay(5000);
  
    bool status;
    // default settings
    // (you can also pass in a Wire library object like &Wire2)
    status = bme.begin();  
    if (!status) {
        Serial.println("Could not find a valid BME280 sensor, check wiring!");
        while (1);
    }

  //GPS SETUP
  // -- AutoBauding test --
  // Try communication with the GPS
  // receiver at 9600 baud, default settings
  // then set GPS UART Baud to 460800
  GPS.begin(9600);
  GPS.SetGPSbaud(460800, true);
  GPS.end();
  GPS.begin(460800);
  
  GPS.SetRATE(200, false);                 // Navigation/Measurement Rate Settings, e.g. 100ms => 10Hz, 200 => 5.00Hz, 1000ms => 1Hz, 10000ms => 0.1Hz
  // Possible Configurations:
  // 60=>16.67Hz, 64=>15.63Hz, 72=>13.89Hz, 80=>12.50Hz, 100=>10.00Hz, 125=>8.00Hz, 200=>5.00Hz, 250=>4.00Hz, 500=>2.00Hz
  // 800=>1.25Hz, 1000=>1.00Hz, 2000=>0.50Hz, 4000=>0.25Hz, 10000=>0.10Hz, 20000=>0.05Hz, 50000=>0.02Hz

  // NOTE: Dis_all_NMEA -strongly suggest changing RX buffer to 255 or more,*otherwise you will miss ACKs*on serial monitor
  GPS.Dis_all_NMEA_Child_MSGs(false);       // Disable All NMEA Child Messages Command

  GPS.SetNAV5(4, false);                    // Set Dynamic platform model Navigation Engine Settings (0:portable, 2: stationary, 3:pedestrian, Etc)
  // Possible Configurations
  // 0: portable, 2: stationary, 3: pedestrian, 4: automotive, 5: sea, 6: airborne with <1g, 7: airborne with <2g
  // 8: airborne with <4g, 9: wrist worn watch (not supported in protocol v.less than 18)

  // ### Periodic auto update ON,OFF Command ###
  GPS.Ena_NAV_PVT(true);                    // Enable periodic auto update NAV_PVT
  //GPS.Dis_NAV_PVT(false);                 // Disable periodic auto update NAV_PVT

    Can0.setMB(MB0, TX);  //Add ,IDE for extended frames.
    Can0.setMB(MB1, TX);  //Add ,IDE for extended frames.


  delay(2500);
    Serial.println("-- Default Test --");
    Serial.println();

}

void loop() {

  msg.flags.extended = 0;  //1 = extended frame 
  msg.flags.remote = 0;
  msg.len = 8;

  //Send Pressure and Temperature from BME280
  msg.id = 0x69;
  //setup two msg buffer (convert float to uint8's
  convertFloat(bme.readPressure()/100.0F, bme.readTemperature());
  Can0.write(MB0, msg);  //send msg

  if(GPS.read(&uBloxData)) {
    rtk.iTOW = uBloxData.iTOW;
    rtk.fixType = uBloxData.fixType;
    rtk.numSV = uBloxData.numSV;
    rtk.pDOP = uBloxData.pDOP * 100;
    rtk.lat1 = uBloxData.lat;
    rtk.lon1 = uBloxData.lon;
    rtk.heading = uBloxData.heading;
    rtk.gSpeed = uBloxData.gSpeed;
    rtk.hMSL = uBloxData.hMSL;
  }

  //Sends GPS data from the M8N
  Serial.println(rtk.lat1, 6);
  msg.id = 0x01;

  convertFloat((float) rtk.lat1, (float) rtk.lon1);
  Serial.print("ID1 TX Status:"); 
  Serial.println(Can0.write(MB1, msg));

  msg.id = 0x02;
  convertFloat((float) rtk.fixType,(float) rtk.numSV); 
  Serial.print("ID2 TX Status:"); 
  Serial.println(Can0.write(MB1, msg));
  
  msg.id = 0x03;
  convertFloat(rtk.heading, (float) rtk.gSpeed);
  Serial.print("ID3 TX Status:"); 
  Serial.println(Can0.write(MB1, msg));

  Can0.mailboxStatus();
  
  static uint32_t _timer = millis();
  if ( millis() - _timer > 4000 ) {
    pinMode(13, OUTPUT); digitalWrite(13, !digitalRead(13));
    Serial.print("*HEARTBEAT* "); Serial.println(millis());

    _timer = millis();
  }
}

void convertFloat(float a, float b){
    char data[sizeof(float)];
    memcpy(data, &a, sizeof a);    // send data
    char data1[sizeof(float)];
    memcpy(data1, &b, sizeof b);    // send data
    for(uint8_t i = 0; i<4; i++){
      msg.buf[i] = data[i];
      msg.buf[i+4] = data1[i];
    }
}

DEBUG:

Code:
0.000000
ID1 TX Status:0
ID2 TX Status:0
ID3 TX Status:0
FIFO Disabled
	Mailboxes:
		MB0 code: TX_DATA (Transmitting)(Standard Frame)(ID: 0x69)(Payload: 14 A4 7F 44 F6 28 C2 41)
		MB1 code: TX_DATA (Transmitting)(Standard Frame)(ID: 0x1)(Payload: 0 0 0 0 0 0 0 0)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
Looks like it works for only sending data to MB0 and 1. MB0 works no issue since it is only 1 ID being sent. But here is the confusing part. For MB1 only ID 0x01 is getting transmitted but ID status for the transmit show 0. Not sure what I am doing wrong?

UPDATE: Not doing anything wrong. Looks like it is working now:
Code:
MB0 id 0x69: 1
40.774699
ID1 TX Status:1
ID2 TX Status:1
ID3 TX Status:1
FIFO Disabled
	Mailboxes:
		MB0 code: TX_INACTIVE
		MB1 code: TX_DATA (Transmitting)(Standard Frame)(ID: 0x3)(Payload: 90 FA 5F 43 C5 20 30 3D)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
MB0 id 0x69: 1
40.774699
ID1 TX Status:1
ID2 TX Status:1
ID3 TX Status:1
FIFO Disabled
	Mailboxes:
		MB0 code: TX_INACTIVE
		MB1 code: TX_DATA (Transmitting)(Standard Frame)(ID: 0x3)(Payload: 90 FA 5F 43 C5 20 30 3D)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE


Ok - now on to work on the receiver side of the house.... :)
 
Last edited:
Here is a little better view of the mailbox provisioning working:
Code:
MB0 id 0x69: 1
FIFO Disabled
	Mailboxes:
		MB0 code: TX_DATA (Transmitting)(Standard Frame)(ID: 0x69)(Payload: 97 6B 7F 44 B8 1E C3 41)
		MB1 code: TX_INACTIVE
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
9999.000000
ID1 TX Status:1
FIFO Disabled
	Mailboxes:
		MB0 code: TX_INACTIVE
		MB1 code: TX_DATA (Transmitting)(Standard Frame)(ID: 0x1)(Payload: 0 3C 1C 46 0 3C 1C 46)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
ID2 TX Status:1
FIFO Disabled
	Mailboxes:
		MB0 code: TX_INACTIVE
		MB1 code: TX_DATA (Transmitting)(Standard Frame)(ID: 0x2)(Payload: 0 0 0 0 0 0 0 0)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
ID3 TX Status:1
FIFO Disabled
	Mailboxes:
		MB0 code: TX_INACTIVE
		MB1 code: TX_DATA (Transmitting)(Standard Frame)(ID: 0x3)(Payload: 0 0 0 0 0 0 0 0)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE

BTW. Figured out you only get a successful TX if there is something on the receiving end :)…..
 
Now for the receiving side of the house I have the following:
Code:
#include <IFCT.h>
  float pressure, temp;
  float lat, lon, head, spd, fType, nSV;
  CAN_message_t msg; // setup a temporary storage buffer

void setup() {
  Serial.begin(115200);
  delay(1000);

  //Disable FIFO
  Can0.enableFIFO(0); // turn off fifo
  //Can0.enableFIFOInterrupt(0); //  <---- interrupt off, we use pollFIFO // FIFO -------------->>>>>>>>

  //Set up mailbox filters
  Can0.setMBFilter(REJECT_ALL); // blocks all traffic from entering mailbox (ACCEPT_ALL restores default behaviour)
  Can0.setMBFilter(MB0, 0x69);  // MB0 accecpts BME280 data
  Can0.setMBFilterRange(MB1, 0x01, 0x03);  // MB1 accepts GPS data

  Can0.onReceive(myMSG);
  Can0.onReceive(MB0, MB0cb); // set MB0 to receive and use MB0cb interrupt
  Can0.onReceive(MB1, MB1cb);

}

void loop() {

  //FIFO catch all if you decide to use it
  static uint32_t _timer3 = millis();
  if ( millis() - _timer3 > 10 ) {
    while ( FLEXCAN0_IFLAG1 & FLEXCAN_IMASK1_BUF5M && FLEXCAN0_MCR & FLEXCAN_MCR_FEN ) {
      Can0.pollFIFO(msg, 0); // <--- here, 1 FIFO interrupts will be disabled (if enabled) and restored when overload is 0.
      Serial.print("*  LEN: "); Serial.print(msg.len);
      Serial.print(" EXT: "); Serial.print(msg.flags.extended);
      Serial.print(" REMOTE: "); Serial.print(msg.rtr);
      Serial.print(" TS: "); Serial.print(msg.timestamp);
      Serial.print(" ID: "); Serial.print(msg.id);
      Serial.print(" Buffer: ");
      for ( uint8_t i = 0; i < msg.len; i++ ) {
        Serial.print(msg.buf[i], HEX); Serial.print(" ");
      } Serial.println();

    }

    _timer3 = millis();
  }

  //  Serial.println(FLEXCAN0_IMASK1);


  static uint32_t _timer = millis();
  if ( millis() - _timer > 4000 ) {
    pinMode(13, OUTPUT); digitalWrite(13, !digitalRead(13));
    Serial.print("*HEARTBEAT* "); Serial.println(millis());
    //Need this otherwise defaults to pollFIFO
    static bool moo = 1;
    if ( moo ) {
        Can0.setMB(MB0, RX);  //add ,IDE for extended frames
        Can0.enableMBInterrupt(MB0); // <--- enable per mailbox interrupt
        Can0.setMB(MB1, RX);  //add ,IDE for extended frames
        Can0.enableMBInterrupt(MB1); // <--- enable per mailbox interrupt
    }
    _timer = millis();
  }
  Serial.println("END LOOP");
  Can0.mailboxStatus(); 

}

void MB1cb(const CAN_message_t &msg) { // <--- mailbox 1 callback
  Serial.print("*** MB "); Serial.print(msg.mb);
  Serial.print("  LEN: "); Serial.print(msg.len);
  Serial.print(" EXT: "); Serial.print(msg.flags.extended);
  Serial.print(" REMOTE: "); Serial.print(msg.rtr);
  Serial.print(" TS: "); Serial.print(msg.timestamp);
  Serial.print(" ID: "); Serial.print(msg.id);
  Serial.print(" Buffer: ");
  for ( uint8_t i = 0; i < msg.len; i++ ) {
    Serial.print(msg.buf[i], HEX); Serial.print(" ");
  } Serial.println();

  if(msg.id == 0x01) {
    convert2Float(lat, lon);
  } else if(msg.id == 0x02){
    convert2Float(fType, nSV);
  } else if(msg.id == 0x03) {
    convert2Float(head, spd);
  }

}

void MB0cb(const CAN_message_t &msg) { // <--- mailbox 1 callback
  Serial.print("*** MB "); Serial.print(msg.mb);
  Serial.print("  LEN: "); Serial.print(msg.len);
  Serial.print(" EXT: "); Serial.print(msg.flags.extended);
  Serial.print(" REMOTE: "); Serial.print(msg.rtr);
  Serial.print(" TS: "); Serial.print(msg.timestamp);
  Serial.print(" ID: "); Serial.print(msg.id);
  Serial.print(" Buffer: ");
  for ( uint8_t i = 0; i < msg.len; i++ ) {
    Serial.print(msg.buf[i], HEX); Serial.print(" ");
  } Serial.println();

  convert2Float(pressure, temp);

}



void myMSG(const CAN_message_t &msg) { // global callback
  Serial.print("**MB "); Serial.print(msg.mb);
  Serial.print("  LEN: "); Serial.print(msg.len);
  Serial.print(" EXT: "); Serial.print(msg.flags.extended);
  Serial.print(" REMOTE: "); Serial.print(msg.rtr);
  Serial.print(" TS: "); Serial.print(msg.timestamp);
  Serial.print(" ID: "); Serial.print(msg.id);
  Serial.print(" Buffer: ");
  for ( uint8_t i = 0; i < msg.len; i++ ) {
    Serial.print(msg.buf[i], HEX); Serial.print(" ");
  } Serial.println();

      char data[sizeof(float)];
      char data1[sizeof(float)];
      for(uint8_t i=0; i<4; i++){
        data[i] = msg.buf[i];
        data1[i] = msg.buf[i+4];
      }
      float pressure;
      memcpy(&pressure, data, sizeof pressure);    // receive data
      Serial.print(pressure);
    
      float temp;
      memcpy(&temp, data1, sizeof temp);    // receive data
      Serial.print(", "); Serial.println(temp);
}

void convert2Float(float a, float b){
  char data[sizeof(float)];
  char data1[sizeof(float)];
  for(uint8_t i=0; i<4; i++){
    data[i] = msg.buf[i];
    data1[i] = msg.buf[i+4];
    Serial.print(msg.buf[i]); Serial.print(", ");    
  }
  Serial.println();
  memcpy(&a, data, sizeof a);    // receive data
  Serial.print(a);
 
  memcpy(&b, data1, sizeof b);    // receive data
  Serial.print(", "); Serial.println(b);
}
and I can't seem to get it to work - don't know what I am missing here. Here is the output:

Code:
END LOOP
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
END LOOP
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
END LOOP
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
END LOOP
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
END LOOP
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 c
It hangs at this point. If in enable myMsg it all goes there.
 
simple, your settting the filter in setup, but your setMB’ing in the loop. assigning setMB clears the setMBFilter
remove the setMB in loop, and put it before setMBFilter

line1: setMB(...)
line2: setMBFilter(...)

only needs to be done once actually

i might do a multidimentional array that restores mailbox filters when reconfiguring mailboxes, where masks and filters are stored internally for library functions
 
Ok did as you suggested with the following results:
Code:
END LOOP
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	*** MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 48567 ID: 105 Buffer: C8 4(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
*** MB 1  LEN: 8 EXT: 0 REMOTE: *** MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 22746 ID: 105 Buffer: 25 41 7F 44 EC 51 C2 41 
0, 0, 0, 0, 
0.00, 0.00
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
END LOOP
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
END LOOP
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 cod
then it hangs.

Looks like something is off: Here is the setup and loop again:

Code:
#include <IFCT.h>
  float pressure, temp;
  float lat, lon, head, spd, fType, nSV;
  CAN_message_t msg; // setup a temporary storage buffer

void setup() {
  Serial.begin(115200);
  delay(1000);

  //Disable FIFO
  Can0.enableFIFO(0); // turn off fifo
  //Can0.enableFIFOInterrupt(0); //  <---- interrupt off, we use pollFIFO // FIFO -------------->>>>>>>>

  //Can0.onReceive(myMSG);
  Can0.onReceive(MB0, MB0cb); // set MB0 to receive and use MB0cb interrupt
  Can0.onReceive(MB1, MB1cb);

  Can0.setMB(MB0, RX);  //add ,IDE for extended frames
  Can0.enableMBInterrupt(MB0); // <--- enable per mailbox interrupt
  Can0.setMB(MB1, RX);  //add ,IDE for extended frames
  Can0.enableMBInterrupt(MB1); // <--- enable per mailbox interrupt

  //Set up mailbox filters
  Can0.setMBFilter(REJECT_ALL); // blocks all traffic from entering mailbox (ACCEPT_ALL restores default behaviour)
  Can0.setMBFilter(MB0, 0x69);  // MB0 accecpts BME280 data
  Can0.setMBFilterRange(MB1, 0x01, 0x03);  // MB1 accepts GPS data


}

void loop() {

  //FIFO catch all if you decide to use it
  static uint32_t _timer3 = millis();
  if ( millis() - _timer3 > 10 ) {
    while ( FLEXCAN0_IFLAG1 & FLEXCAN_IMASK1_BUF5M && FLEXCAN0_MCR & FLEXCAN_MCR_FEN ) {
      Can0.pollFIFO(msg, 0); // <--- here, 1 FIFO interrupts will be disabled (if enabled) and restored when overload is 0.
      Serial.print("*  LEN: "); Serial.print(msg.len);
      Serial.print(" EXT: "); Serial.print(msg.flags.extended);
      Serial.print(" REMOTE: "); Serial.print(msg.rtr);
      Serial.print(" TS: "); Serial.print(msg.timestamp);
      Serial.print(" ID: "); Serial.print(msg.id);
      Serial.print(" Buffer: ");
      for ( uint8_t i = 0; i < msg.len; i++ ) {
        Serial.print(msg.buf[i], HEX); Serial.print(" ");
      } Serial.println();

    }

    _timer3 = millis();
  }

  //  Serial.println(FLEXCAN0_IMASK1);


  static uint32_t _timer = millis();
  if ( millis() - _timer > 4000 ) {
    pinMode(13, OUTPUT); digitalWrite(13, !digitalRead(13));
    Serial.print("*HEARTBEAT* "); Serial.println(millis());

    _timer = millis();
  }
  Serial.println("END LOOP");
  Can0.mailboxStatus(); 

}

void MB1cb(const CAN_message_t &msg) { // <--- mailbox 1 callback
  Serial.print("*** MB "); Serial.print(msg.mb);
  Serial.print("  LEN: "); Serial.print(msg.len);
  Serial.print(" EXT: "); Serial.print(msg.flags.extended);
  Serial.print(" REMOTE: "); Serial.print(msg.rtr);
  Serial.print(" TS: "); Serial.print(msg.timestamp);
  Serial.print(" ID: "); Serial.print(msg.id);
  Serial.print(" Buffer: ");
  for ( uint8_t i = 0; i < msg.len; i++ ) {
    Serial.print(msg.buf[i], HEX); Serial.print(" ");
  } Serial.println();

  if(msg.id == 0x01) {
    convert2Float(lat, lon);
  } else if(msg.id == 0x02){
    convert2Float(fType, nSV);
  } else if(msg.id == 0x03) {
    convert2Float(head, spd);
  }

}

void MB0cb(const CAN_message_t &msg) { // <--- mailbox 1 callback
  Serial.print("*** MB "); Serial.print(msg.mb);
  Serial.print("  LEN: "); Serial.print(msg.len);
  Serial.print(" EXT: "); Serial.print(msg.flags.extended);
  Serial.print(" REMOTE: "); Serial.print(msg.rtr);
  Serial.print(" TS: "); Serial.print(msg.timestamp);
  Serial.print(" ID: "); Serial.print(msg.id);
  Serial.print(" Buffer: ");
  for ( uint8_t i = 0; i < msg.len; i++ ) {
    Serial.print(msg.buf[i], HEX); Serial.print(" ");
  } Serial.println();

  convert2Float(pressure, temp);

}
 
This is working for me, red is where I modified, blue is requirement to enable my transceiver chip

Code:
#include <IFCT.h>
float pressure, temp;
float lat, lon, head, spd, fType, nSV;
CAN_message_t msg; // setup a temporary storage buffer

void setup() {
  Serial.begin(115200);
  delay(1000);

  [COLOR="#0000FF"]pinMode(2, OUTPUT); digitalWrite(2, 0);[/COLOR]

  //Disable FIFO
  //  Can0.enableFIFO(0); // turn off fifo ([COLOR="#FF0000"] off by default[/COLOR]
  //Can0.enableFIFOInterrupt(0); //  <---- interrupt off, we use pollFIFO // FIFO -------------->>>>>>>>


  [COLOR="#FF0000"]Can0.setMB(MB0, RX);  //add ,IDE for extended frames
  Can0.enableMBInterrupt(MB0); // <--- enable per mailbox interrupt
  Can0.setMB(MB1, RX);  //add ,IDE for extended frames
  Can0.enableMBInterrupt(MB1); // <--- enable per mailbox interrupt[/COLOR]


  //Set up mailbox filters
  Can0.setMBFilter(REJECT_ALL); // blocks all traffic from entering mailbox (ACCEPT_ALL restores default behaviour)
  Can0.setMBFilter(MB0, 0x69);  // MB0 accecpts BME280 data
  Can0.setMBFilterRange(MB1, 0x01, 0x03);  // MB1 accepts GPS data

  Can0.onReceive(myMSG);
  Can0.onReceive(MB0, MB0cb); // set MB0 to receive and use MB0cb interrupt
  Can0.onReceive(MB1, MB1cb);

}

void loop() {


  static uint32_t _timer = millis();
  if ( millis() - _timer > [COLOR="#FF0000"]1000[/COLOR] ) {
    pinMode(13, OUTPUT); digitalWrite(13, !digitalRead(13));
    Serial.print("*HEARTBEAT* "); Serial.println(millis());
    _timer = millis();
    Can0.mailboxStatus();
  }

}

void MB1cb(const CAN_message_t &msg) { // <--- mailbox 1 callback
  Serial.print("*** MB "); Serial.print(msg.mb);
  Serial.print("  LEN: "); Serial.print(msg.len);
  Serial.print(" EXT: "); Serial.print(msg.flags.extended);
  Serial.print(" REMOTE: "); Serial.print(msg.rtr);
  Serial.print(" TS: "); Serial.print(msg.timestamp);
  Serial.print(" ID: "); Serial.print(msg.id);
  Serial.print(" Buffer: ");
  for ( uint8_t i = 0; i < msg.len; i++ ) {
    Serial.print(msg.buf[i], HEX); Serial.print(" ");
  } Serial.println();

  if (msg.id == 0x01) {
    convert2Float(lat, lon);
  } else if (msg.id == 0x02) {
    convert2Float(fType, nSV);
  } else if (msg.id == 0x03) {
    convert2Float(head, spd);
  }

}

void MB0cb(const CAN_message_t &msg) { // <--- mailbox 1 callback
  Serial.print("*** MB "); Serial.print(msg.mb);
  Serial.print("  LEN: "); Serial.print(msg.len);
  Serial.print(" EXT: "); Serial.print(msg.flags.extended);
  Serial.print(" REMOTE: "); Serial.print(msg.rtr);
  Serial.print(" TS: "); Serial.print(msg.timestamp);
  Serial.print(" ID: "); Serial.print(msg.id);
  Serial.print(" Buffer: ");
  for ( uint8_t i = 0; i < msg.len; i++ ) {
    Serial.print(msg.buf[i], HEX); Serial.print(" ");
  } Serial.println();

  convert2Float(pressure, temp);

}



void myMSG(const CAN_message_t &msg) { // global callback
  Serial.print("**MB "); Serial.print(msg.mb);
  Serial.print("  LEN: "); Serial.print(msg.len);
  Serial.print(" EXT: "); Serial.print(msg.flags.extended);
  Serial.print(" REMOTE: "); Serial.print(msg.rtr);
  Serial.print(" TS: "); Serial.print(msg.timestamp);
  Serial.print(" ID: "); Serial.print(msg.id);
  Serial.print(" Buffer: ");
  for ( uint8_t i = 0; i < msg.len; i++ ) {
    Serial.print(msg.buf[i], HEX); Serial.print(" ");
  } Serial.println();

  char data[sizeof(float)];
  char data1[sizeof(float)];
  for (uint8_t i = 0; i < 4; i++) {
    data[i] = msg.buf[i];
    data1[i] = msg.buf[i + 4];
  }
  float pressure;
  memcpy(&pressure, data, sizeof pressure);    // receive data
  Serial.print(pressure);

  float temp;
  memcpy(&temp, data1, sizeof temp);    // receive data
  Serial.print(", "); Serial.println(temp);
}

void convert2Float(float a, float b) {
  char data[sizeof(float)];
  char data1[sizeof(float)];
  for (uint8_t i = 0; i < 4; i++) {
    data[i] = msg.buf[i];
    data1[i] = msg.buf[i + 4];
    Serial.print(msg.buf[i]); Serial.print(", ");
  }
  Serial.println();
  memcpy(&a, data, sizeof a);    // receive data
  Serial.print(a);

  memcpy(&b, data1, sizeof b);    // receive data
  Serial.print(", "); Serial.println(b);
}
 
The code i just posted is working fine here, doesnt freeze.
Is your transceiver working / setup and driven to be enabled?

Output:
Code:
*HEARTBEAT* 397399
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
**MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 62592 ID: 2 Buffer: 71 8F A6 1C F4 73 8F 66 
0.00, ovf
*** MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 62592 ID: 2 Buffer: 71 8F A6 1C F4 73 8F 66 
0, 0, 0, 0, 
0.00, 0.00
*HEARTBEAT* 401400
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
*HEARTBEAT* 405401
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
**MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 52862 ID: 2 Buffer: E6 C5 7E A4 20 29 DA 39 
-0.00, 0.00
*** MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 52862 ID: 2 Buffer: E6 C5 7E A4 20 29 DA 39 
0, 0, 0, 0, 
0.00, 0.00
**MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 7334 ID: 3 Buffer: 3A F2 77 D6 4C B8 7D 53 
ovf, ovf
*** MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 7334 ID: 3 Buffer: 3A F2 77 D6 4C B8 7D 53 
0, 0, 0, 0, 
0.00, 0.00
**MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 16623 ID: 105 Buffer: 80 1A B9 52 C3 6A B6 67 
ovf, ovf
*** MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 16623 ID: 105 Buffer: 80 1A B9 52 C3 6A B6 67 
0, 0, 0, 0, 
0.00, 0.00
*HEARTBEAT* 409402
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
**MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 43133 ID: 2 Buffer: 74 F9 C DF 27 C5 5A 4 
ovf, 0.00
*** MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 43133 ID: 2 Buffer: 74 F9 C DF 27 C5 5A 4 
0, 0, 0, 0, 
0.00, 0.00
**MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 63142 ID: 3 Buffer: 4D F1 0 C8 CD E2 8F 8A 
-132037.20, -0.00
*** MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 63142 ID: 3 Buffer: 4D F1 0 C8 CD E2 8F 8A 
0, 0, 0, 0, 
0.00, 0.00
**MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 6884 ID: 105 Buffer: D0 74 78 CA 71 85 14 F3 
-4070708.00, ovf
*** MB 0  LEN: 8 EXT: 0 REMOTE: 0 TS: 6884 ID: 105 Buffer: D0 74 78 CA 71 85 14 F3 
0, 0, 0, 0, 
0.00, 0.00
*HEARTBEAT* 413403
FIFO Disabled
	Mailboxes:
		MB0 code: RX_EMPTY	(Standard Frame)
		MB1 code: RX_EMPTY	(Standard Frame)
		MB2 code: RX_EMPTY	(Standard Frame)
		MB3 code: RX_EMPTY	(Standard Frame)
		MB4 code: RX_EMPTY	(Extended Frame)
		MB5 code: RX_EMPTY	(Extended Frame)
		MB6 code: RX_EMPTY	(Extended Frame)
		MB7 code: RX_EMPTY	(Extended Frame)
		MB8 code: TX_INACTIVE
		MB9 code: TX_INACTIVE
		MB10 code: TX_INACTIVE
		MB11 code: TX_INACTIVE
		MB12 code: TX_INACTIVE
		MB13 code: TX_INACTIVE
		MB14 code: TX_INACTIVE
		MB15 code: TX_INACTIVE
**MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 53525 ID: 3 Buffer: 7F 58 D6 4 56 5 D6 89 
0.00, -0.00
*** MB 1  LEN: 8 EXT: 0 REMOTE: 0 TS: 53525 ID: 3 Buffer: 7F 58 D6 4 56 5 D6 89 
0, 0, 0, 0, 
0.00, 0.00

Btw, I think you don't have your float conversion code, globals etc setup right, but the frames are working and accepted properly :)
 
Status
Not open for further replies.
Back
Top