Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: CAN Project Weird Issue

Hybrid View

  1. #1
    Junior Member
    Join Date
    Jul 2017

    CAN Project Weird Issue


    This could be something daft, it likely is.. I'm fairly new to this stuff.

    I have a car ECU powered by my bench PSU, this provides a CAN stream at 1mbd which I am successfully receiving via a Waveshare SN65HVD230 (Chinese copy, I have an original Waveshare product en-route from Amazon).

    My project is wired as follows

    SN65 on the left, Teensy 3.2 on the right

    TX-> Pin 3 (Purple Wire)
    RX-> Pin 4 (Blue Wire)
    GND-> GND (Black to Brown Wire)
    3.3v-> 3.3v (Green to Red Wire)

    The teensy powered from USB.

    The CAN stream I'm receiving sends a total of 8 data blocks with ID's: 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007. I'm mostly receiving the first 2000 block, and every now and again, the second 2001 block. Until I physically touch the RX and TX wires from the Transveiver to the Teensy, and then I get a proper data stream including all of the above data blocks.

    I'm puzzled as to why me taking a hold of the wires makes this work, but when I'm not touching the wires it seems to repeat?

    Hopefully someone has a suggestion.


    Here's a photo of my project

    Here's the sketch I'm using

    #include <FlexCAN.h>
    #include <kinetis_flexcan.h>
    int led = 13;
    FlexCAN CANbus(1000000);
    static CAN_message_t rxmsg;
    static uint8_t hex[17] = "0123456789abcdef";
    void setup() {
      while (!Serial) ; // wait for Arduino Serial Monitor
      Serial.println(F("Teensy 3.2 CAN Test"));
      pinMode(led, OUTPUT);
      digitalWrite(led, 1);
    void loop() {
      // put your main code here, to run repeatedly:
      while ( {
        // Light off to indicate FIFO is not being polled
        digitalWrite(led, 0);
        // Construct String
        String text = "ID: 0x";
        text = String(text + String(, HEX));
        text = String(text + " DLC: ");
        text = String(text + String(rxmsg.len, HEX));
        // check if DLC is > 0
        if (rxmsg.len >= 1) {
          text = String(text + " DATA: ");
        // construct string for available bytes
        for (int idx = 0; idx < rxmsg.len; ++idx) {
          text = String(text + String(rxmsg.buf[idx], HEX));
          text = String(text + " ");
        // print result
        // LED Back on to indicate watching FIFO
        digitalWrite(led, 1);

  2. #2
    Junior Member
    Join Date
    Jul 2017
    I have a 5v step down board which I've used to power the entire project meaning everything is ground to a single source now.

    I am still only receiving the first Data block (2000) but now, me touching the TX and RX wires doesn't cause more data blocks to be received.

    Colour me confused!

  3. #3
    Senior Member
    Join Date
    Jan 2015
    Is there a 120R terminator resistor on board? Is it closed ? If not closed try and close it.

  4. #4
    Junior Member
    Join Date
    Jul 2017
    Thanks for the reply.

    My Waveshare CAN Transceiver arrived in the post today, and I can confirm that this has fixed my problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts