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


Chris Tapp
 

I am trying to get a Waveshare CAN interface[1] running on an RPi4 using meta-raspberrypi with hardknott.

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



[1] https://www.waveshare.com/wiki/2-CH_CAN_HAT

--

Chris Tapp
opensource@...
www.keylevel.com

Join yocto@lists.yoctoproject.org to automatically receive all group messages.