Teensy 3.2 and 3.6 CAN BUS

Status
Not open for further replies.
Hi,

I'm trying to make a Teensy 3.2 (transmitter) and a Teensy 3.6 (receiver) communicate through CAN using these cheap MCP2551 Modules:https://www.aliexpress.com/item/32467806585.html?spm=a2g0s.9042311.0.0.22f24c4dP75xAS.

But I'm not receiving anything through Teensy 3.6. I'm even tried swapping both MCP2551 modules as I have 5 of them available, thinking that maybe one of them could be faulty, with no success. I have the photos of my connections attached, and this is my code:

Teensy 3.2 transmitter
Code:
#include <FlexCAN.h>
#include <kinetis_flexcan.h>

FlexCAN CANBus(500000);
static CAN_message_t msg;

void setup() {
  CANBus.begin();
  pinMode(LED_BUILTIN, OUTPUT); 
  delay(1000);
  Serial.println("CAN Transmitter Initialized");
}

void loop() {
    Serial.println("Sending");
    msg.id = 0x1;
    msg.len = 1;
    msg.buf[0] = 1;
    CANBus.write(msg);
    //digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
    delay(500);
}

Teensh 3.6 receiver
Code:
#include <FlexCAN.h>
#include <kinetis_flexcan.h>

FlexCAN CANBus(500000);
static CAN_message_t msg;

void setup() {
  CANBus.begin();
  pinMode(LED_BUILTIN, OUTPUT); 
  delay(1000);
  Serial.println("CAN Receiver Initialized");
}

void loop() {
    if (CANBus.available()) {
        Serial.println("Message Received");
        CANBus.read(msg);
        Serial.println(msg.buf[0]);
        digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
    }
}
 

Attachments

  • IMG_20191208_110433085.jpg
    IMG_20191208_110433085.jpg
    49.6 KB · Views: 73
  • IMG_20191208_110512273.jpg
    IMG_20191208_110512273.jpg
    55.8 KB · Views: 75
The Teensy 3.6 is not 5v input tolerant. The way you have connected the MCP2551 to the 5v supply and the logic out to the T3.6 is 5v. You might have damaged the T3.6.

You also need a 120R terminator on each end of your network.
 
The pins on the Teensy 3.6 seems to be OK. I have tried adding a voltage divider on the CANH and CANL on the Teensy 3.6 with no results. The 120R resistor is already implemented as part of the transceiver module.
 
How did you check the pins on the Teensy 3.6 are still ok ? The CANH and CANL doesn't connect to the T3.6.

You can try and add a voltage divider from CAN_RX (CRX pin) to the T3.6 but damage might have already been done.
 
I've tested the pins with outputs and inputs and they seem to be ok. Sorry, you are right, I have done the voltage divider in the canrx and cantz, and not canh and canl. But it is still not working. Unfortunately I don't have any other boards to test this with.
 
You don't need a voltage divider on the CAN_TX line because the signal is coming from the Teensy. What resistor value did you used ? Post a photo of the setup.
 
Status
Not open for further replies.
Back
Top