AnsweredAssumed Answered

Using SPI (&ecspi1) on iMX6ULL-EVK

Question asked by Popo Nopo on Jan 18, 2018
Latest reply on Jan 18, 2018 by igorpadykov

Hello. I need your assistance in using SPI (&ecspi1) on iMX6ULL-EVK board I got.

 

The steps I've taken:

1) cloned & compiled Linux kernel version 4.1.15 from the "linux-imx" branch.

It boots and runs fine as far as I can tell.

2) manually altered the "imx6ull-14x14-evk.dts" device tree to add the following:

&iomuxc {

/* skip */

 

pinctrl_ecspi1: ecspi1grp {
fsl,pins = <
MX6UL_PAD_CSI_DATA04__ECSPI1_SCLK 0x1b088
MX6UL_PAD_CSI_DATA05__ECSPI1_SS0 0x1b088
MX6UL_PAD_CSI_DATA06__ECSPI1_MOSI 0x1b088
MX6UL_PAD_CSI_DATA07__ECSPI1_MISO 0x1b088
>;
};

 

/* skip */

};

 

/ * And at the very bottom */

 

&ecspi1 {
fsl,spi-num-chipselects = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi1>;
status = "okay";
spidev@0x00 {
compatible = "spidev";
spi-max-frequency = <20000000>;
reg = <0>;
};

};

I see a /dev/spidev0.0 device being created and when I test it with the spidev_test.c utility (taken from this blog post) it produces expected results:

root@imx6ull:~# ./spidev_test
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)

00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00

However, when I short MISO and MOSI pins, the output doesn't change (still all zeroes). My guess is I've incorrectly mapped the MISO pin in the device tree.

 

Here's related dmesg output:

root@imx6ull:~# dmesg | grep spi
[ 1.210672] fsl-quadspi 21e0000.qspi: n25q256a (32768 Kbytes)
[ 1.222921] spi_gpio spi4: gpio-miso property not found, switching to no-rx mode
[ 1.232862] spidev spi0.0: buggy DT: spidev listed directly in DT
[ 1.241057] WARNING: CPU: 0 PID: 1 at drivers/spi/spidev.c:731 spidev_probe+0x1a4/0x1c0()
[ 1.288293] [<800368e8>] (warn_slowpath_null) from [<804296bc>] (spidev_probe+0x1a4/0x1c0)
[ 1.295338] [<804296bc>] (spidev_probe) from [<80427504>] (spi_drv_probe+0x50/0x74)
[ 1.301781] [<80427504>] (spi_drv_probe) from [<803857b8>] (driver_probe_device+0x174/0x2ac)
[ 1.336540] [<80383028>] (device_add) from [<80427c30>] (spi_add_device+0x98/0x130)
[ 1.342975] [<80427c30>] (spi_add_device) from [<80429118>] (spi_register_master+0x5c0/0x70c)
[ 1.350234] [<80429118>] (spi_register_master) from [<8042a7c8>] (spi_bitbang_start+0x9c/0x108)
[ 1.357710] [<8042a7c8>] (spi_bitbang_start) from [<8042c6ac>] (spi_imx_probe+0x3ec/0x654)
[ 1.364757] [<8042c6ac>] (spi_imx_probe) from [<80386f28>] (platform_drv_probe+0x44/0xac)
[ 1.438856] spi_imx 2008000.ecspi: probed

 

Appreciate any help or advice you could give me. I'm somewhat poking in the dark here so if you could keep it simple it would be great!

 

Thanks.

Outcomes