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

Thread: Teensyduino compatible CAN library

  1. #1
    Junior Member
    Join Date
    Oct 2016
    Posts
    12

    Teensyduino compatible CAN library

    I am working with a Teensy 3.5 and a Teensy 3.6. Any CAN library available that is compatible with Teensyduino and works with these Teensy boards ?

  2. #2

  3. #3
    Junior Member
    Join Date
    Oct 2016
    Posts
    12
    Thank you.

  4. #4
    The pawelsky version is pretty much drop-in compatible with the FlexCAN library that comes with the TeensyDuino installation (as far as I know the one that comes with the installation is the teachop version). The teachop version does not support the second can bus on the Teensy 3.6.

    There are actually three versions of the same library. In ascending order of forking we have:

    https://github.com/teachop/FlexCAN_Library (Teensy 3.1)
    https://github.com/pawelsky/FlexCAN_Library (Teensy 3.1 - 3.6)
    https://github.com/collin80/FlexCAN_Library (Teensy 3.1 - 3.6)

    Yep, that last one is me. It's a fork of the pawelsky version and basically adds interrupt driven Rx/Tx and callbacks. But, the library API has been changed so it isn't drop-in compatible with the first two - not everything changed though, mostly just initialization.

  5. #5
    Junior Member
    Join Date
    Oct 2016
    Posts
    12
    Thank you again. Have the pawelsky version. Will look into the collin80 as well.

  6. #6
    Hello, just to let you know: There is also an early version of a UAVCAN driver implementation which is based on collin80: https://github.com/tum-phoenix/drive_teensy_libuavcan

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,467
    Quote Originally Posted by PeterPetersen View Post
    Hello, just to let you know: There is also an early version of a UAVCAN driver implementation which is based on collin80: https://github.com/tum-phoenix/drive_teensy_libuavcan
    Is there any more info about use of this in projects, or even proof-of-concept prototypes?

  8. #8
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,804
    Hi Paul. I have been looking at UAVaersospace and UAVcan for a little bit now - since tonton81 put together his new CAN library.

    If you look at the reference the driver is there for the Teensy and uses Flexcan library but haven't seen any projects out there. In my research also came across what may be simpler to start with called Libcanard:
    Libcanard
    Libcanard is a minimal implementation of UAVCAN in C, suitable for deeply embedded systems and resource constrained applications. It is primarily targeted for low-end microcontrollers, starting from 8 KB ROM and 6 KB RAM.
    The GitHub page is: https://github.com/UAVCAN/libcanard. I did see some people on the one of the forums say they got the example working on two arduinos? I figure if it can be done the Arduino it can be done on a Teensy

    Anyway going to look at it further and see if I can get at least libcanard working and then maybe the other implementation. Will take a while since I don't have any clue about UAVcan. So will have a learning curve.

    Mike

  9. #9
    Quote Originally Posted by PaulStoffregen View Post
    Is there any more info about use of this in projects, or even proof-of-concept prototypes?
    Currently, there is no example code for Arduino available. However, there are several working applications using a Platformio based toolchain:
    https://github.com/tum-phoenix/drive...vcan/issues/13

  10. #10
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,804
    @PeterPetersen. Yep. Just as a FYI I'm the one that opened the issue. As a status I actually am in the process of porting it into the IDE format. Right now I got it to the point where it sees all routines, but getting numerous undefined references, for instance:
    Code:
    C:\Users\CYBERP~1\AppData\Local\Temp\arduino_build_880129\sketch\uavcan_node_airspeed.ino.cpp.o: In function `uavcan::GlobalDataTypeRegistry::RegistrationResult uavcan::GlobalDataTypeRegistry::registerDataType<uavcan::protocol::NodeStatus_<0> >(uavcan::DataTypeID)':
    c:\users\cyberp~1\appdata\local\temp\arduino_build_880129\sketch\uavcan\node/global_data_type_registry.hpp:218: undefined reference to `uavcan::GlobalDataTypeRegistry::remove(uavcan::GlobalDataTypeRegistry::Entry*)'
    c:\users\cyberp~1\appdata\local\temp\arduino_build_880129\sketch\uavcan\node/global_data_type_registry.hpp:230: undefined reference to `uavcan::GlobalDataTypeRegistry::remove(uavcan::GlobalDataTypeRegistry::Entry*)'
    c:\users\cyberp~1\appdata\local\temp\arduino_build_880129\sketch\uavcan\node/global_data_type_registry.hpp:236: undefined reference to `uavcan::GlobalDataTypeRegistry::registImpl(uavcan::GlobalDataTypeRegistry::Entry*)'

  11. #11
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,804
    Ok. Managed to get it working with a test case. See https://forum.pjrc.com/threads/53394...oof-of-Concept. So can it be done yes - should fit and run T3.x

  12. #12
    Junior Member
    Join Date
    Aug 2018
    Posts
    4
    Quote Originally Posted by PeterPetersen View Post
    Currently, there is no example code for Arduino available. However, there are several more about bright bet for you Platformio based toolchain:
    https://github.com/tum-phoenix/drive...vcan/issues/13
    Thanks for the link!

  13. #13
    Junior Member
    Join Date
    Dec 2019
    Posts
    5
    Hi, I am new to Teensy and have some questions regarding CANBUS on Teensy 3.5 and 3.6.
    As I understand it there are at least these 3 libraries:

    https://github.com/teachop/FlexCAN_Library (Teensy 3.1) NOT 3.6.
    https://github.com/pawelsky/FlexCAN_Library (Teensy 3.1 - 3.6)
    https://github.com/collin80/FlexCAN_Library (Teensy 3.1 - 3.6)

    1. Which one is included in the latest (december 2019 download) TeensyDuino installation ?
    2. Are there now also any other library to consider, and what are the benefits ?

    I have also some Teensy 4 controllers and for the future it would be nice to have one library .

    (I have CAN running on Arduino UNO, Adafruit Feather M0 and M4, ESP32...)

    /Christer

  14. #14
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,262
    FlexCAN_T4 works on Teensy 3.2, 3.5, 3.6, and 4.0
    You can also use IFCT for Teensy 3.x

  15. #15
    Junior Member
    Join Date
    Dec 2019
    Posts
    5
    Quote Originally Posted by tonton81 View Post
    FlexCAN_T4 works on Teensy 3.2, 3.5, 3.6, and 4.0
    You can also use IFCT for Teensy 3.x
    Thank you !
    I will test at once !!

Posting Permissions

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