Re: Meta-respberrypi socketcan - how do I bring up the interfaces?

Stephen John Smoogen

On Thu, 30 Sept 2021 at 05:21, Chris Tapp <opensource@...> wrote:

I am trying to get a Waveshare CAN interface[1] running on an RPi4 using meta-raspberrypi with hardknott.
I am looking at getting one of these so do not have final answers.
However looking at

The STOPPED state indicates that the device is detecting some sort of
error and can not continue. My guess is that the iproute2 command
tried to bring things up and found the bus in a non-workable state or
too many errors. For other buses this could be due to non-termination
(aka is the CAN bus connected to anything?) For some buses they have a
'self-termination' if the leads do not have the voltages/resistance on
the end. Others will fail (like removing the end terminator on a
thinwire ethernet network or not having a good loop on one of the
RS422? networks (memory is fuzzy if this is the one or it was a
different one))

Sorry I can't be of more help.

I have added ENABLE_SPI_BUS = “1” and ENABLE_DUAL_CAN = “1” to my local.conf and see the following at boot:

[ 2.858284] CAN device driver interface
[ 2.879431] mcp251x spi0.1 can0: MCP2515 successfully initialized.
[ 2.891019] mcp251x spi0.0 can1: MCP2515 successfully initialized.
[ 176.170231] can: controller area network core
[ 176.178987] can: raw protocol

So, the interfaces are detected.

However, I cannot bring the interfaces up. I am expecting to use something like:

ip link set can0 up type can bitrate 1000000
ifconfig can0 up

But that results in :

ip: either "dev" is duplicate, or "type" is garbage

This appears to be due to the ‘ip’ command not working with Busybox, so I tried adding iproute2 to the image, but the command then hangs the system.

I have tried skipping the ‘ip’ command, but ifconfig then reports:

ifconfig: SIOCSIFFLAGS: Invalid argument

I can get some information for the interface:

ip -s -d link show can0
link/can promiscuity 0 minmtu 0 maxmtu 0
can state STOPPED restart-ms 0
mcp251x: tseg1 3..16 tseg2 2..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 0 0 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
RX: bytes packets errors dropped missed mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0

What do I need to do to bring the interface up?




Chris Tapp

Stephen J Smoogen.
I've seen things you people wouldn't believe. Flame wars in
sci.astro.orion. I have seen SPAM filters overload because of Godwin's
Law. All those moments will be lost in time... like posts on a BBS...
time to shutdown -h now.

Join to automatically receive all group messages.