Orange Pi / MCP2515 / "ip up" freezes


Recommended Posts

I'm trying to get an MCP2515 working with an Orange Pi Zero LTS H2+.  Everything seems to go well until I try to bring up the can0 interface using the command 

ip link set can0 up type can bitrate 500000

 

Once the command is entered, it never returns.  Control+C doesn't do help.  New SSH sessions fail to start, but pinging the IP address works fine.  Trying 

ifconfig

from the serial terminal will also fail to return.

 

Trying to shutdown after the "ip link set..." command, the shutdown procedure takes a long time, and eventually sends 

 

[ 4320.026984] systemd-shutdown[1]: Waiting for process: ifdown, wpa_supplicant, NetworkManager, ip

 

The image was built using the git clone and config commands, per https://docs.armbian.com/Developer-Guide_Build-Preparation/, using a Lubuntu VM.  Image is "Current", "Ubuntu Focal".

 

The overlay was based on https://github.com/armbian/sunxi-DT-overlays/blob/master/examples/spi-mcp251x.dts, with 

target = <&spi0>;

changed to

target = <&spi1>;

 

In dmesg, the MCP2515 appears to be working

mcp251x spi1.0 can0: MCP2515 successfully initialized.

 

Any tips on how to debug?

Link to post
Share on other sites
Want Armbian t-shirt or a cup?

I have same issue.

 

cat /boot/armbianEnv.txt

verbosity=1
bootlogo=false
console=serial
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
overlays=spi-add-cs1 spi-spidev usbhost2 usbhost3
param_spidev_spi_bus=1
param_spidev_spi_cs=1
rootdev=UUID=442e3394-ebc5-4a14-82f8-235d74d6b2e5
rootfstype=ext4
user_overlays=spi-mcp251x
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

 

 

cat spi-mcp251x.dts

/dts-v1/;
/plugin/;

/ {
	compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";

	fragment@0 {
		target-path = "/clocks";
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <1>;
			can0_osc_fixed: can0_osc_fixed {
				compatible = "fixed-clock";
				#clock-cells = <0>;
				clock-frequency  = <8000000>;
			};
		};
	};

	fragment@1 {
		target = <&pio>;
		__overlay__ {
			can0_pin_irq: can0_pin_irq {
				pins = "PA7";
				function = "irq";
				bias-pull-up;
			};
		};
	};

	fragment@2 {
		target = <&spi1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";
			mcp2515 {
				reg = <0>;
				compatible = "microchip,mcp2515";
				pinctrl-names = "default";
				pinctrl-0 = <&can0_pin_irq>;
				spi-max-frequency = <10000000>;
				interrupt-parent = <&pio>;
				interrupts = <0 7 2>; /* PA7 IRQ_TYPE_EDGE_FALLING */
				clocks = <&can0_osc_fixed>;
				status = "okay";
			};
		};
	};
};

 

Pins:

https://forum.mysensors.org/uploads/files/1483990620622-orange-pi-zero-description.jpg

 

cat /etc/armbian-release

BOARD=orangepizero
BOARD_NAME="Orange Pi Zero"
BOARDFAMILY=sun8i
BUILD_REPOSITORY_URL=https://github.com/armbian/build
BUILD_REPOSITORY_COMMIT=e6fa811d-dirty
DISTRIBUTION_CODENAME=buster
DISTRIBUTION_STATUS=supported
VERSION=20.08.1
LINUXFAMILY=sunxi
BRANCH=current
ARCH=arm
IMAGE_TYPE=stable
BOARD_TYPE=conf
INITRD_ARCH=arm
KERNEL_IMAGE_TYPE=Image

 

ip -s -d link show can0

3: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
    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 4000000
	  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 overrun mcast   
    0          0        0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    0          0        0       0       0       0   

 

After command sudo ip link set can0 up type can bitrate 125000:

new conn to ssh - no

sudo -s  - no

netstat - no

 

but new windows in tmux - working

 

Edited by mav
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...