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

Thread: Teensy 3.6 CAN BUS 5V

  1. #1
    Junior Member
    Join Date
    Nov 2019
    Posts
    10

    Teensy 3.6 CAN BUS 5V

    Hi all

    I'm extremly newbie in electronics and have a, maby stupid, question.

    Becuase of canbus high is 5V in my application from the car ECU, if I use a level converter on the signal down to 3.3V, must I also convert and scale down the canbus low signal to get it all to work?

    I'm thinking that the two signals must have the same "base line" voltage.

    Regards
    Hans

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,134
    It's the tranceiver's job to handle the bus voltage, not the actual teensy pins. You need a canbus transceiver for teensy

  3. #3
    Junior Member
    Join Date
    Nov 2019
    Posts
    10
    Ok, but if I'm only going to recieve data from the ECU at a first step?

    Just wan't it to not burn the Teensy.

  4. #4
    Member
    Join Date
    Sep 2019
    Location
    UK
    Posts
    22
    You still need a transceiver to 'receive' the signal and convert it to Teensy levels. There are lots out there that do it. SKPang make a useful canbus breakout board with a Teensy on top which makes life simple. You are correct though in that the baseline voltage is zero or thereabouts but don't forget that can low mirrors the signal on can high and doesn't just sit at zero volts.

  5. #5
    Junior Member
    Join Date
    Nov 2019
    Posts
    10
    Ok, many easier to go for Teensy 3.5 then with a tranciever.

  6. #6
    Member
    Join Date
    Sep 2019
    Location
    UK
    Posts
    22
    I don't think it matters which Teensy you use, they will all need a transceiver chip to operate on a can bus network. The built-in can chip is not the same as a transceiver.

  7. #7
    Junior Member
    Join Date
    Nov 2019
    Posts
    10
    Ok, many thanks.

  8. #8
    If you want to connect the Teensy to the CAN-bus then you would need a transceiver IC.

    There are many tutorials on Youtube.

    Try this one:
    https://www.youtube.com/watch?v=ledYMrZRuL8

  9. #9

  10. #10
    Junior Member
    Join Date
    Nov 2019
    Posts
    10
    Thanks for the links skpang.

    Anyone have a suggestion on a CAN transciever?

    Found one on the PJRC web site but it looked uncertain to order there, but I could be wrong.

  11. #11
    Quote Originally Posted by A6_quattro View Post
    Thanks for the links skpang.

    Anyone have a suggestion on a CAN transciever?

    Found one on the PJRC web site but it looked uncertain to order there, but I could be wrong.
    You can use this one:
    http://skpang.co.uk/catalog/canbus-b...le-p-1396.html

  12. #12
    Junior Member
    Join Date
    Nov 2019
    Posts
    10
    Great, just ordered that.

    Thanks again skpang.

  13. #13
    Junior Member
    Join Date
    Nov 2019
    Posts
    10
    Hi again

    Got the canbus reading from the ecu to work nicely.

    However, now I would like to send message to the ecu, it's an aftermarket ecu that's able to recieve data via canbus, and have googled without success on how the setup should be.

    Anyone that could point me in the right direction via some pseudo code or some simple code?


    Regards
    Hans

  14. #14
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,134
    If you have it wired to the CAN lines, you can attempt to plug a simple OBD reader to the ECU to read the freeze frames, then, in your teensy serial monitor, you should be able to see the ECU address. Writing is possible easily by setting the msg.id to the ECU address using the proper data payloads (standard OBD PID requests), and write(msg) when done. If it's an extended id, make sure msg.flags.extended is set to 1 before sending

  15. #15
    Junior Member
    Join Date
    Nov 2019
    Posts
    10
    Thanks tonton81 for your answer.

    I think I figured out the adress to send to but I'm struggling to implement the write() in https://github.com/skpang/Teensy_CAN-Bus_ECU_reader code.
    Was almost 20 years since I coded C++ so bear with me.

    Someone that could give me some guidance?

  16. #16
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,134
    Code:
                CAN_message_t msg;
                msg.len = 8;
                msg.id = 0x321;
                msg.buf[0] = 1;
                msg.buf[1] = 2;
                msg.buf[2] = 3;
                msg.buf[3] = 4;
                msg.buf[4] = 5;
                msg.buf[5] = 6;
                msg.buf[6] = 7;
                msg.buf[7] = 8;
    
                can1.write(msg);

  17. #17
    Junior Member
    Join Date
    Nov 2019
    Posts
    10
    Quote Originally Posted by tonton81 View Post
    Code:
                CAN_message_t msg;
                msg.len = 8;
                msg.id = 0x321;
                msg.buf[0] = 1;
                msg.buf[1] = 2;
                msg.buf[2] = 3;
                msg.buf[3] = 4;
                msg.buf[4] = 5;
                msg.buf[5] = 6;
                msg.buf[6] = 7;
                msg.buf[7] = 8;
    
                can1.write(msg);
    Actually, got it to work almost exactly in that way.

    Thank's

Posting Permissions

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