Adding CAN Bus (can0) device to BeagleBone

9.505 visualitzacions
Ves al primer missatge no llegit

Brent

no llegida,
20 de juny 2012, 15:11:0920/6/12
a beagl...@googlegroups.com
I'm trying to add can0 to my BeagleBone so that I can communicate on the CAN Bus.  I'm using the image from April 2012 found here: http://downloads.angstrom-distribution.org/demo/beaglebone/archive/Angstrom-Cloud9-IDE-eglibc-ipk-v2012.04-core-beaglebone-2012.04.09.img.xz.
 
iproute2 is installed, and i'm trying to add the device by using: ip link add dev can0 type can
The response I get back is: RTNETLINK answers: Operation not permitted
 
How do I add a CAN device?  Is there a way to tell if D_CAN is included in the kernel?

Gary Thomas

no llegida,
20 de juny 2012, 15:14:1420/6/12
a beagl...@googlegroups.com
Simple start - does it show up in 'cat /proc/net/dev'?
If not, the device is not present.

Brent

no llegida,
20 de juny 2012, 15:38:1620/6/12
a beagl...@googlegroups.com
No... just lo and eth0.  Does this mean I need to reconfigure the kernel?

R U Local

no llegida,
20 de juny 2012, 21:25:4520/6/12
a beagl...@googlegroups.com

You need the following kernel configs.

CONFIG_CAN=y

CONFIG_CAN_RAW=y

CONFIG_CAN_BCM=y

# CAN Device Drivers

# CONFIG_CAN_VCAN is not set

CONFIG_CAN_DEV=y

CONFIG_CAN_CALC_BITTIMING=y

CONFIG_CAN_TI_HECC=y

 

D_CAN driver for Bosh parts. The TI controller is HECC (high end CAN controller).

 

Then it works great.

 

Cheers Mike.

-- To join: http://beagleboard.org/discuss
To unsubscribe from this group, send email to:
beagleboard...@googlegroups.com
Frequently asked questions: http://beagleboard.org/faq

Brent

no llegida,
20 de juny 2012, 21:51:1320/6/12
a beagl...@googlegroups.com,roysto...@slingshot.co.nz
Thanks Mike.  I did see this posted somewhere, but I couldn't find where I need to set this. (I'm still looking)  Sorry, but I'm still learning linux, so I'm not familiar with kernel configs.  Is this a file located somewhere in the directory on the BeagleBoard?  Or do I need to follow the instructions here and build the kernel?  Thanks for your help.

Yegor Yefremov

no llegida,
21 de juny 2012, 5:27:5621/6/12
a beagl...@googlegroups.com,roysto...@slingshot.co.nz
You need at least the kernel sources from this repo: https://github.com/koenkooi/linux.git

Setup a proper PATH to your compiler toolchain (for example Linaro, CodeSourcery etc.), export your arch:

export ARCH=arm

execute:

make menuconfig

and go to "Networking support" -> "CAN bus subsystem support"

choose Raw CAN protocol

then go to "CAN Device drivers" and select "CAN platform drivers with netlink support" and "CAN bittiming calculation" and "Bosch D_CAN devices" -> "Generic Platform Bus based D_CAN driver"

That should be enough. HECC is not available on am335x, but on am3517/15.

Brent

no llegida,
22 de juny 2012, 12:16:1822/6/12
a beagl...@googlegroups.com,roysto...@slingshot.co.nz
I'm not getting anywhere.  I downloaded the CodeSourcery toolchain and followed their instructions on how to install it, ran "make menuconfig" and set the options for can.  But when I run "make", I get the following errors:
 
CC kernel/bounds.s
cc1: error: unrecognized command line option '-mlittle-endian'
... 'mapcs'
... 'mno-sched-prolog'
kernel/bounds.c:1:0: error: unknown ABI (apcs-gnu) for -mabi= switch

Robert Nelson

no llegida,
22 de juny 2012, 12:24:4922/6/12
a beagl...@googlegroups.com
On Fri, Jun 22, 2012 at 11:16 AM, Brent <brent...@gmail.com> wrote:
> I'm not getting anywhere.  I downloaded the CodeSourcery toolchain and
> followed their instructions on how to install it, ran "make menuconfig" and
> set the options for can.  But when I run "make", I get the following errors:
>
> CC kernel/bounds.s
> cc1: error: unrecognized command line option '-mlittle-endian'
> ... 'mapcs'
> ... 'mno-sched-prolog'
> kernel/bounds.c:1:0: error: unknown ABI (apcs-gnu) for -mabi= switch

make ARCH=arm <...>

Regards,

--
Robert Nelson
http://www.rcn-ee.com/

Brent C. Sink

no llegida,
22 de juny 2012, 12:47:3822/6/12
a beagl...@googlegroups.com
Not following... I need to type: "export ARCH=arm" or "export ARCH=armv7"?  Or "make ARCH=arm"?  I've tried all and get the same result. (Actually there is no armv7 directory so that one gives me a different error)

-- To join: http://beagleboard.org/discuss
To unsubscribe from this group, send email to:

Frequently asked questions: http://beagleboard.org/faq



--
-brent

Robert Nelson

no llegida,
22 de juny 2012, 13:04:2022/6/12
a beagl...@googlegroups.com
On Fri, Jun 22, 2012 at 11:47 AM, Brent C. Sink <brent...@gmail.com> wrote:
> Not following... I need to type: "export ARCH=arm" or "export ARCH=armv7"?
> Or "make ARCH=arm"?  I've tried all and get the same result. (Actually there
> is no armv7 directory so that one gives me a different error)

From your kernel source directory, with the correct "defconfig" saved
as ".config"..

Then run:

make ARCH=arm menuconfig
make ARCH=arm CROSS_COMPILE=path/to/codesourcy/arm/cross/gcc uImage modules

Brent

no llegida,
22 de juny 2012, 13:28:2722/6/12
a beagl...@googlegroups.com
Where would the defconfig/config file be located?  In the arch/arm/configs folder?
 
When I run "make ARCH=arm CROSS_COMPILE=/opt/CodeSourcery/Sourcery_G++_Lite/bin uImage modules", I get an error saying gcc: Command not found.  I feel like I'm missing something... Do I need the commercial version of CodeSourcery?  Or use a different toolchain?

Robert Nelson

no llegida,
22 de juny 2012, 13:36:3122/6/12
a beagl...@googlegroups.com
On Fri, Jun 22, 2012 at 12:28 PM, Brent <brent...@gmail.com> wrote:
> Where would the defconfig/config file be located?  In the arch/arm/configs
> folder?

From the same place you got the patched kernel source code... Or from
your current running beaglebone..

> When I run "make ARCH=arm
> CROSS_COMPILE=/opt/CodeSourcery/Sourcery_G++_Lite/bin uImage modules", I get
> an error saying gcc: Command not found.  I feel like I'm missing
> something... Do I need the commercial version of CodeSourcery?  Or use a
> different toolchain?

Nah, just not fully complete..

CROSS_COMPILE=/opt/CodeSourcery/Sourcery_G++_Lite/bin/arm-linux-gnueabi-

But double check the "bin" dir and adjust accordingly, encase it's
slightly different...

Brent

no llegida,
22 de juny 2012, 15:28:5622/6/12
a beagl...@googlegroups.com
Thanks, that got me further.  I'm in the process of compiling, but getting lots of errors and having to exclude some configurations from the config file.  Is this normal?  Is there a base config file that I should start from?
 
 

On Friday, June 22, 2012 1:36:31 PM UTC-4, RobertCNelson wrote:

Yegor Yefremov

no llegida,
22 de juny 2012, 15:56:0822/6/12
a beagl...@googlegroups.com
You can also try Buildroot.

Get source:


then choose BeagleBone config:

make beaglebone_defconfig

and make the first build:

make

after that you can configure the kernel:

make linux-menuconfig

The images are placed under build/images

Robert Nelson

no llegida,
22 de juny 2012, 16:35:5622/6/12
a beagl...@googlegroups.com
On Fri, Jun 22, 2012 at 2:28 PM, Brent <brent...@gmail.com> wrote:
> Thanks, that got me further.  I'm in the process of compiling, but getting
> lots of errors and having to exclude some configurations from the config
> file.  Is this normal?  Is there a base config file that I should start
> from?

Brent, sounds like you got a random source then..

For the source/config currently used by Angstrom, look at :
https://github.com/beagleboard/kernel

git clone git://github.com/beagleboard/kernel.git
cd kernel
git checkout origin/beaglebone-3.2 -b beaglebone-3.2
./patch.sh

config is in patches/beaglebone/defconfig

and the patched source is under kernel dir.

Brent C. Sink

no llegida,
22 de juny 2012, 16:43:3122/6/12
a beagl...@googlegroups.com
Ah, that makes sense. I was using the one here:
https://github.com/koenkooi/linux.git. I'll try this over the
weekend. Thanks for all your help!

Brent

no llegida,
25 de juny 2012, 17:37:0525/6/12
a beagl...@googlegroups.com
Robert,
 
I've tried compiling from the source you suggested (git://github.com/beagleboard/kernel.git), and I keep getting errors about not being able to find asm/leds.h.  Do you know anything about this?  Here is the output:
arch/arm/mach-versatile/core.c:42:22: fatal error: asm/leds.h: No such file or directory
compilation terminated.
make[1]: *** [arch/arm/mach-versatile/core.o] Error 1
make: *** [arch/arm/mach-versatile] Error 2
I've tried a different compilier and still no luck.
 

On Friday, June 22, 2012 4:35:56 PM UTC-4, RobertCNelson wrote:

Robert Nelson

no llegida,
25 de juny 2012, 17:42:2325/6/12
a beagl...@googlegroups.com
On Mon, Jun 25, 2012 at 4:37 PM, Brent <brent...@gmail.com> wrote:
> Robert,
>
> I've tried compiling from the source you suggested
> (git://github.com/beagleboard/kernel.git), and I keep getting errors about
> not being able to find asm/leds.h.  Do you know anything about this?  Here
> is the output:
> arch/arm/mach-versatile/core.c:42:22: fatal error: asm/leds.h: No such file

ah.. "mach-versatile"? It looks like you forgot to copy the defconfig
from patches/beagleboard/defconfig and save it as .config in kernel
directory right..

Brent

no llegida,
25 de juny 2012, 19:56:0825/6/12
a beagl...@googlegroups.com
Thanks, that helped a lot!  I had an issue about not finding the firmware, but I found your post here to resolve that one.
 
I feel like I'm seeing the light at the end of the tunnel.  Hopefully these are the last questions... Is the output in the arch/arm/boot/ directory?  Is there a procedure somewhere on how to get the files on the SD card?
 

On Monday, June 25, 2012 5:42:23 PM UTC-4, RobertCNelson wrote:

Robert Nelson

no llegida,
25 de juny 2012, 20:08:1125/6/12
a beagl...@googlegroups.com
On Mon, Jun 25, 2012 at 6:56 PM, Brent <brent...@gmail.com> wrote:
> Thanks, that helped a lot!  I had an issue about not finding the firmware,
> but I found your post here to resolve that one.
>
> I feel like I'm seeing the light at the end of the tunnel.  Hopefully
> these are the last questions... Is the output in the arch/arm/boot/
> directory?  Is there a procedure somewhere on how to get the files on the SD
> card?

Your going to copy the uImage to where your boot script looks for it..
(older looked in the fat16 partition, newer ones look under /boot/ on
the extX partition..)

For the modules just do:

make ARCH=arm CROSS_COMPILE=${CC} modules_install INSTALL_MOD_PATH=/media/rootfs

or wherever you have your mmc's rootfs mounted...

Brent

no llegida,
26 de juny 2012, 14:00:3526/6/12
a beagl...@googlegroups.com
Well, still more problems...   Going back to my very first post about adding can0 by typing "ip link add dev can0 type can", I still get the same error message.  However, vcan works just fine (I enabled this in the config as well).  I even tried marking yes to everything in the CAN section, but still no luck.  Am I missing something else?  My config is shown below:
 
#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
# CONFIG_HAMRADIO is not set
CONFIG_CAN=y
CONFIG_CAN_RAW=y
CONFIG_CAN_BCM=y
CONFIG_CAN_GW=m
#

# CAN Device Drivers
#
# CONFIG_CAN_VCAN is not set
# CONFIG_CAN_SLCAN is not set
CONFIG_CAN_DEV=y
CONFIG_CAN_CALC_BITTIMING=y
CONFIG_CAN_TI_HECC=y
# CONFIG_CAN_MCP251X is not set
# CONFIG_CAN_SJA1000 is not set
# CONFIG_CAN_C_CAN is not set
CONFIG_CAN_D_CAN=y
CONFIG_CAN_D_CAN_PLATFORM=y
#
# CAN USB interfaces
#
# CONFIG_CAN_EMS_USB is not set
# CONFIG_CAN_ESD_USB2 is not set
# CONFIG_CAN_SOFTING is not set
# CONFIG_CAN_DEBUG_DEVICES is not set

On Monday, June 25, 2012 8:08:11 PM UTC-4, RobertCNelson wrote:

Koen Kooi

no llegida,
26 de juny 2012, 15:51:2326/6/12
a beagl...@googlegroups.com
You need platform data to init the can bus. Or as has been popular recently, emulate a can cape with an eeprom :)

Brent C. Sink

no llegida,
26 de juny 2012, 16:17:0926/6/12
a beagl...@googlegroups.com
Platform data? I'm not familiar. I figured I could add an eeprom to
my cape to make this work, but if this can be fixed with software, I
would prefer that route.

Can you tell me how to initialize the can bus? Thanks,
--
-brent

Brent

no llegida,
26 de juny 2012, 22:53:3726/6/12
a beagl...@googlegroups.com
I may have it working now, but won't be able to test for sure until tomorrow.  can0 is now showing up... here is what I did:

Added these two lines somewhere in the beaglebone_cape_setup() function in the /arch/arm/mach-omap2/board-am335xevm.c file.
setup_pin_mux(uart1dcan1_pin_mux);
am33xx_d_can_init(1);

A bit of a hack, but it seems to have done the trick.  I'll know for sure when I plug it into my can bus tomorrow.
> beagleboard+unsubscribe@googlegroups.com

Brent

no llegida,
28 de juny 2012, 21:44:2228/6/12
a beagl...@googlegroups.com
Nope, not working.  I've been fighting this too long and I'm ready to give up.  I'll just order the cape from Tower Technologies and pay out the nose...

Brent

no llegida,
25 de jul. 2012, 13:21:1625/7/12
a beagl...@googlegroups.com
For anyone reading this post, the method I used to initialize the can bus did work.  I had a (very stupid) wiring problem which is why I thought it was not working.  I used a standard 3.3V CAN Transceiver: TI SN65HVD231 and everything works perfectly.

Brent

no llegida,
5 de des. 2012, 22:55:015/12/12
a beagl...@googlegroups.com
No, everything is working great.  Let me know if you have any problems.

On Thursday, November 15, 2012 7:38:07 AM UTC-5, Andrzej wrote:
Hi Brent!
I am planning to use CAN BUS in beaglebone. Do you have some troubles with can since your last messege?
> beagleboard...@googlegroups.com

captc...@gmail.com

no llegida,
3 d’oct. 2013, 23:50:303/10/13
a beagl...@googlegroups.com
Hello Brent,

Is it possible for you to share your schematic?

I have worked with other hardware platforms, but not the Beagleboard... 

Thanks
Chris
Respon a tots
Respon a l'autor
Reenvia
0 missatges nous