Teensy 4.0 and 4.1 Communication across CANBUS using SN65HVD230

CoolDude5603

New member
Hello all. I'm trying to get my Teensy 4.0 to communicate over CANBUS protocol with my Teensy 4.1. Here is my current set up and wiring using teensy 4.0, 4.1, and SN65HVD230 breakout board:
Teensy 4.0 3.3V pin --> SN65_1 3.3V pin
Teensy 4.0 Pin 22 --> SN65_1 CAN TX pin
Teensy 4.0 Pin 23 --> SN65_1 CANRX pin
Teensy 4.0 GND to SN65_1 GND

SN65_1 CAN_L pin --> SN65_2 CAN_L pin
SN65_1 CAN_H pin --> SN65_2 CAN_H pin
The CAN_L pins and CAN_H pins are connected on the same column, then I have two 100Ohm resistors in parallel connecting the two columns (See image). Not sure if this is the right configuration. I know I need to use 120 Ohms but I don't have access to them right now.

SN65_2 CAN TX pin --> Teensy 4.1 pin 22
SN65_2 CAN RX pin --> Teensy 4.1 pin 23
SN65_2 GND --> Teensy 4.1 GND
SN65_2 3.3V --> Teensy 4.1 GND

Currently using the following testing code:
#include <FlexCAN_T4.h>
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> Can1;
void setup() {
Serial.begin(115200);
while (!Serial);
Serial.println("CAN Transmitter Ready");
Can1.begin();
Can1.setBaudRate(500000); // 500 kbps = standard speed
}
void loop() {
CAN_message_t msg;
msg.id = 0x123; // arbitrary message ID
msg.len = 8; // 8 data bytes
for (int i = 0; i < 8; i++) msg.buf = i; // payload 0,1,2,...
Can1.write(msg);
Serial.println("Message sent!");
delay(1000); // send every 1 s
}
#include <FlexCAN_T4.h>
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> Can1;
void setup() {
Serial.begin(115200);
while (!Serial);
Serial.println("CAN Receiver Ready");
Can1.begin();
Can1.setBaudRate(500000);
}
void loop() {
CAN_message_t msg;
if (Can1.read(msg)) { // non-blocking check
Serial.print("Received ID: 0x");
Serial.print(msg.id, HEX);
Serial.print(" Data: ");
for (int i = 0; i < msg.len; i++) {
Serial.print(msg.buf);
Serial.print(" ");
}
Serial.println();
}
}

Currently getting "Message Sent!" on the 4.0 serial monitor but the 4.1 is not receiving any messages. Loopback test on 4.0 to test outgoing signals worked fine. Is the problem with my termination resistors? Do I need to add capacitors between SN65 VCC and GND Pins like previous threads mentioned? Any input would be appreciated:


IMG_4846_50.jpg

IMG_4847_50.jpg
 
Have a close look at the modules. I had some manufactured by waveshare that included a 120 ohm termination resistor across the bus.

I also notice that you have not soldered the header on the 4.0. As is it in the photo I doubt you have any decent connections.
 
Last edited:
Back
Top