# How to Enable SPI Slave mode for TX2i under L4T R28.2???

**URL:** <https://forums.developer.nvidia.com/t/how-to-enable-spi-slave-mode-for-tx2i-under-l4t-r28-2/80994>\
**Category:** Jetson TX2\
**Created:** [September 2, 2019, 9:28am UTC](https://forums.developer.nvidia.com/t/how-to-enable-spi-slave-mode-for-tx2i-under-l4t-r28-2/80994 "2019-09-02T09:28:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Linuxgogo](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Linuxgogo](https://forums.developer.nvidia.com/u/Linuxgogo)\
**Post date:** [September 2, 2019, 9:28am UTC](https://forums.developer.nvidia.com/t/how-to-enable-spi-slave-mode-for-tx2i-under-l4t-r28-2/80994/1 "2019-09-02T09:28:16Z")

</div>

I have successfully enabled SPI by[url] [https://elinux.org/Jetson/TX2\_SPI[/url].Then,I](https://elinux.org/Jetson/TX2_SPI%5B/url%5D.Then,I) want Enable the SPI to Slave mode,but I don’t know how to do?

I have the following questions for enabling SPI slave:  
(1). What DTB changes are needed to configure a SPI bus as slave instead of master?  
(2). How should I use SPI to communicate with two TX2I to test that SPI can be used normally?

Thanks in advanced for any input.

---

<div class="post-metadata">

**Author:** ![ShaneCCC](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/shaneccc/32/14043_2.png) [@ShaneCCC](https://forums.developer.nvidia.com/u/ShaneCCC)\
**Post date:** [September 3, 2019, 2:02am UTC](https://forums.developer.nvidia.com/t/how-to-enable-spi-slave-mode-for-tx2i-under-l4t-r28-2/80994/2 "2019-09-03T02:02:41Z")

</div>

Have a check below document  
[url][https://github.com/arter97/android\_kernel\_nvidia\_shieldtablet/blob/master/Documentation/devicetree/bindings/spi/nvidia%2Cspi-slave-tegra124.txt[/url]](https://github.com/arter97/android_kernel_nvidia_shieldtablet/blob/master/Documentation/devicetree/bindings/spi/nvidia%2Cspi-slave-tegra124.txt%5B/url%5D)

---

<div class="post-metadata">

**Author:** ![Linuxgogo](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Linuxgogo](https://forums.developer.nvidia.com/u/Linuxgogo)\
**Post date:** [September 3, 2019, 9:39am UTC](https://forums.developer.nvidia.com/t/how-to-enable-spi-slave-mode-for-tx2i-under-l4t-r28-2/80994/3 "2019-09-03T09:39:02Z")

</div>

HI ShaneCCC,thank you ,  
How do I know if SPI\_SLAVE mode is successfully turned on?

---

<div class="post-metadata">

**Author:** ![ShaneCCC](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/shaneccc/32/14043_2.png) [@ShaneCCC](https://forums.developer.nvidia.com/u/ShaneCCC)\
**Post date:** [September 4, 2019, 2:58am UTC](https://forums.developer.nvidia.com/t/how-to-enable-spi-slave-mode-for-tx2i-under-l4t-r28-2/80994/4 "2019-09-04T02:58:13Z")

</div>

You may have log from the SPI host driver first and then connect the device to try it.

---

<div class="post-metadata">

**Author:** ![Linuxgogo](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Linuxgogo](https://forums.developer.nvidia.com/u/Linuxgogo)\
**Post date:** [September 4, 2019, 3:44am UTC](https://forums.developer.nvidia.com/t/how-to-enable-spi-slave-mode-for-tx2i-under-l4t-r28-2/80994/5 "2019-09-04T03:44:16Z")

</div>

thank you @ShaneCCC,but it not work,  
this is my dts  
spi@3240000 {  
reg = \<0x0 0x3240000 0x0 0x10000\>;  
dmas = \<0x18 0x12 0x18 0x12\>;  
interrupts = \<0x0 0x27 0x4\>;  
compatible = “nvidia,tegra186-spi-slave”;  
clock-names = “spi”, “pll\_p”, “clk\_m”;  
reset-names = “spi”;  
clocks = \<0xd 0x4a 0xd 0x10d 0xd 0x261\>;  
nvidia,dma-request-selector = \<0x18 0x12\>;  
resets = \<0xd 0x2b\>;  
status = “okay”;  
#address-cells = \<0x1\>;  
phandle = \<0x7d\>;  
nvidia,clk-parents = “pll\_p”, “clk\_m”;  
#stream-id-cells = \<0x1\>;  
#size-cells = \<0x0\>;  
dma-names = “rx”, “tx”;  
linux,phandle = \<0x7d\>;

```
	spi@0 {
		reg = <0x0>;
		compatible = "spidev";
		spi-max-frequency = <0x1312d00>;
	};
};

```

this is Boot log  
nvidia@tegra-ubuntu:/usr/src/kernel/kernel-4.4/Documentation/devicetree/bindings/spi$ dmesg | grep spi  
[0.278381] iommu: Adding device 3210000.spi to group 6  
[0.278778] iommu: Adding device c260000.spi to group 7  
[0.279144] iommu: Adding device 3240000.spi to group 8  
[2.680130] spi-tegra114 3210000.spi: Static pin configuration used  
[2.680634] spi-tegra114 c260000.spi: Static pin configuration used  
[2.681485] spi-tegra124-slave 3240000.spi: Probe Deferred, ret -517  
[3.969343] spi-tegra114 3210000.spi: Static pin configuration used  
[3.970130] spi-tegra114 c260000.spi: Static pin configuration used

this is error

nvidia@tegra-ubuntu:~$ gcc spidev\_test.c  
nvidia@tegra-ubuntu:~$ sudo ./a.out -D /dev/spidev3.0 -4 -v  
[sudo] password for nvidia:  
spi mode: 0x0  
bits per word: 8  
max speed: 500000 Hz (500 KHz)  
can’t send spi message: Invalid argument  
Aborted (core dumped)

Thanks in advanced for any input.

---

<div class="post-metadata">

**Author:** ![ShaneCCC](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/shaneccc/32/14043_2.png) [@ShaneCCC](https://forums.developer.nvidia.com/u/ShaneCCC)\
**Post date:** [September 4, 2019, 3:52am UTC](https://forums.developer.nvidia.com/t/how-to-enable-spi-slave-mode-for-tx2i-under-l4t-r28-2/80994/6 "2019-09-04T03:52:19Z")

</div>

Please use tegra124-spi-slave instead of tegra186-spi-slave

---

<div class="post-metadata">

**Author:** ![Linuxgogo](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Linuxgogo](https://forums.developer.nvidia.com/u/Linuxgogo)\
**Post date:** [September 4, 2019, 4:04am UTC](https://forums.developer.nvidia.com/t/how-to-enable-spi-slave-mode-for-tx2i-under-l4t-r28-2/80994/7 "2019-09-04T04:04:14Z")

</div>

Thank you for your reply @ShaneCCC,  
Unfortunately, it still can’t be used, and the error is the same as the original.

---

<div class="post-metadata">

**Author:** ![Linuxgogo](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Linuxgogo](https://forums.developer.nvidia.com/u/Linuxgogo)\
**Post date:** [September 4, 2019, 4:17am UTC](https://forums.developer.nvidia.com/t/how-to-enable-spi-slave-mode-for-tx2i-under-l4t-r28-2/80994/8 "2019-09-04T04:17:45Z")

</div>

HI ShaneCCC ,  
[2.681485] spi-tegra124-slave 3240000.spi: Probe Deferred, ret -517  
this error is from Init dma parame In spi-tegra124.slave.c,Is this a problem there?
