Hello,
first of all I want to apologize in case this request is already resolved somewhere, but honestly I looked around a lot and found nothing related that can be used.
We made some experimens with socket can on raspberry and as evidence of our tests the implementation is not reliable.
So we would like to try can4linux.
I followed the insstructions provided but I'm unable to run properly examples.
Below what we have:
raspberry with version r4.9.30-v7+
source downloaded from svn co https://svn.code.sf.net/p/can4linux/code/trunk
I'm working with revision 566
TARGET=RASPI
first of all I encountered some errors because warning as treated as errors
I aplogize once again. This is the first time I use this application. Adding the attachmemnt the and pressing save I submitted the post only partially. I adde further info here below.
Since the warnings were really minor I simply remove dthese kinds of warning to be treated as errors and succesfully compiled.
Then I tried to find a suitable conf file but I didn't find any specific for Raspberry (I'm using mcp2515 board, a common http://skpang.co.uk/catalog/pican2-canbus-board-for-raspberry-pi-23-p-1475.html).
I choose 1-PCM3680.conf but I'm not 100% sure naming the fiel as raspberrypi.conf since uname -n returns raspberrypi.
Then I run make inodes succesfuly.
I also compiled succesfully examples (some warnings).
So I have everything it seems ok.
But when I run can_send withou arguments I get:
open error 22;/dev/can1: Invalid argument
And when I run can_send -D can0 I get a lot of:
Message from syslogd@raspberrypi at Jun 4 12:27:40 ...
kernel:[ 3601.609712] df00: b8d5df3c b8d5df10 8028fcc4 8028f450 00000802 00000802 b6d9a000 00000000
And after this when I retry to run can_send -D can0 agai I get:
open error 16;/dev/can0: Device or resource busy
What are the wrong steps in the procedure I'm applying.
Thanks for your support.
Massimo
First of all, it has been one or two years ago I used can4linux on the first version of the Raspberry. What I can say, it worked, but you can not reach a high performance regarding the use of the SPI protocol. I could only use it up to 125kbit/s in order to handle high bus loads on the receiver side.
May be it is better now with a Raspberry 3.
I just tested compiling 'make TARGET=RASPI' on my desktop system with compiler gcc version 4.8.5 (SUSE Linux) it compiles without any warning, don't ask me why.
For targets like the Raspberry, you don't need these .conf mechanism. It was once used for ISA boards where you couls set tha base address and IRQ by jumpers. no need here. it is fixed for Raspy in source code.
Regarding the lot of messages in please check if it is compiled using debug output active. in core.c should be code like
If you need debug output, enable it by
If you can not start can_send a second time, something went wrong when sending. enable debug code in syslog and check the output carefully.
Regads
Last edit: Heinz-Jürgen Oertel 2017-06-04
Hello Heinz,
1st of all thanks for replying.
I forgot to detail that I'm using R. 3. I hope performance will not be a problem once I'll successfully run can_send (I hope).
About conf file, so I'm going to remove my file since it is not used.
About messages, core.c already has #if 0.... so proc_dbgmask as defined in debug.c should be 0.
echo 7 > /proc/sys/dev/Can/dbgMask is performed by "make load"; I'm going to remove it to avoid messages.
I'll make othe tests and post results here.
For now thanks and regards
Massimo
Hello Heinz,
same error.
I attach messages from var log.
this happen running both can_send or ctest.
examples $ ./ctest
using CAN device /dev/can0
Message from syslogd@raspberrypi at Jun 4 21:00:22 ...
kernel:[ 209.646838] Internal error: Oops: 817 [#1] SMP ARM
Segmentation fault
Message from syslogd@raspberrypi at Jun 4 21:00:22 ...
kernel:[ 209.647110] Process ctest (pid: 1267, stack limit = 0xb45ec210)
this happens with or without following lines in /boot/config.txt
dtparam=spi=on
dtoverlay=spi-bcm2835
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=mcp2515-can1,oscillator=16000000,interrupt=24
Related
Support Requests:
#1Sorry, will need some more time, One remark, I'm not sure if the driver already is using the device tree information, max be addresses are fixed. Please enabele debug code in syslog and send me the last lines with the segmentation fault and the lines before.
Hello Heinz.
I apologize but robably I'm not enough expert.
If you mean enabling debugging putting 7 on /proc/sys/dev/Can/dbgMask I did it.
Attached what I see.
In summary here below whet I do:
$ sudo make load
and then run
./can_send -D can0
this is the output:
Segmentation fault
Message from syslogd@raspberrypi at Jun 7 00:12:41 ...
kernel:[ 348.786884] Internal error: Oops: 817 [#1] SMP ARM
Message from syslogd@raspberrypi at Jun 7 00:12:41 ...
kernel:[ 348.787138] Process can_send (pid: 1284, stack limit = 0xb9990210)
Message from syslogd@raspberrypi at Jun 7 00:12:41 ...
kernel:[ 348.787149] Stack: (0xb9991c68 to 0xb9992000)
Is there something different I should do? I'm available, just explain me what to do.
Thanks
Massimo
Related
Support Requests:
#1I also attach the whole /var/log/messages of the test
according to the log:
Jun 7 00:51:19 raspberrypi kernel: [ 769.109386] PC is at mutex_lock_slowpath+0x80/0x164
Jun 7 00:51:19 raspberrypi kernel: [ 769.109408] LR is at mutex_lock_slowpath+0x54/0x164
Jun 7 00:51:19 raspberrypi kernel: [ 769.109421] pc : [<80715d88>] lr : [<80715d5c>] psr: a0000013
it looks like the problem ist with the lock()/unlock()
mcp2515funcs. line 529
In your syslog:
Jun 7 00:20:05 raspberrypi kernel: [ 3.293328] CAN device driver interface
Jun 7 00:20:05 raspberrypi kernel: [ 3.353891] mcp251x spi0.1 can0: MCP2515 successfully initialized.
Jun 7 00:20:05 raspberrypi kernel: [ 3.365609] mcp251x spi0.0 can1: MCP2515 successfully initialized.
Not sure if this is the reason, but this conflicts with can4linux. Your Raspi loads automatically the SocketCAN driver. Before loading can4linux, you schould unload all Socketcan modules, at least the MCP2515 related.
do
$ lsmod
and look for modules like 'can_dev' and 'mcp2515...' and unload them.
$ sudo unload can_dev mcp2515
By the way, do you need two CAN channels, two mcp2515 supported?
can4linux currently supports only one.
Last edit: Heinz-Jürgen Oertel 2017-06-07
Hello Heinz,
first of all thanks for your support.
I'll make the tests you are proposing and let you know.
I would need 2 channels (because I have 2).
After I will see the first channel working properly I'll maybe discuss with you (and if I can help I'm available) how to add the support of the second.
I'll keep you posted.
Thanks
Massimo
Hello Heinz,
I retried first removing from /boot/config.txt lines ans see lsmod.
See attachmente as in attachment configTxt-lsmod-can_send.txt -
There's not anymore can_dev and mcp251x
So I perfomed steps (make inodes and make load).
Run can_send -D can0 . Same results (see configTxt-lsmod-can_send.txt)
see related /var/log/messages
don't know what to remove anymore. Any suggestions?
Last edit: Massimo Dardano 2017-06-07