Hello Everyone.
I'm currently troubleshooting an issue with my system not receiving CAN messages. I have tried to implement the FlexCAN_T4 examples, but I haven't had any success. I've checked my oscilloscope and it shows that the ACK bit is staying at (1) when it should have been changed to (0) by the library. All I need is to be able to receive messages, not need to transmit messages. Please refer to the attached pictures for more details.
In the scope image, the data was captured at PIN-30 (RX). CAN messages are been received from the transceiver, but the Arduino-IDE/Serial Monitor doesn't display anything except this,
FIFO Enabled --> Interrupt Enabled
FIFO Filters in use: 8
Remaining Mailboxes: 8
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
Ready...
Hardware,
1 Teensy 4.1 NE, using CAN CRX3 (pin30), CTXR3 (pin31), (tried others Pins 0/1 and Pins 22/23 with same results)
1 SN65HVD230DR Transceiver with a 3.3-V supply and each end of the bus is terminated with a 120-Ω resistor in compliance with the standard to minimize signal reflections on the bus.
Sketch,
#include <FlexCAN_T4.h>
FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_16> myCan;
CAN_message_t msg;
void setup() {
Serial.begin(9600);
delay(400);
myCan.begin();
myCan.setBaudRate(1000000);
myCan.setMaxMB(16);
myCan.enableFIFO();
myCan.enableFIFOInterrupt();
myCan.onReceive(canSniff);
myCan.mailboxStatus();
Serial.println("Ready...");
}
void loop() {
myCan.events();
}
void canSniff(const CAN_message_t &msg) {
Serial.print("BUS: CAN"); Serial.print(msg.bus);
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(" ID: "); Serial.print(msg.id, HEX);
Serial.print(" Data: ");
for (uint8_t i = 0; i < msg.len; i++) {
Serial.print(msg.buf, HEX);
Serial.print(" ");
}
Serial.print(" TS: "); Serial.print(msg.timestamp);
Serial.println();
}
I'm currently troubleshooting an issue with my system not receiving CAN messages. I have tried to implement the FlexCAN_T4 examples, but I haven't had any success. I've checked my oscilloscope and it shows that the ACK bit is staying at (1) when it should have been changed to (0) by the library. All I need is to be able to receive messages, not need to transmit messages. Please refer to the attached pictures for more details.
In the scope image, the data was captured at PIN-30 (RX). CAN messages are been received from the transceiver, but the Arduino-IDE/Serial Monitor doesn't display anything except this,
FIFO Enabled --> Interrupt Enabled
FIFO Filters in use: 8
Remaining Mailboxes: 8
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
Ready...
Hardware,
1 Teensy 4.1 NE, using CAN CRX3 (pin30), CTXR3 (pin31), (tried others Pins 0/1 and Pins 22/23 with same results)
1 SN65HVD230DR Transceiver with a 3.3-V supply and each end of the bus is terminated with a 120-Ω resistor in compliance with the standard to minimize signal reflections on the bus.
Sketch,
#include <FlexCAN_T4.h>
FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_16> myCan;
CAN_message_t msg;
void setup() {
Serial.begin(9600);
delay(400);
myCan.begin();
myCan.setBaudRate(1000000);
myCan.setMaxMB(16);
myCan.enableFIFO();
myCan.enableFIFOInterrupt();
myCan.onReceive(canSniff);
myCan.mailboxStatus();
Serial.println("Ready...");
}
void loop() {
myCan.events();
}
void canSniff(const CAN_message_t &msg) {
Serial.print("BUS: CAN"); Serial.print(msg.bus);
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(" ID: "); Serial.print(msg.id, HEX);
Serial.print(" Data: ");
for (uint8_t i = 0; i < msg.len; i++) {
Serial.print(msg.buf, HEX);
Serial.print(" ");
}
Serial.print(" TS: "); Serial.print(msg.timestamp);
Serial.println();
}
Attachments
Last edited: