Hello,
I’m trying to interface CAN chip MCP2515 with Nano. I’m using L4T 32.2.1.
There are two SPI buses out from Nano that are connected to two MCP2515 on our carrier.
I’ve interfaced MCP2515 with TX1, TX2 for our other carriers in the past.
But I’m not able to make progress for Nano. I’ve the following device tree
#include “tegra210-porg-p3448-common.dtsi”
#include “porg-platforms/tegra210-porg-pinmux-p3448-0000-a02.dtsi”
#include “porg-platforms/tegra210-porg-gpio-p3448-0000-a02.dtsi”
/ {
model = “NVIDIA Jetson Nano Developer Kit”;
compatible = “nvidia,jetson-nano”, “nvidia,tegra210”;
nvidia,dtsfilename = FILE;
sdhci@700b0600 { /* SDMMC4 for EMMC */
status = "okay";
};
sdhci@700b0000 { /* SDMMC1 for SD card */
status = "okay";
};
spi@70410000 { /* QSPI */
status = "disabled";
};
can_clock: can_clock{
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <20000000>;
clock-accuracy = <100>;
};
spi@7000d400 {
status = "okay";
can@0 {
status = "okay";
compatible = "microchip,mcp2515";
reg = <0>; /* spi chip select 0 */
clocks = <&can_clock>;
interrupt-parent = <&gpio>;
/* the first cell defines the
index of the interrupt within the controller, while the second cell is used
to specify any of the following flags:
- bits[3:0] trigger type and level flags
1 = low-to-high edge triggered
2 = high-to-low edge triggered
4 = active high level-sensitive
8 = active low level-sensitive
*/
interrupts = <TEGRA_GPIO(P, 6) 0x01>;
vdd-supply = <&battery_reg>;
xceiver-supply = <&battery_reg>;
spi-max-frequency=<24000000>;
};
};
spi@7000d600 {
status = "okay";
can@0 {
status = "okay";
compatible = "microchip,mcp2515";
reg = <0>; /* spi chip select 0 */
clocks = <&can_clock>;
interrupt-parent = <&gpio>;
/* the first cell defines the
index of the interrupt within the controller, while the second cell is used
to specify any of the following flags:
- bits[3:0] trigger type and level flags
1 = low-to-high edge triggered
2 = high-to-low edge triggered
4 = active high level-sensitive
8 = active low level-sensitive
*/
interrupts = <TEGRA_GPIO(P, 2) 0x01>;
vdd-supply = <&battery_reg>;
xceiver-supply = <&battery_reg>;
spi-max-frequency=<24000000>;
};
};
gpio@6000d000 {
/* gpio-name for 40-pin header, gpio-name given as COL(10) x ROW(20) */
gpio-line-names = "", "", "", "", "", "", "", "", "", "",
"", "", "SPI1_MOSI", "SPI1_MISO", "SPI1_SCK", "SPI1_CS0", "SPI0_MOSI", "SPI0_MISO", "SPI0_SCK", "SPI0_CS0",
"SPI0_CS1", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "GPIO13", "",
"", "", "", "", "", "", "", "", "", "",
"UART1_RTS", "UART1_CTS", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "I2S0_FS", "I2S0_DIN", "I2S0_DOUT", "I2S0_SCLK",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "GPIO01",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "GPIO07", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "GPIO12", "", "", "", "", "",
"GPIO11", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "GPIO09", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "SPI1_CS1", "", "", "", "", "", "", "";
};
};
I see the following in the dmesg due to SPI transaction fail during driver probe.
[ 1.073870] mcp251x spi0.0: Cannot initialize MCP2515. Wrong wiring?
[ 1.080343] mcp251x spi0.0: Probe failed, err=19
[ 1.095922] mcp251x spi1.0: Cannot initialize MCP2515. Wrong wiring?
[ 1.102326] mcp251x spi1.0: Probe failed, err=19
I’ve a scope connected to SPI clock and data to see the transaction and I see no activity.
So, the bus is not prepared properly in device tree for SPI transaction.
Any help is appreciated.
Thanks,
Hakim