i.MX 8M Nano DDR4 EVK as SPI slave

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

i.MX 8M Nano DDR4 EVK as SPI slave

682 Views
username1
Contributor I

Hello,

I've been trying to use i.MX 8M Nano DDR4 evaluation kit as an SPI slave, with Raspberry Pi operating as the master. In our yocto layer, I have enabled the ECSPI2 interface with a patch that adds following entiries to imx8mn-ddr4-evk.dts device tree file.

pinctrl_ecspi2: ecspi2grp {
fsl,pins = <
MX8MN_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0x156
MX8MN_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0x156
MX8MN_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0x156
MX8MN_IOMUXC_ECSPI2_SS0_ECSPI2_SS0 0x116
>;
};

...

&ecspi2 {
 fsl,spi-num-chipselects = <1>;
 pinctrl-names = "default";
 pinctrl-0 = <&pinctrl_ecspi2>;
 status = "okay";
 spi-slave;

 slave {
 compatible = "spidev";
 };
};


In the setup the master is constantly sending random data to the bus, and the slave can either read or write. After uploading the image to the board, whenever I try to read or write something from the spidev interface, the following error message pops in the kernel log:

root@imx8mnddr4evk:~# echo test > /dev/spidev1.0
root@imx8mnddr4evk:~# dmesg | grep spi
[ 1.212298] /soc@0/bus@30800000/spi@30830000/slave: buggy DT: spidev listed directly in DT
[ 1.220615] WARNING: CPU: 0 PID: 1 at drivers/spi/spidev.c:736 spidev_probe+0x104/0x220
[ 1.249862] pc : spidev_probe+0x104/0x220
[ 1.253869] lr : spidev_probe+0x104/0x220
[ 1.343303] spidev_probe+0x104/0x220
[ 1.346967] spi_drv_probe+0x7c/0xd8
[ 1.381750] spi_add_device+0xf0/0x1d0
[ 1.385499] of_register_spi_device+0x204/0x3c8
[ 1.390029] spi_register_controller+0x43c/0x790
[ 1.394645] spi_bitbang_start+0x34/0x80
[ 1.398567] spi_imx_probe+0x448/0x6a8
[ 1.441711] spi_imx_driver_init+0x1c/0x24
[ 1.465856] spi_imx 30830000.spi: probed
[ 1.470822] spi-nor spi3.0: n25q256ax1 (32768 Kbytes)
[ 78.914612] spi_imx 30830000.spi: cannot set clock freq: 0 (base freq: 50000000)

 
If I enable spi-slave-time kernel module instead of spidev (which should just read the bus constantly and send the uptime if something is received), the kernel log gets filled with the same error message. This also happens if the master is not interacting with the slave.

root@imx8mnddr4evk:~# echo spi-slave-time > /sys/class/spi_slave/spi1/slave
root@imx8mnddr4evk:~# dmesg | grep spi | tail
[  303.978159] spi_imx 30830000.spi: cannot set clock freq: 0 (base freq: 50000000)
[  303.985613] spi_imx 30830000.spi: cannot set clock freq: 0 (base freq: 50000000)
[  303.993087] spi_imx 30830000.spi: cannot set clock freq: 0 (base freq: 50000000)
[  304.000530] spi_imx 30830000.spi: cannot set clock freq: 0 (base freq: 50000000)
[  304.007981] spi_imx 30830000.spi: cannot set clock freq: 0 (base freq: 50000000)
[  304.015433] spi_imx 30830000.spi: cannot set clock freq: 0 (base freq: 50000000)
[  304.022889] spi_imx 30830000.spi: cannot set clock freq: 0 (base freq: 50000000)
[  304.030362] spi_imx 30830000.spi: cannot set clock freq: 0 (base freq: 50000000)
[  304.037816] spi_imx 30830000.spi: cannot set clock freq: 0 (base freq: 50000000)
[  304.045321] spi_imx 30830000.spi: cannot set clock freq: 0 (base freq: 50000000)


So my question is, how do I get rid of this error? Is there some additional configuration I need to make to get the SPI slave running?

Labels (2)
2 Replies

621 Views
user1234
Contributor I

I am facing similar issue. Did you find out anything?

0 Kudos

615 Views
username1
Contributor I

Hi,

Unfortunately, we haven't been able to solve this issue yet. But we will let you know if we find out anything. Also please let us know if you are able to solve this first.

BR

0 Kudos