Jump to content

Austin Dubes

Members
  • Posts

    2
  • Joined

  • Last visited

Recent Profile Visitors

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

  1. 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.
  2. Hello all, I am trying to interface with the MCP2515 on SPI2 of the RockPi4B on Armbian 22.08.6 Bullseye with Linux 5.15.74-rockchip64 and encountering some issues. The rockpi4B pins that I am using to connect to the MCP2515 INT - GPIO2_A7 MOSI - GPIO2_B2 MISO - GPIO2_B1 CLK - GPIO2_B3 CS - GPIO2_B4 When using the overlay file that I have shown below, the output for "dmesg | grep mcp": [ 6.662536] rockchip-pinctrl pinctrl: unable to find group for node mcp2515_int_pin I have been able to get the MCP2515 to initialize successfully, but only if I comment out the pinctrl-0 reference to the mcp2515_int_pin in the overlay. Doing this I can bring up the device but I am only able to send/receive a few messages before candump shows it's not transmitting any messages until I bring down and up the can0 device where it will do the same thing. The interesting thing is, when the device doesn't communicate I can still see that the can0 device is still in the "Error-Active" mode, so theoretically I should still be able to interface with it. So, I am led to believe the issue I am encountering is due to that comment line to pinctrl-0 in the overlay. Just not sure of the solution to this. I have looked about just about every forum that makes reference to the MCP2515 and have not found any promising solutions. I have tried changing the target on fragment@0 to <&gpio>, <&gpio2>, etc. Here is a look at the DTS overlay I am using for the MCP2515: //This devicetree overlay is used for RS485 CAN HAT. /dts-v1/; /plugin/; / { compatible = "rockchip,rockpi","rockchip,rk3399", "rockchip,rk3399-pinctrl"; fragment@0 { target = <&pinctrl>; __overlay__ { mcp2515_int_pin: mcp2515_int_pin { rockchip,pins = <2 7 0 &pcfg_pull_none>; }; }; }; fragment@1 { target-path = "/"; __overlay__ { can_mcp2515_osc: can-mcp2515-osc { compatible = "fixed-clock"; clock-frequency = <16000000>; #clock-cells = <0>; }; }; }; fragment@2 { target = <&spi2>; __overlay__ { status = "okay"; max-freq = <10000000>; #address-cells = <1>; #size-cells = <0>; can_mcp2515: can-mcp2515@0 { status = "okay"; compatible = "microchip,mcp2515"; reg = <0>; interrupt-parent = <&gpio2>; interrupts = <7 2 8>; spi-max-frequency = <10000000>; clocks = <&can_mcp2515_osc>; vdd-supply = <&vcc3v3_sys>; xceiver-supply = <&vcc3v3_sys>; pinctrl-names = "default"; pinctrl-0 = <&mcp2515_int_pin>; }; }; }; }; And my armbianEnv.txt: verbosity=1 bootlogo=false overlay_prefix=rockchip fdtfile=rockchip/rk3399-rock-pi-4b.dtb rootdev=UUID=fa2cbc7c-56d1-448b-9ab3-fe864e21fbc5 rootfstype=ext4 overlays=spi-spidev param_spidev_spi_bus=1 user_overlays=spi1-mcp2515-can0-overlay usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u Here's a link to my armbianmonitor -u: https://paste.armbian.com/azameworos I would like to mention I not very skilled with Linux based devices so please bear with me. Any help would be greatly appreciated! Best, Austin
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines