CAN (controlled area network) bus is communication protocol bus standard widely used in Automotive industry. It uses only two wires for communication and is very robust and noise immune. This is why it also is used in industrial robotics and other areas where reliable communication for small amounts of data is needed.
A10 and A20 SoCs are known to have CAN bus controller inside but few years ago when we started the A10/A20 OLinuXino design nobody knew what is this CAN driver neither how to use it.
This is why when I read message on Twitter –
I reply: “indeed, but on purpose, as no one has used this CAN or know how to use it, this would be just waste of components ”
Obviously things changed for the last couple of years as we have been feed with info about A20 CAN driver!
There is mainline CAN driver for A10/A20: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/net/can/sun4i_can.c?id=refs/tags/v4.4-rc8
CAN is documented http://linux-sunxi.org/images/f/f5/Sun7i-CANbus.pdf in fact it’s same as NXP SJA1000.
Sunxi-Can-Driver is on Github: https://github.com/btolfa/sunxi-can-driver
Linux-Sunxi mainlining efforts: http://linux-sunxi.org/Linux_mainlining_effort#Merged_into_4.4
Can4Linux is available also.
We quickly setup test with CAN transciever from AM3352-SOM-EVB and A20-OLinuXino-MICRO and build kernel with CAN support. Everything works!
Now we work on small board with CAN transciever on it which will enable CAN to be used on A20-OLinuXino-MICRO, A20-SOM-EVB, A10/20-OLinuXino-LIME and A20-OLinuXino-LIME2.
Fortunately when we made the board we kept same GPIO pin numbering on all boards so the CAN signals are on same places on all these boards and this makes the extension CAN board easy to route.
This will allow all our A10/A20 OLinuXinos to be used in CAN applications.
Gergely Imreh
Jan 19, 2016 @ 16:34:03
Well done, very thoughtful development methods!
eduardo
Jan 19, 2016 @ 16:35:27
Please bring one to Fosdem. We want to support it by our icoBoard.
Christian
Jan 19, 2016 @ 17:32:35
Great News – is there already a release date for the CAN extension board?
Kees Zagers
Jan 19, 2016 @ 18:40:55
Nice. Already used the Olimex Duinomite (also PIC-T795) products very succesfully in CAN projects. It would be very nice to have also the Linux platforms with CAN from Olimex.
Heinz
Jan 20, 2016 @ 00:45:46
@Kees, hope you will use can4linux 🙂 it’s much more performing and easier to use
Gerd
Jan 25, 2016 @ 00:57:57
How did you measure the performance can4linux vs SocketCAN on A10/A20 ?
Why is can4linux easier than SocketCAN ?
Heinz
Jan 26, 2016 @ 11:42:13
Measuring the processor usage time when receiving messages with high speed and high bus load.
“easier to use”? look at the simple example at https://en.wikipedia.org/wiki/Can4linux or the examples directory at the SourceForge project page. can4linux is a so-called character driver, with handling like a UART.
Heinz
Jan 26, 2016 @ 11:59:21
Additional to the default C API, using the LInux standard calls open(), read(), write(), Phyton and Tcl bindings are available.
Stupido
Jan 25, 2016 @ 09:53:04
Very good news – still can’t remove the grin out of my face!
Bghes
Feb 02, 2016 @ 22:13:05
Could you give the DTS can device definition ?
Тенгиз Шарафиев
Feb 25, 2016 @ 16:43:24
Patch for A10-OLinuXino-LIME dts that add binding for canbus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0001-Add-dts-binding-for-sun4i_can.patch
hosted with ❤ by GitHub
Christian
Mar 26, 2016 @ 16:21:12
Have you made any progress or an ETA?
Jussi Saarijoki
May 17, 2016 @ 09:59:04
Any news on this?
OLIMEX Ltd
May 17, 2016 @ 13:06:53
we have working prototype 🙂
vvk
Nov 09, 2016 @ 07:31:55
can you please provide guide to use can4linux c drivers with banana pro?
can you please include all steps from compiling to execution
Heinz (@heinz_hjo)
Nov 10, 2016 @ 19:43:39
I hope this will help: http://oertel-halle.de/projects/BananaPi
it is important that you compile the driver with the correct kernel sources installed.
I did it by getting the kernel bsp, mounted it on a nfs server and compiled the kernel and than the driver.
Stephan
Nov 23, 2016 @ 13:43:50
We experienced some problems regarding the A20s CAN interface getting out of step after receiving huger amounts of CAN frames. It was reproducibly appearing after several minutes. First some false frames appeared (candump), then none were received anymore. (I also double checked, that they are still on the bus). Though, the controller still acked them. Turning the controller down and up again brought it back to live.
I could trace this back to the frequency scaling. Setting the governor from ondemand to performance made the problem disappear completely until heat protection kicked in.
We didn’t find a final solution yet – just telling in case anyone might run into similar problems.
Heinz (@heinz_hjo)
Nov 24, 2016 @ 20:45:41
@Stephan we need to get your complete code. pleas provide an download-able example for testing the hardware.
Thanks
Bert
Dec 14, 2016 @ 19:56:00
Hello everybody,
I have an A20-OLinuXino-LIME2 board with an A20-CAN adapter board and now want build a kernel from scratch for this configuration.
Can anybody give me a short but detailed example on what to load down from where, and what to configure.
Thanks Bert