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 installcan-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 addcan-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:
https://github.com/GBert/misc/tree/master/srse2But: The easiest way is to use a USB based CAN Adapter, of course
-
@Gerhard-Bertelsmann Thanks for your answer ! Do I understand it correctly that this board is like a dock for the Omega2+ and through a serial communication lib will read/write the CAN BUS ?
Can you share more details of it and is it possible to buy it ?
-
@Michael-Bock said in Connect Omega2 to CanBus:
@Gerhard-Bertelsmann Thanks for your answer ! Do I understand it correctly that this board is like a dock for the Omega2+ and through a serial communication lib will read/write the CAN BUS ?
yes, that's right. It's using the SLCAN API which could be used in conjunction with SocketCAN. The firmware was mainly developed by Darron Broad
The PIC firmware is highly optimized so that there are lots of free cycles even under heavy load on the CAN-Bus.Can you share more details of it and is it possible to buy it ?
Please have a look at:
https://github.com/GBert/misc/tree/master/srse2
It's working but the whole project is on hold due to the WiFi issues ...
Sorry, it isn't sold but I could share a PCB if you want. Please contact me by email
-
Hi,
the WiFi issues are being solved with newer versions of OpenwWRT. The Gleisbox is now running fine.
Here some pictures:
Regards
Gerd
-
Thank you Gerd! Great work!
Just a question... How do you test this configuration?
Did you use an emulator during your development process (don't want to mess with a real vehicle's CAN bus or its MCU configurations...)
-