G’day All,
I’ve been trying to use the Xavier NX to control a chip over spi, but cannot seem to configure it properly. Specifically, we require the cs line to drop low every 2-bytes (16-bits) and some other clock timing parameters, but can’t seem to get any settings to work. The spidev loopback test works, but the chip-select only toggles for the full message rather than on a per n-byte basis.
Any help would be appreciated.
The current approach is to use jetson-io to generate an overlay to enable spi, and then modify it. The current overlay looks like:
~/src/device_trees/spi_overlay.dts
/ {
jetson-header-name = "Jetson 40pin Header";
overlay-name = "User Custom [2023-01-20-095732]";
compatible = "nvidia,p3509-0000+p3668-0000\0nvidia,p3509-0000+p3668-0001";
fragment@1 {
target-path = "/spi@3210000/spi@0";
__overlay__ {
compatible = "linux,spidev";
controller-data {
// nvidia,enable-hw-based-cs = <0x01>; // defaults
// nvidia,tx-clk-tap-delay = <0x00>; // defaults
// nvidia,rx-clk-tap-delay = <0x10>; // defaults
nvidia,cs-setup-clk-count = <0x02>;
// nvidia,cs-hold-clk-count = <0x05>;
// nvidia,cs-inactive-cycles = <0x06>;
// nvidia,clk-delay-between-packets = <0x07>;
};
};
};
fragment@0 {
target = <0xffffffff>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <0x01>;
exp-header-pinmux {
phandle = <0x01>;
hdr40-pin19 {
nvidia,pins = "spi1_mosi_pz5";
nvidia,function = "spi1";
nvidia,pull = <0x01>;
nvidia,tristate = <0x00>;
nvidia,enable-input = <0x01>;
nvidia,lpdr = <0x00>;
};
hdr40-pin21 {
nvidia,pins = "spi1_miso_pz4";
nvidia,function = "spi1";
nvidia,pull = <0x01>;
nvidia,tristate = <0x00>;
nvidia,enable-input = <0x01>;
nvidia,lpdr = <0x00>;
};
hdr40-pin23 {
nvidia,pins = "spi1_sck_pz3";
nvidia,function = "spi1";
nvidia,pull = <0x01>;
nvidia,tristate = <0x00>;
nvidia,enable-input = <0x01>;
nvidia,lpdr = <0x00>;
};
hdr40-pin24 {
nvidia,pins = "spi1_cs0_pz6";
nvidia,function = "spi1";
nvidia,pull = <0x02>;
nvidia,tristate = <0x00>;
nvidia,enable-input = <0x01>;
nvidia,lpdr = <0x00>;
};
hdr40-pin26 {
nvidia,pins = "spi1_cs1_pz7";
nvidia,function = "spi1";
nvidia,pull = <0x02>;
nvidia,tristate = <0x00>;
nvidia,enable-input = <0x01>;
nvidia,lpdr = <0x00>;
};
};
};
};
__symbols__ {
jetson_io_pinmux = "/fragment@0/__overlay__/exp-header-pinmux";
};
__fixups__ {
pinmux = "/fragment@0:target:0";
};
__local_fixups__ {
fragment@0 {
__overlay__ {
pinctrl-0 = <0x00>;
};
};
};
};
Cheers,
Jacob