I have successfully enabled SPI by[url] https://elinux.org/Jetson/TX2_SPI[/url].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.
HI ShaneCCC,thank you ,
How do I know if SPI_SLAVE mode is successfully turned on?
You may have log from the SPI host driver first and then connect the device to try it.
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.
Please use tegra124-spi-slave instead of tegra186-spi-slave
Thank you for your reply @ShaneCCC,
Unfortunately, it still can’t be used, and the error is the same as the original.
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?