Austin Dubes Posted June 14 Posted June 14 Hello, I have been trying to interface with a MCP2518FD CAN controller using a RockPi 4b and have been encountering some issues. The specifications in which I want the CANbus to operate are as such: Baud: 250kb/s FD: OFF Other details: Oscillator: 40MHz SPI Bus: SPI1 (see below) The RockPi pins that are being used are the following (based on the standard pinout of the RockPi 4B https://wiki.radxa.com/Rock4/hardware/gpio) Pin #19 SPI1_TXD -> MOSI Pin #21 SPI1_RXD -> MISO Pin #23 SPI1_CLK -> SCK Pin #22 GPIO4_D5 -> INT Pin #24 SPI1_CSn -> CS I have tried various DT overlay files and most files don't even provide an output for the commands "dmesg | grep spi" or "dmesg | grep mcp" except for this overlay that gives me a response that chip select 0 is already in use: /dts-v1/; /plugin/; / { compatible = "rockchip,rockpi","rockchip,rk3399"; fragment@0 { target = <&pinctrl>; __overlay__ { mcp2518_int_pin: mcp2518_int_pin { rockchip,pins = <4 29 0 &pcfg_pull_none>; }; }; }; fragment@1 { target-path = "/"; __overlay__ { can_mcp2518_osc: can-mcp2518-osc { compatible = "fixed-clock"; clock-frequency = <40000000>; // Change to 40 MHz #clock-cells = <0>; }; }; }; fragment@2 { target = <&spi1>; __overlay__ { status = "okay"; max-frequency = <10000000>; // Keep it at 10 MHz #address-cells = <1>; #size-cells = <0>; can_mcp2518: can-mcp2518@0 { status = "okay"; compatible = "microchip,mcp2518"; reg = <0>; interrupt-parent = <&gpio4>; interrupts = <29 2>; spi-max-frequency = <10000000>; // Keep it at 10 MHz clocks = <&can_mcp2518_osc>; // Change to the new clock node vdd-supply = <&vcc3v3_sys>; xceiver-supply = <&vcc3v3_sys>; pinctrl-names = "default"; #pinctrl-0 = <&mcp2518_int_pin>; // Change to the new pin name }; }; }; }; And this is the specific message I get when I compile this DTS (via command "armbian-add-overlay") and reboot: root@rockpi-4b:~# dmesg | grep spi [ 1.522099] rockchip-spi ff1d0000.spi: chipselect 0 already in use [ 1.522115] spi_master spi1: spi_device register error /spi@ff1d0000/spidev@0 [ 1.522141] spi_master spi1: Failed to create SPI device for /spi@ff1d0000/spidev@0 And there is no response on dmesg | grep mcp or any can0 interface created on ifconfig.... The operating system in which I am running is 5.15.74-rockchip64 I have previously used this board to successfully interface with a MCP2515 @250Kb/s, but I am looking to upgrade to the 2518. I removed the previous DTBO and user-overlay from armbianEnv.txt. If anyone has any idea on what the issue may be or can walk me through step by step on how to set this up, I would greatly appreciate it. I am not great with linux, so please bear with me. if a solution involves installing a driver or rebuilding the kernel, I am not entirely sure on how to perform that, so any resource or information on this would be extremely helpful for me. Even if I have to start from a scratch image, this is okay. 0 Quote
Recommended Posts
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.