Connect Omega2 to CanBus



  • hi
    I am looking to connect the Omega2 to a CanBus (both read and write).
    I have seen that there are modules available for arduino, but cannot find anything for Omega2.
    Any ideas on how to do this ?



  • Well looks like you would need to build some sort of interface to talk over the UART on the Omega but aside that on the software side seems there is something in LEDE.

    canutils - 0e3ff3b3-2 - CAN userspace utilities and tools
    canutils-asc2log - 0e3ff3b3-2 - Utility asc2log from the CAN utilities package.
    canutils-bcmserver - 0e3ff3b3-2 - Utility bcmserver from the CAN utilities package.
    canutils-can-calc-bit-timing - 0e3ff3b3-2 - Utility can-calc-bit-timing from the CAN utilities package.
    canutils-canbusload - 0e3ff3b3-2 - Utility canbusload from the CAN utilities package.
    canutils-candump - 0e3ff3b3-2 - Utility candump from the CAN utilities package.
    canutils-canfdtest - 0e3ff3b3-2 - Utility canfdtest from the CAN utilities package.
    canutils-cangen - 0e3ff3b3-2 - Utility cangen from the CAN utilities package.
    canutils-cangw - 0e3ff3b3-2 - Utility cangw from the CAN utilities package.
    canutils-canlogserver - 0e3ff3b3-2 - Utility canlogserver from the CAN utilities package.
    canutils-canplayer - 0e3ff3b3-2 - Utility canplayer from the CAN utilities package.
    canutils-cansend - 0e3ff3b3-2 - Utility cansend from the CAN utilities package.
    canutils-cansniffer - 0e3ff3b3-2 - Utility cansniffer from the CAN utilities package.
    canutils-isotpdump - 0e3ff3b3-2 - Utility isotpdump from the CAN utilities package.
    canutils-isotpperf - 0e3ff3b3-2 - Utility isotpperf from the CAN utilities package.
    canutils-isotprecv - 0e3ff3b3-2 - Utility isotprecv from the CAN utilities package.
    canutils-isotpsend - 0e3ff3b3-2 - Utility isotpsend from the CAN utilities package.
    canutils-isotpserver - 0e3ff3b3-2 - Utility isotpserver from the CAN utilities package.
    canutils-isotpsniffer - 0e3ff3b3-2 - Utility isotpsniffer from the CAN utilities package.
    canutils-isotptun - 0e3ff3b3-2 - Utility isotptun from the CAN utilities package.
    canutils-log2asc - 0e3ff3b3-2 - Utility log2asc from the CAN utilities package.
    canutils-log2long - 0e3ff3b3-2 - Utility log2long from the CAN utilities package.
    canutils-slcan_attach - 0e3ff3b3-2 - Utility slcan_attach from the CAN utilities package.
    canutils-slcand - 0e3ff3b3-2 - Utility slcand from the CAN utilities package.
    canutils-slcanpty - 0e3ff3b3-2 - Utility slcanpty from the CAN utilities package.

    These are all taken from the Linux CAN Project



  • Hey @Michael-Bock I'm one the founders of Carloop and I use can-utils on linux often. What you'll need is a version of linux that has SocketCAN and then install can-utils to be able to read/write CAN messages. You will also need a CAN to USB serial interface such as the Carloop Basic. Once I receive my Omega2 I'll figure out if I can add can-utils to it and report back.



  • You have different choices for CAN on Omega2. The obvious way is using a MCP2515 connected to SPI. I'm not 100% sure if you can use hardware accelerated SPI on Omega2. The necessary pins seems to be connected to the pin header but Ralink/Mediatek SPI is normally half duplex and the MCP2515 kernel modul expect full duplex.

    Another problem is the latency of the SPI Linux Framework. On high CANBus load packets might getting out of order or being lost.

    For testing I've written a combined MCP2515-SPI (GPIO-Bitbanged) driver:
    https://github.com/GBert/openwrt-misc/tree/master/mcp2515-banged
    The results were better than expexcted - no packet loss on a saturated 250kbit CANBus.

    As of today I'm prefering using a CAN2Serail converter based on a cheap PIC18F25K80. The Firmware was writen by Darron Broad. The serial to CAN conversion is amazing fast and is only limited by the serial speed. The good thing is the PIC could be flashed in circuit and the software, including assembler is part of an OpenWRT/Lede feed. If you are interested:
    SRSE2
    https://github.com/GBert/misc/tree/master/srse2

    But: The easiest way is to use a USB based CAN Adapter, of course ;-)


Log in to reply