2010-04-15 08:21:42     Missing CAN-Interface / can0 in ifconfig

Document created by Aaronwu Employee on Aug 21, 2013
Version 1Show Document
  • View in full screen mode

2010-04-15 08:21:42     Missing CAN-Interface / can0 in ifconfig

Marian Cichy (GERMANY)

Message: 88450   

 

Hey there,

 

I'm using the Bluetechnix CM-BF548 and loaded the 2.6.28.10-ADI-2009R1.1 uCLinux Kernel on it. I'm trying to run the CAN-Interface which is also implementend and connected on the board. Since I'm relatively new to this, I'm using the "trial 'n error"-method to solve my problems but got stuck now completely.

 

In the menuconfig before compiling the kernel I added the can4linux driver found at  'Device Drivers -> Character devices -> CAN, the car bus and industrial fieldbus'. While connected with minicom on the board I can't find a method to work with CAN. I located the driver in '/lib/modules/2.6.28.10-ADI-2009R1.1/kernel/drivers/char/can4linux/can.ko'. When using 'insmod ./can.ko' it says

 

can: module is already loaded                                                                     

insmod: cannot insert './can.ko': Invalid argument

 

'modprobe can' also says

 

can: module is already loaded                                                                     

modprobe: Failed to load module can: Invalid argument.         

 

'rmmod ./can.ko' puts

 

rmmod: cannot unload 'can': unknown symbol in module, or unknown parameter

 

same with 'modprobe -r can'

 

modprobe: Failed to unload module can: unknown symbol in module, or unknown parameter.

 

'ifconfig -a' doesn't print any can0 interface. in /bin I found the command 'can_send', which gives

 

open error 2;/dev/can0: No such file or directory

 

'ifconfig can0 up' says

 

can0: unknown interface: No such device

 

shall also be no permission-problem since I can up and down eth0.

 

I'd be glad if someone can give me a hint to the right direction.

TranslateQuoteReplyEditDelete

 

 

2010-04-15 08:45:34     Missing CAN-Interface / can0 in ifconfig

Michael Hennerich (GERMANY)

Message: 88451    drivers/char/can4linux/can is depreciated and outdated - it was never a SocketCAN Network driver.

 

  docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:can_module

 

You need to follow the instructions here:

 

  docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:bfin_can

 

-Michael

QuoteReplyEditDelete

 

 

2010-04-15 11:05:01     Re: Missing CAN-Interface / can0 in ifconfig

Marian Cichy (GERMANY)

Message: 88456   

 

Hello,

 

Thanks for the reply. After I downloaded the newest kernel I got now the new options in "CAN Bus System Support" at the Kernel Configuration like I can see on the documentation. But at "Configure Application -> Network Applications" there is nothing like "SocketCAN Utilities" or anything similar I can choose. I tried with uClinux-dist-2009R1.1-RC4 and uClinux-dist-20100315. Is there anything I foolishly forgot?

 

 

 

regards

TranslateQuoteReplyEditDelete

 

 

2010-04-15 11:25:20     Re: Missing CAN-Interface / can0 in ifconfig

Michael Hennerich (GERMANY)

Message: 88458    It should be in the uclinux-dist from svn trunk.

 

config USER_CAN_UTILS

bool "SocketCAN utilities"

help

SocketCAN utilities.

 

So uClinux-dist-20100315 should have it.

 

-Michael

QuoteReplyEditDelete

 

 

2010-04-16 09:43:18     Re: Missing CAN-Interface / can0 in ifconfig

Marian Cichy (GERMANY)

Message: 88520   

 

Yes, it is in the svn trunk Dist. However, it is definitely not in the uCLinux-dist-20100315

 

~/Downloads/uClinux-dist/user$ cat Kconfig | grep USER_CAN

config USER_CAN_EXAMPLES

config USER_CAN_HORCH

 

So I'm using now the svn trunk (I Don't even know the differences). I followed the instructions and activated SocketCAN and iproute2. The Kernel boots fine, unfortunately I still have problems, kind of the same.

 

 

 

modprobe [-v] bfin-can doesn't print anything out (while it seems this doesn't mean that it can't fine the module, bfin-can foo for example prints "module foo not found in modules.dep).

 

further commands, ip link set can0 type can bitrate 125000 and ifconfig can0 up aren't working either (No such device).

 

the other commands seems to work, so the system knows 'cansend' and 'candump' (but these commands needs of course an interface which isn't there).

 

Do I need to have a real working connection on my board to see an interface on the terminal? At the moment, there 2 phone cables connected to CAN+ and CAN- going to a CAN/USB Device from Peak-Systems which isn't configurated yet.

 

Sorry, if it gets annoying, but this seems to be a very confusing part for me.

TranslateQuoteReplyEditDelete

 

 

2010-04-16 09:49:49     Re: Missing CAN-Interface / can0 in ifconfig

Michael Hennerich (GERMANY)

Message: 88521    Your CM-BF548 platform file is probably missing the CAN resources.

Take a look at linux/arch/Blackfin/mach-bf548/boards/ezkit

 

Add CONFIG CAN_BFIN related stuff to linux/arch/blackfin/mach-bf548/boards/cm-bf548.c

 

#if defined(CONFIG CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)

unsigned short bfin_can_peripherals[] = {

P_CAN0_RX, P_CAN0_TX, 0

};

 

static struct resource bfin_can_resources[] = {

{

.start = 0xFFC02A00,

.end = 0xFFC02FFF,

.flags = IORESOURCE_MEM,

},

{

.start = IRQ_CAN0_RX,

.end = IRQ_CAN0_RX,

.flags = IORESOURCE_IRQ,

},

{

.start = IRQ_CAN0_TX,

.end = IRQ_CAN0_TX,

.flags = IORESOURCE_IRQ,

},

{

.start = IRQ_CAN0_ERROR,

.end = IRQ_CAN0_ERROR,

.flags = IORESOURCE_IRQ,

},

};

 

static struct platform_device bfin_can_device = {

.name = "bfin_can",

.num_resources = ARRAY_SIZE(bfin_can_resources),

.resource = bfin_can_resources,

.dev = {

.platform_data = &bfin_can_peripherals, /* Passed to driver */

},

};

#endif

 

-Michael

QuoteReplyEditDelete

 

 

2010-04-20 10:38:02     Re: Missing CAN-Interface / can0 in ifconfig

Marian Cichy (GERMANY)

Message: 88651   

 

No, nothing changed. The define you posted wasn't in the cm_bf548.c (it is now) but it was already in the ezkit.c before. However, same problem still exist.

 

I looked through the make-log and found two warnings. Maybe they are relevant to this, I don't know.

 

 

 

libtool: install: warning: remember to run `libtool --finish /usr/lib' (I didn't installed any more libs, but I also didn't see any advice that I should do so)

 

Warning: you may need to install module-init-tools (I'm especially wondering to this since modutils->modprobe/insmod/rmmod are definitely installed)

 

 

 

Further I should mention that I'm using the CM-BF548 with HW Rev 0.1. It is the one with the anomalies and which isn't actually supported. I deactived the checks for this, because I can live with some random read/write errors, which could happen at this one. However, I hope it won't be the reason of this problem.

TranslateQuoteReplyEditDelete

 

 

2010-04-20 15:42:35     Re: Missing CAN-Interface / can0 in ifconfig

Mike Frysinger (UNITED STATES)

Message: 88662   

 

the warnings are not relevant, and nothing you enable in uclinux-dist has any bearing on can0 existing.

 

you cant just add structs to the board config ... you also need to hook them in.  if `ifconfig -a` isnt showing can#, then either your kernel is misconfigured, or you havent enabled/loaded drivers, or you need to check your board resources.  Michael has fixed cm_bf548.c in svn so you can check the changes needed there.

QuoteReplyEditDelete

 

 

2010-04-26 08:26:51     Re: Missing CAN-Interface / can0 in ifconfig

Marian Cichy (GERMANY)

Message: 88901   

 

Yes, okay, that fixed the problem. Thank you both very much for the help, everything works great now.

Attachments

    Outcomes