Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Searching the forum will give an explanation, sometimes Google is your best friend..... For short, replace "sudo armbian-add-overlay spi-h6-mcp2515.dts" with the following commands: dtc -@ -q -I dts -O dtb -o spi-h6-mcp2515.dtbo spi-h6-mcp2515.dts sudo nano /boot/armbianEnv.txt insert the line: user_overlays=spi-h6-mcp2515 write and exit nano sudo mkdir -p /boot/overlay-user sudo cp spi-h6-mcp2515.dtbo /boot/overlay-user/spi-h6-mcp2515.dtbo Reboot the OrangePi 3 and continue with check if the MCP2515 is recognized
  2. Hereby a tutorial to connect an MCP2515 based CAN bus interface to an OrangePi 3 running successfull with Buster minimal nightly with 5.3 kernel. It uses the attached user overlay only and doesn’t need any other overlay. Connections CAN module OPi3 26 pin header Raspberry CAN interface 40 pin header Vcc 3.3 CON12-P01 1 Gnd CON12-P06 6 MOSI CON12-P19 19 MISO CON12-P21 21 CLK CON12-P23 23 CS CON12-P24 24 INT CON12-P26 22 Optional 5V for Transceiver on cheap Chinese modules CON12-P02 Not used when equiped with a 3.3V transceiver Add the attached overlay with the command: sudo armbian-add-overlay spi-h6-mcp2515.dts The file /boot/armbianEnv.txt now contains a line: user_overlays=spi-h6-mcp2515 Reboot the OrangePi 3 Check if the MCP2515 is recognized: pi@orangepi3:~$ dmesg | grep mcp If properly connected it should return a line containing: mcp251x spi1.0 can0: MCP2515 successfully initialized. As stated a can0 interface should be generated check it with: pi@orangepi3:~$ sudo ifconfig -a Bring up the network: sudo ip link set can0 up type can bitrate 250000 Check if the interrupt is hooked: cat /proc/interrupts should return a line like this 46: 1 0 0 0 sunxi_pio_edge 8 Edge mcp251x Check for traffic on the CAN bus with candump from can-utils (sudo apt-get install can-utils) candump can0 spi-h6-mcp2515.dts
  3. Thank for replying. That was exactly the adjustment I made that successfully loaded the overlay. This modification ensures that can0 is created with some duplicate error. pi@orangepi3:~$ dmesg | grep spi||mcp [ 2.332200] sun6i-spi 5011000.spi: chipselect 0 already in use [ 2.332207] spi_master spi1: spi_device register error /soc/spi@5011000/spidev@0 [ 2.332216] spi_master spi1: Failed to create SPI device for /soc/spi@5011000/spidev@0 [ 6.059773] mcp251x spi1.0 can0: MCP2515 successfully initialized. [ 263.483858] mcp251x spi1.0: failed to acquire irq 0 The last log line is created with the command below: pi@orangepi3:~$ sudo ip link set can0 up type can bitrate 250000 replies with error message RTNETLINK answers: Invalid argument My armbianEnv.txt verbosity=1 console=both overlay_prefix=sun50i-h6 rootdev=UUID=31a66c72-3b09-4222-a0f2-0f02de01b719 rootfstype=ext4 overlays=spi-spidev1 user_overlays=spi-mcp2515 usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u My overlay: /dts-v1/; /plugin/; / { compatible = "allwinner,sun50i-h6"; fragment@0 { target-path = "/"; __overlay__ { 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 = "PD21"; function = "irq"; bias-pull-up; }; }; }; fragment@2 { target = <&spi1>; __overlay__ { status = "okay"; #address-cells = <1>; #size-cells = <0>; can0:mcp2515@0 { reg = <0>; compatible = "microchip,mcp2515"; pinctrl-names = "default"; pinctrl-0 = <&can0_pin_irq>; spi-max-frequency = <10000000>; interrupt-parent = <&pio>; interrupts = <3 21 2>; /* PD21 -> 0 7 2 = PA7 IRQ_TYPE_EDGE_FALLING */ clocks = <&can0_osc_fixed>; status = "okay"; }; }; }; }; Update: For Opi3 read:
  4. The overlay does not load because the device tree path does not contain the necessary path for the OPi3 and OPLite2 target-path = "/clocks"; Perhaps 1 of the DT maintainers is willing to fix this and include this clocks path in the H6 DT.
  5. Hi Laurens, My research focuses on connecting an MCP251x to an Orange Pi 3. I now have the /dev/sp1.0. This appeared after selecting in armbian-config -> system -> hardware -> spi-spidev1. But thats for spi1. The pi lite 2 has spi0 exposed, so select spi-spidev. Currently I am working on the overlay for mcp251x. Next week I´will expect to have an mcp2515 available to test the overlay. According to the documentation https://github.com/armbian/sunxi-DT-overlays in your overlay the following line is not correct: To me it sounds that PD21 must look like: interrupts = <3 21 2>; /* PD21 IRQ_TYPE_EDGE_FALLING */
  • Create New...