Hi, how can I set SPI mode to slave on Jetson nano?
I only found discussions about jetson xavier nx.
Any solutions for Jetson nano? Thanks!
Modify the device tree to add compatible = “nvidia,tegra210-spi-slave”, and configure the SPI pinmux by jetson-io
Hi, I got syntax error when adding compatible = “nvidia,tegra210-spi-slave”.
My step is (follow here):
1.
$ sudo /opt/nvidia/jetson-io/config-by-function.py -o dtbo spi1
Configuration saved to /boot/tegra210-p3448-0000-p3449-0000-b00-user-custom.dtbo.
$ dtc -I dtb -O dts -o my-overlay.dts /boot/tegra210-p3448-0000-p3449-0000-b00-user-custom.dtbo
my-overlay.dts: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
my-overlay.dts: Warning (unit_address_vs_reg): Node /local_fixups/fragment@0 has a unit name, but no reg property
- Modify
my-overlay.dts
as
/dts-v1/;
/ {
overlay-name = “User Custom [2021-03-09-150612]”;
compatible = “nvidia,p3449-0000-b00+p3448-0000-b00”, “nvidia,p3449-0000-a02+p3448-0000-a02”, “nvidia,tegra210-spi-slave”;fragment@0 {
target = <0xffffffff>;__overlay__ { pinctrl-names = "default"; pinctrl-0 = <0x1>; header-40pin-pinmux { linux,phandle = <0x1>; phandle = <0x1>; pin3 { nvidia,function = "i2c2"; nvidia,pins = "gen2_i2c_sda_pj3"; nvidia,pull = <0x0>; nvidia,tristate = <0x0>; nvidia,enable-input = <0x1>; nvidia,io-high-voltage = <0x1>; }; pin5 { nvidia,function = "i2c2"; nvidia,pins = "gen2_i2c_scl_pj2"; nvidia,pull = <0x0>; nvidia,tristate = <0x0>; nvidia,enable-input = <0x1>; nvidia,io-high-voltage = <0x1>; }; pin8 { nvidia,function = "uartb"; nvidia,pins = "uart2_tx_pg0"; nvidia,pull = <0x0>; nvidia,tristate = <0x0>; nvidia,enable-input = <0x0>; }; pin10 { nvidia,function = "uartb"; nvidia,pins = "uart2_rx_pg1"; nvidia,pull = <0x2>; nvidia,tristate = <0x1>; nvidia,enable-input = <0x1>; }; pin19 { nvidia,function = "spi1"; nvidia,pins = "spi1_mosi_pc0"; nvidia,pull = <0x1>; nvidia,tristate = <0x0>; nvidia,enable-input = <0x1>; }; pin21 { nvidia,function = "spi1"; nvidia,pins = "spi1_miso_pc1"; nvidia,pull = <0x1>; nvidia,tristate = <0x0>; nvidia,enable-input = <0x1>; }; pin23 { nvidia,function = "spi1"; nvidia,pins = "spi1_sck_pc2"; nvidia,pull = <0x1>; nvidia,tristate = <0x0>; nvidia,enable-input = <0x1>; }; pin24 { nvidia,function = "spi1"; nvidia,pins = "spi1_cs0_pc3"; nvidia,pull = <0x2>; nvidia,tristate = <0x0>; nvidia,enable-input = <0x1>; }; pin26 { nvidia,function = "spi1"; nvidia,pins = "spi1_cs1_pc4"; nvidia,pull = <0x2>; nvidia,tristate = <0x0>; nvidia,enable-input = <0x1>; }; pin27 { nvidia,function = "i2c1"; nvidia,pins = "gen1_i2c_sda_pj0"; nvidia,pull = <0x0>; nvidia,tristate = <0x0>; nvidia,enable-input = <0x1>; nvidia,io-high-voltage = <0x1>; }; pin28 { nvidia,function = "i2c1"; nvidia,pins = "gen1_i2c_scl_pj1"; nvidia,pull = <0x0>; nvidia,tristate = <0x0>; nvidia,enable-input = <0x1>; nvidia,io-high-voltage = <0x1>; }; }; };
};
symbols {
hdr40_pinmux = “/fragment@0/overlay/header-40pin-pinmux”;
};fixups {
pinmux = “/fragment@0:target:0”;
};local_fixups {
fragment@0 { __overlay__ { pinctrl-0 = <0x0>; }; };
};
};
$ dtc -O dtb -o my-overlay.dtbo -@ my-overlay.dts
Error: my-overlay.dts:5.101-102 syntax error
FATAL ERROR: Unable to parse input tree
Where did I do wrong?
You need add it under the spi@xxxx scope.
Do I need to add spi@xxxx by myself?
I didn’t find it in my-overlay.dts
I would suggest to use full kernel source to build it instead using dtc.