start with PCAN-USB FD on Raspberry Pi 3, but get error

This forum covers PCAN-Linux and Linux development issues concerning our products
Locked
stahlstngel
Posts: 10
Joined: Thu 28. Apr 2016, 18:24

start with PCAN-USB FD on Raspberry Pi 3, but get error

Post by stahlstngel » Fri 29. Apr 2016, 09:58

Hello,

i hope the category accords.

I setup the PCAN-USB FD on my Rpi3 and successfully compiled the netdev driver. I have no ECU to communicate now.....so i just terminated the CAN-Bus as you can see in the attachment (60 OHM and no Bus cable) for testing the adapter.

But:
I when i plug it in (LED: green), type "sudo ifconfig can0 up" and enter (LED: green blinking) and then write to the CAN-Bus "./cangen" or "./cansend" i get the error below (LED fast red blinking).

What do i also need to make the run the first simple tests?

Code: Select all

------------------------------------------ERROR-------------------------------------------------
*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Beta____20160324_n (8.0.20) Apr 21 2016 20:02:42 --------------
*---------------------------- [mod] [usb] [net] -----------------------------
*--------------------- 1 interfaces @ major 243 found -----------------------
*n -type-  -ndev--base- irq  --btr-    --read--    --write-   --irqs--   -errors-      status
32  usbfd   can0        0 000 0x001c 0001a4d2 00000020 00000010 00000002 0x000c
--------------------------------------------------------------------------------------------------


Then i updated the adapter to firmware 2.2.1 as mentioned in a other topic.

Since this.....the adapter blinks red also after a "sudo ifconfig can0 down"+"sudo ifconfig can0 up".
Before i could fix the red blinking with this 2 commands. But now i have plug-out and plug in again.

How do i "reset" the adapter, because plug-out and plug-in is no option?


SYSTEM:
RPi3

Code: Select all

$ uname -a
Linux RPi 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux
$ cat /proc/net/can/version
rev 20120528 abi 9
Attachments
CAN-Termination
CAN-Termination
RTEmagicC_D-Sub_Male_RedLine_68.png (2.47 KiB) Viewed 13163 times

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: start with PCAN-USB FD on Raspberry Pi 3, but get error

Post by M.Maidhof » Fri 29. Apr 2016, 11:48

Hi,

to have a working CAN system, you need at least two active CAN nodes, otherwise a communication is not possible, due to the missing acknowledge bit on the CAN frame.

It will be better to use our Linux category for such RPI/Linux questions.

regards

Michael

stahlstngel
Posts: 10
Joined: Thu 28. Apr 2016, 18:24

Re: start with PCAN-USB FD on Raspberry Pi 3, but get error

Post by stahlstngel » Fri 29. Apr 2016, 12:36

Okay, i wanna check this.

Thanks for now.

User avatar
O.Hartkopp
Posts: 40
Joined: Fri 22. Nov 2013, 19:47

Re: start with PCAN-USB FD on Raspberry Pi 3, but get error

Post by O.Hartkopp » Sun 8. May 2016, 18:57

When you want to use the SocketCAN tools like cansend and candump ... why did you use the separate PEAK-Linux driver then??

Since Linux 4.0 the PCAN USB FD adapters are supported by Mainline Linux. So your Linux 4.1 Kernel should run with the SocketCAN tools out-of-the-box when attaching the CAN USB FD adapter, see:
http://www.peak-system.com/forum/viewto ... 177&t=1296

Using the separate PEAK Linux driver only makes sense when you want to use the chardev programming API from (potentially existing?) chardev programs.

Regards
Oliver

User avatar
O.Hartkopp
Posts: 40
Joined: Fri 22. Nov 2013, 19:47

Re: start with PCAN-USB FD on Raspberry Pi 3, but get error

Post by O.Hartkopp » Sun 8. May 2016, 20:19

How do i "reset" the adapter, because plug-out and plug-in is no option?
Besides the fact that you need to have a second CAN node which acknowledges your sent CAN frames (as Michael already noted) you can use the

Code: Select all

restart-ms 200
option when you use the SocketCAN configuration tool 'ip'.

When an adapter goes into BUS-OFF it gets restarted after e.g. 200ms.
See chapter 6.5 here https://www.kernel.org/doc/Documentatio ... ng/can.txt

Regards,
Oliver

stahlstngel
Posts: 10
Joined: Thu 28. Apr 2016, 18:24

Re: start with PCAN-USB FD on Raspberry Pi 3, but get error

Post by stahlstngel » Tue 10. May 2016, 11:31

Thanks for your tips. Indeed with a second ECU it worked without errors.

The other problem was that the kernel option for the netdev was not set. That was the reason why i used the separate PEAK-Linux driver to activate the kernel option.


Thanks for your help.

stahlstngel
Posts: 10
Joined: Thu 28. Apr 2016, 18:24

Re: start with PCAN-USB FD on Raspberry Pi 3, but get error

Post by stahlstngel » Tue 10. May 2016, 11:35

But how do i close this topic?

-- Thread closed ---

Locked