0
Marius Brataas

CAN-bus with armbian

Recommended Posts

Hey,

 

I’m running armbian on a tinkerboard and I need to connect to a CAN-bus.

Apparently the usual Linux CAN-kernel-modules aren’t shipped with armbian, so I guess I’ll have to add them manually somehow.

 

I`ve been trying to do that for two days now without any luck.

 

I’ve been trying to follow the steps described in other forums, but it haven’t helped.

I really just want to add the necessary modules to my existing kernel. 

 

Any ideas?

Share this post


Link to post
Share on other sites

I don't have information how is the situation with CAN-bus with this kernel/Tinkerboard, so only some theoretical tips: in case you need to add a function, that exists but is not enabled, this would be a good and simple start:  https://docs.armbian.com/Developer-Guide_Build-Preparation/ 

 

Sometimes enabling a feature is good to go, sometimes you need to add a function with a code/patch. In both cases, you need to recompile the kernel (sometimes module only also work) from sources.

Share this post


Link to post
Share on other sites

Thanks Igor, but I haven't really gotten any further.

 

I've tried to compile my own kernel like shown in this video, and this way I was able to add the CAN-bus modules to the config during menuconfig.

However, I can't seem to figure out how to boot with that new kernel now.

 

The boot directory on my Tinkerboard is currently looking like this:

5a81aa15d090b_ScreenShot2018-02-12at15_50_51.png.d62fe329cf16c1b66a08d93598b72e02.png

 

Any ideas or other strategies?

 

All I really need is normal Armbian but(!) with the CAN modules added to the kernel.

 

All help appreciated, thanks :)

 

Share this post


Link to post
Share on other sites

You need to start here/this way: https://docs.armbian.com/Developer-Guide_Build-Preparation/ with enabled at least this config option: KERNEL_CONFIGURE="yes" (actually if you don't change anything you are asked "do you want to change kernel config")  https://docs.armbian.com/Developer-Guide_Build-Options/

 

You only install (dpkg -i kernel.deb) resoulting kernel and dtb package.

I am not aware if CAN is working on Tinkerboard.

Share this post


Link to post
Share on other sites
root@tinkerboard:~# apt-get -y -qq install git
root@tinkerboard:~# git clone --depth 1 https://github.com/armbian/build
Cloning into 'build'...
remote: Counting objects: 1809, done.
remote: Compressing objects: 100% (1506/1506), done.
remote: Total 1809 (delta 344), reused 1285 (delta 190), pack-reused 0
Receiving objects: 100% (1809/1809), 48.36 MiB | 8.67 MiB/s, done.
Resolving deltas: 100% (344/344), done.
Checking connectivity... done.
Checking out files: 100% (2206/2206), done.
root@tinkerboard:~# cd build
root@tinkerboard:~/build# ./compile.sh
[ o.k. ] Using config file [ config-default.conf ]
[ o.k. ] This script will try to update
Already up-to-date.
Already on 'master'
Your branch is up-to-date with 'origin/master'.
[ o.k. ] Preparing [ host ]
[ .... ] Please read documentation to set up proper compilation environment 
[ .... ] http://www.armbian.com/using-armbian-tools/ 
[ error ] ERROR in function prepare_host [ general.sh:503 ]
[ error ] Running this tool on non x86-x64 build host in not supported 
[ o.k. ] Process terminated 

Trying to follow the very first steps in that post produces this output.

Share this post


Link to post
Share on other sites
7 minutes ago, Igor said:

Now read the error text. We don't support native compiling ... remember that you need to include all those patches https://github.com/armbian/build/tree/master/patch/kernel/rockchip-next if you want to proceed this way.

So... Configure on a normal desktop computer, compile, write to SD-card and insert back into tinkerboard, is that what this means?

 

Sorry, I am very new to linux and kernels

Share this post


Link to post
Share on other sites
13 minutes ago, Marius Brataas said:

Sorry, I am very new to linux and kernels


We made this tool with the purpose to make kernel recompilation as easy as possible. In just about every other way you have many potential obstacles to overcome. All those Youtube guides are usually made for Intel world/perfect scenarios where things just work. ARM variety is big.

 

You need some x86 desktop computer where you recompile the kernel in a virtual machine, transfer two .deb packages to your Tinkerboard via a network or via SD, install them with (dpkg -i package.deb) and reboot Tinkerboot into a new kernel. If you use our tools you have small chances to fail for anything else you need some experiences. It is possible to recompile kernel on your board, but ... you are on your own. Sources are accessible this way: 

apt install linux-source-4.14.14-next-rockchip

Since you don't want that upgrades overwrite your own made kernel you need to freeze kernel updates (armbian-config) or send your changes upstream and they might be included in the kernel by default.

Share this post


Link to post
Share on other sites
5 minutes ago, Igor said:


We made this tool with the purpose to make kernel recompilation as easy as possible. In just about every way you have many potential obstacles to overcome. All those Youtube guides are usually made for Intel world where things usually just work. We are mostly not there yet.

 

 

You need some x86 desktop computer where you recompile the kernel in a virtual machine, transfer to your Tinkerboard via a network or via SD, install DEB package and reboot Tinkerboot into a new kernel. If you use our tools you have small chances to fail for anything else you need some experiences. It is possible to recompile kernel on your board, but ... you are on your own. Sources are accessible this way: 


apt install linux-source-4.14.14-next-rockchip

 

 

I think I'll rather try to use your tools :)

Thanks for you help! I'll try the approach you described

Share this post


Link to post
Share on other sites

Remember the part about freezing your kernel so the changes don't disappear after updates ;-)

 

On 2/12/2018 at 10:46 AM, Igor said:

Since you don't want that upgrades overwrite your own made kernel you need to freeze kernel updates (armbian-config) or send your changes upstream and they might be included in the kernel by default.

 

Share this post


Link to post
Share on other sites

Hey again!

 

I used Igor's excellent software to compile a new kernel and I got the CAN-bus up and running :D

 

But I've ran into a new problem. When running this custom kernel the GPIO on my Tinker Board is no longer accessible.

 

When I try to use a pin in python I just get this message back: "RuntimeError: This gpio is set to other function!".

 

Any idea why this happens? I thought it would still work on my new kernel, after choosing tinkerboard in the menu of your compilation software, and then choosing the default kernel..

 

Any hints?

 

All help appreciated, thanks 

 

Marius

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
0