Hi everybody,
I have an IMX6 linux system which is compiled via yocto provided by nxp.
I want to use SPI Slave mode. My IMX6 is an SPI slave with CPHA=1, CPOL=0 and external system has a Clock of 15MHz.
My Device tree is as follows:
imx6qdl.dtsi:
ecspi3: spi@2010000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";
reg = <0x02010000 0x4000>;
interrupts = <0 33 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6QDL_CLK_ECSPI3>,
<&clks IMX6QDL_CLK_ECSPI3>;
clock-names = "ipg", "per";
dmas = <&sdma 7 7 1>, <&sdma 8 7 2>;
dma-names = "rx", "tx";
status = "disabled";
};
imx6qdl-sabresd.dtsi
&ecspi3 {
/*fsl,spi-num-chipselects = <1>;*/
cs-gpios = <&gpio4 24 0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi3>;
spi-slave; /*empty attriute to mark spi as slave*/
status = "okay";
};
I added spidev_test -> to yocto recipes
I added slave :
- echo spidev > /sys/class/spi_slave/spi2/slave
the by using the spidev_test I tried to test:
- spidev_test -v -D /dev/spidev2.0 -s 15000000 -p abc
but the transfer is blocked.
spi mode: 0x1
bits per word: 8
max speed: 15000000 Hz (15000 KHz)
Any suggestions ? ?
Best Regards
Solved! Go to Solution.
for ecspi slave one also can look at:
https://community.nxp.com/t5/i-MX-Processors/i-MX6-SPI-Slave-mode/m-p/289544
http://billauer.co.il/blog/2017/08/nxp-freescale-spi-slave/
Best regards
igor
Hi,
uname -a gives
Linux imx6dlsabresd 5.4.3+gf8118585ee3c #9 SMP PREEMPT Wed Sep 30 04:23:27 PDT 2020 arm71 GNU/Linux
Regards
Hello,
I finally succeeded to read something from spi in slave mode, although there is still problem with the content of the data, I think for this topic the issue is solved.
Thank you very much @igorpadykov .
Best Regards.
Y.
Hi Yavuz
what bsp used in the case, one can try latest as described on link
Best regards
igor
Hi,
linux kernel 5.4.3,
i guess that is the correct version which supports linux spi slave mode support for imx6.
Do you agree ?
Regards
it is not kernel 5.4.3 :
L5.4.24
https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/spi/spi-imx.c?h=imx_5.4.24_2.1.0
Best regards
igor
Hello ,
The spi-imx.c content was exactly the same (linux diff result) but anyway i have followed the path you suggest to switch to kernel 5.4.24_2.1.0.
I have downloaded the the git repository :
https://source.codeaurora.org/external/imx/linux-imx and checkout the branch "imx_5.4.24_2.1.0"
build the kernel, get the zImage then loaded that to my target
now "uname -a gives the following result" :
Linux imx6dlsabresd 5.4.24-00060-gbabac008e5cf #1 SMP PREEMPT Wed Sep 30 23:12:33 PDT 2020 arm71 GNU/Linux
the only difference i see after using this new kernel is:
when i perform:
# echo spidev > /sys/class/spi_slave/spi2/slave
The output is:
imx6q-pcie lffc00.pcie: could not get pcie-phy
imx_usb 2184200.usb: No overcurrent polarity is defined
first line is new, second line was existent on previous kernel version also
So the problem seems to continue.
Any Suggestions
Regards.