Is there anyone who managed to bring the CAN bus to life on SPI with an mcp2515?
SPI2 connection:
Main header pin 19 MOSI
Main header pin 21 MISO
Main header pin 23 CLK
Main header pin 24 CS
Main header pin 22 INT
/boot/uEnv.txt:
overlays=rk3308-uart0 rk3308-spi-spidev
param_spidev_spi_bus=2
param_spidev_spi_cs=0
param_spidev_max_freq=1000000
In /dev already created spidev2.0
I tried to define device tree overlay but I can not compile
/boot/dtbs/$(uname -r)/rockchip/overlay/spi2-mcp2515-can0-overlay.dts:
/dts-v1/;
/plugin/;
/ {
compatible = ārockchip,rockpiā,ārockchip,rk3308ā;
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 = <&uart2>;
__overlay__ {
status = "disabled";
};
};
fragment@3 {
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>;
spi-max-frequency = <10000000>;
clocks = <&can_mcp2515_osc>;
vdd-supply = <&vcc3v3_sys>;
xceiver-supply = <&vcc3v3_sys>;
pinctrl-names = "default";
pinctrl-0 = <&mcp2515_int_pin>;
};
};
};
};
cmd: dtc -O dtbo -b 0 -o spi2-mcp2515-can0-overlay.dtbo spi2-mcp2515-can0-overlay.dts
resp:
spi2-mcp2515-can0-overlay.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
spi2-mcp2515-can0-overlay.dtbo: Warning (unit_address_vs_reg): Node /fragment@1 has a unit name, but no reg property
spi2-mcp2515-can0-overlay.dtbo: Warning (unit_address_vs_reg): Node /fragment@2 has a unit name, but no reg property
spi2-mcp2515-can0-overlay.dtbo: Warning (unit_address_vs_reg): Node /fragment@3 has a unit name, but no reg property
dtc: livetree.c:521: get_node_by_phandle: Assertion `(phandle != 0) && (phandle != -1)ā failed.
Aborted
I am stucked here. If you can help please give it a try.