Hi All,
I did a search but couldn't find anything...
I'm using Flexcan_T4 on a Teensy 4.1. It works great! I'd also like to use it with a Teensy 3.2. However, the Teensy just crashes. No output to the serial console at all from the below code. I'm using the standard example from the library:
According to the github page on the library, it should work with Teensy 3.x. Has this been tested?
Any hints?
Thanks!
Andrew
I did a search but couldn't find anything...
I'm using Flexcan_T4 on a Teensy 4.1. It works great! I'd also like to use it with a Teensy 3.2. However, the Teensy just crashes. No output to the serial console at all from the below code. I'm using the standard example from the library:
Code:
#include <FlexCAN_T4.h>
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> Can0;
void setup(void) {
Serial.begin(115200); delay(400);
pinMode(6, OUTPUT); digitalWrite(6, LOW); /* optional tranceiver enable pin */
Can0.begin();
Can0.setBaudRate(500000);
Can0.setMaxMB(16);
Can0.enableFIFO();
Can0.enableFIFOInterrupt();
Can0.onReceive(canSniff);
Can0.mailboxStatus();
Serial.println("Starting");
}
void canSniff(const CAN_message_t &msg) {
Serial.print("MB "); Serial.print(msg.mb);
Serial.print(" OVERRUN: "); Serial.print(msg.flags.overrun);
Serial.print(" LEN: "); Serial.print(msg.len);
Serial.print(" EXT: "); Serial.print(msg.flags.extended);
Serial.print(" TS: "); Serial.print(msg.timestamp);
Serial.print(" ID: "); Serial.print(msg.id, HEX);
Serial.print(" Buffer: ");
for ( uint8_t i = 0; i < msg.len; i++ ) {
Serial.print(msg.buf[i], HEX); Serial.print(" ");
} Serial.println();
}
void loop() {
Can0.events();
static uint32_t timeout = millis();
if ( millis() - timeout > 200 ) {
CAN_message_t msg;
msg.id = random(0x1,0x7FE);
for ( uint8_t i = 0; i < 8; i++ ) msg.buf[i] = i + 1;
Can0.write(msg);
timeout = millis();
}
}
According to the github page on the library, it should work with Teensy 3.x. Has this been tested?
Any hints?
Thanks!
Andrew