I have enable follow the steps of Jetson/TX2 SPI - eLinux.org
There is something different in the process. My myTX2DeviceTreeSource.dts is:
spi@3240000 {
compatible = “nvidia,tegra186-spi”;
reg = <0x0 0x3240000 0x0 0x10000>;
linux,phandle = <0x7d>;
phandle = <0x7d>;
spi@0 {
compatible = "spidev";
reg = <0x0>;
spi-max-frequency = <0x1312D00>;
nvidia,enable-hw-based-cs;
nvidia,cs-setup-clk-count = <0x1e>;
nvidia,cs-hold-clk-count = <0x1e>;
nvidia,rx-clk-tap-delay = <0x1f>;
nvidia,tx-clk-tap-delau = <0x0>;
};
};
while the file in the website is:
spi@3240000{
compatible = “nvidia,tegra186-spi”;
reg = <0x0 0x3240000 0x0 0x10000>;
…
linux,phandle = <0x80>;
spi@0 {
compatible = “spidev”;
reg = <0x0>;
spi-max-frequency = <0x1312D00>;
nvidia,enable-hw-based-cs;
nvidia,cs-setup-clk-count = <0x1e>;
nvidia,cs-hold-clk-count = <0x1e>;
nvidia,rx-clk-tap-delay = <0x1f>;
nvidia,tx-clk-tap-delau = <0x0>;
};
};
linux,phandle is different.
File spidev3.0 exists in the folder /dev.
When I open SPI:
static const char *device = “/dev/spidev3.0”;
_fd = open(device, O_RDWR);
_fd is always -1, and SPI cannot be opened.
How to slove the porblem? Thank you.