CAN hangs on RaspberryPi

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
hardwic
Posts: 4
Joined: Tue 16. Apr 2019, 10:54

CAN hangs on RaspberryPi

Post by hardwic » Tue 16. Apr 2019, 11:05

I am using a USB-CAN which is supplied by Victron but is a PCAN device on Rpi 3 b+ with 4.14.98-v7+

I compiled the kernel drivers that shipped with OS.
The CAN bus hangs every few hours:

Code: Select all

[166262.423367] can: request_module (can-proto-0) failed.
[166361.167539] can: request_module (can-proto-0) failed.
[166756.355582] can: request_module (can-proto-0) failed.
[173719.782304] peak_usb 1-1.1.2:1.0 can0: bus-off
If I bounce the interface, it works again.
I tried 2 different USB adapters and it does the same.

Any ideas what I have wrong?
Last edited by M.Gerber on Tue 16. Apr 2019, 11:40, edited 1 time in total.
Reason: Created new thread using this posting. Inserted [code] tags for improved readability.

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: CAN hangs on RaspberryPi

Post by S.Grosjean » Tue 16. Apr 2019, 16:58

Hi,

Please type:

Code: Select all

$ ip -s -d link show can0
Check if the bitrate is ok with the other equipments connected to the bus.

Next, regarding:

Code: Select all

can: request_module (can-proto-0) failed.
Looks like some socket-can module (can-raw ?) is not loaded. Please type:

Code: Select all

$ lsmod | grep can
Regards,
— Stéphane

hardwic
Posts: 4
Joined: Tue 16. Apr 2019, 10:54

Re: CAN hangs on RaspberryPi

Post by hardwic » Thu 18. Apr 2019, 10:03

Code: Select all

ip -s -d link show can0
4: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
    link/can  promiscuity 0 
    can state ERROR-ACTIVE restart-ms 0 
	  bitrate 250000 sample-point 0.875 
	  tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
	  pcan_usb: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
	  clock 8000000
	  re-started bus-errors arbit-lost error-warn error-pass bus-off
	  0          0          0          3          1          1         numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
    RX: bytes  packets  errors  dropped overrun mcast   
    84823468   10686522 1       144     1       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    1459391    231552   0       0       0       0   
I see a few error warnings etc, not sure if this is bad.
The interface was running at 500kbs but I dropped it to 250kbs.
The interface runs for days at times but then seem to hang. If you restart it with ifdown/ifup, it works again.

For "lsmod | grep can", I get

Code: Select all

lsmod | grep can
can_bcm                24576  0
can_raw                20480  3
can                    28672  2 can_raw,can_bcm
can_dev                28672  1 peak_usb

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: CAN hangs on RaspberryPi

Post by S.Grosjean » Thu 18. Apr 2019, 14:07

Hi,

Please be sure to use a power supply with enough power for both RPi and PCAN-USB. You can check for the yellow lightening bolt on the screen, which will show up when a undervoltage is detected.

Regards,
— Stéphane

hardwic
Posts: 4
Joined: Tue 16. Apr 2019, 10:54

Re: CAN hangs on RaspberryPi

Post by hardwic » Thu 18. Apr 2019, 15:45

Aha.. I am running off a bench power supply at 5.1v and the supply can deliver 10A if required.
But the wire to the usb connector on the Pi is a bit this and long and the voltdrop maybe an issue.

let me try shortening that and testing again. Thanks
Last edited by M.Gerber on Thu 18. Apr 2019, 16:43, edited 1 time in total.
Reason: Removed full quote of preceding post.

hardwic
Posts: 4
Joined: Tue 16. Apr 2019, 10:54

Re: CAN hangs on RaspberryPi

Post by hardwic » Fri 19. Apr 2019, 09:52

OK that nailed the problem.Thanks

Post Reply