I’m not entirely sure where to start to describe the issue. I would say I’m new to this, but I kinda know my way around, it’s just that all the different pieces haven’t come together in my head. The issue I’m having is that I got a fresh TX2 NX with the OS unmodified. I was going through some forums and resources to add the spidev driver and then recompile the kernel, along with modifying the device tree. After sometime I looked at the the device tree in the OS that’s already there and it looks like SPI was already there, and the spidev.ko file was already in the drivers folder. So it seems like I should be good to go without having to do anything. What I had to do to get the spidev devices to show up is use modprobe and add spidev to a list to load the spidev.ko driver on boot.
I have spidev0.0, 0.1, 1.0, and 1.1. I wrote a program to write out to SPI and do a loopback test but I get nothing back on any of the spidevs. I also tried to download and use spidev-tools https://github.com/cpb-/spi-tools to manually write out data and print out what I get back and I still get nothing.
I tried looking at the MOSI and CS lines on an oscilloscope and nothing happens, infact, MOSI and CS are always LOW when CS should at least be HIGH. I’m thinking there must be something I’m missing somewhere in the kernel or device tree that could be causing this. I do have a voltage level translator between the TX2 NX and the external connector translating from 1.8v to 3.3v however, I know it works because I also have a UART on that same chip and it’s able to access the terminal through USB to UART adaptor.
Here is what I have for spi in device tree:
spi@7000d400 {
compatible = "nvidia,tegra210-spi";
reg = <0x0 0x7000d400 0x0 0x200>;
interrupts = <0x0 0x3b 0x4>;
iommus = <0x30 0xe>;
#address-cells = <0x1>;
#size-cells = <0x0>;
dmas = <0x51 0xf 0x51 0xf>;
dma-names = "rx", "tx";
nvidia,clk-parents = "pll_p", "clk_m";
clocks = <0x26 0x29 0x26 0xf3 0x26 0xe9>;
clock-names = "spi", "pll_p", "clk_m";
resets = <0x26 0x29>;
reset-names = "spi";
status = "okay";
linux,phandle = <0xf8>;
phandle = <0xf8>;
prod-settings {
#prod-cells = <0x3>;
prod {
prod = <0x4 0xfff 0x0>;
};
prod_c_flash {
status = "disabled";
prod = <0x4 0x3f 0x7>;
};
prod_c_loop {
status = "disabled";
prod = <0x4 0xfff 0x44b>;
};
};
spi@0 {
compatible = "tegra-spidev";
reg = <0x0>;
spi-max-frequency = <0x1f78a40>;
controller-data {
nvidia,enable-hw-based-cs;
nvidia,cs-setup-clk-count = <0x1e>;
nvidia,cs-hold-clk-count = <0x1e>;
nvidia,rx-clk-tap-delay = <0x7>;
nvidia,tx-clk-tap-delay = <0x0>;
};
};
spi@1 {
compatible = "tegra-spidev";
reg = <0x1>;
spi-max-frequency = <0x1f78a40>;
controller-data {
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x7>;
};
};
};
spi@7000d600 {
compatible = "nvidia,tegra210-spi";
reg = <0x0 0x7000d600 0x0 0x200>;
interrupts = <0x0 0x52 0x4>;
iommus = <0x30 0xe>;
#address-cells = <0x1>;
#size-cells = <0x0>;
dmas = <0x51 0x10 0x51 0x10>;
dma-names = "rx", "tx";
nvidia,clk-parents = "pll_p", "clk_m";
clocks = <0x26 0x2c 0x26 0xf3 0x26 0xe9>;
clock-names = "spi", "pll_p", "clk_m";
resets = <0x26 0x2c>;
reset-names = "spi";
status = "okay";
linux,phandle = <0xf9>;
phandle = <0xf9>;
prod-settings {
#prod-cells = <0x3>;
prod {
prod = <0x4 0xfff 0x0>;
};
prod_c_flash {
status = "disabled";
prod = <0x4 0x3f 0x6>;
};
prod_c_loop {
status = "disabled";
prod = <0x4 0xfff 0x44b>;
};
};
spi@0 {
compatible = "tegra-spidev";
reg = <0x0>;
spi-max-frequency = <0x1f78a40>;
controller-data {
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x6>;
};
};
spi@1 {
compatible = "tegra-spidev";
reg = <0x1>;
spi-max-frequency = <0x1f78a40>;
controller-data {
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x6>;
};
};
};
spi@7000d800 {
compatible = "nvidia,tegra210-spi";
reg = <0x0 0x7000d800 0x0 0x200>;
interrupts = <0x0 0x53 0x4>;
iommus = <0x30 0xe>;
#address-cells = <0x1>;
#size-cells = <0x0>;
dmas = <0x51 0x11 0x51 0x11>;
dma-names = "rx", "tx";
nvidia,clk-parents = "pll_p", "clk_m";
clocks = <0x26 0x2e 0x26 0xf3 0x26 0xe9>;
clock-names = "spi", "pll_p", "clk_m";
resets = <0x26 0x2e>;
reset-names = "spi";
status = "okay";
linux,phandle = <0xfa>;
phandle = <0xfa>;
prod-settings {
#prod-cells = <0x3>;
prod {
prod = <0x4 0xfff 0x0>;
};
prod_c_flash {
status = "disabled";
prod = <0x4 0x3f 0x8>;
};
prod_c_loop {
status = "disabled";
prod = <0x4 0xfff 0x44b>;
};
};
};
spi@7000da00 {
compatible = "nvidia,tegra210-spi";
reg = <0x0 0x7000da00 0x0 0x200>;
interrupts = <0x0 0x5d 0x4>;
iommus = <0x30 0xe>;
#address-cells = <0x1>;
#size-cells = <0x0>;
dmas = <0x51 0x12 0x51 0x12>;
dma-names = "rx", "tx";
nvidia,clk-parents = "pll_p", "clk_m";
clocks = <0x26 0x44 0x26 0xf3 0x26 0xe9>;
clock-names = "spi", "pll_p", "clk_m";
resets = <0x26 0x44>;
reset-names = "spi";
status = "okay";
spi-max-frequency = <0xb71b00>;
linux,phandle = <0xfb>;
phandle = <0xfb>;
prod-settings {
#prod-cells = <0x3>;
prod {
prod = <0x4 0xfff 0x0>;
};
prod_c_flash {
status = "disabled";
prod = <0x4 0xfff 0x44b>;
};
prod_c_cs0 {
prod = <0x4 0xfc0 0x400>;
};
};