IMX6 Linux SPI Slave mode not running

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX6 Linux SPI Slave mode not running

Jump to solution
3,001 Views
Yavuz
Contributor III

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

 

0 Kudos
Reply
1 Solution
7 Replies
2,988 Views
Yavuz
Contributor III

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

 

0 Kudos
Reply
2,925 Views
Yavuz
Contributor III

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. 

0 Kudos
Reply
2,996 Views
igorpadykov
NXP Employee
NXP Employee

Hi Yavuz

 

what bsp used in the case, one can try latest as described on link

https://community.nxp.com/t5/i-MX-Processors/Which-imx-linux-version-shall-be-selected-for-porting-S...

 

Best regards
igor

0 Kudos
Reply
2,985 Views
Yavuz
Contributor III

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

0 Kudos
Reply
2,979 Views
igorpadykov
NXP Employee
NXP Employee
0 Kudos
Reply
2,965 Views
Yavuz
Contributor III

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. 

0 Kudos
Reply