imx8mq-evk ecspi2 with spidev

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

imx8mq-evk ecspi2 with spidev

491 Views
CHOIzee
Contributor II

I tried to use ecspi1&2 via /dev/spidev0.0&1.0

So I added bellowed text on my imx8mq-evk.dts file.

=======================================================

&ecspi1{

  fsl,spi-num-chipselects = <1>;

  pinctrl-names = "default";

  pinctrl-0 = <&pinctrl_ecspi1>;

    cs-gpios = <&jgpio5 9 GPIO_ACTIVE_LOW>;

  status = "okay";

    cy14b@0{

      reg = <0>;

      compatible = "linux,spidev";

      spi-max-frequency = <40000000>;

  };

};

 

&ecspi2{

  fsl,spi-num-chipselects = <1>;

  pinctrl-names = "default";

  pinctrl-0 = <&pinctrl_ecspi1>;

    cs-gpios = <&jgpio5 13 GPIO_ACTIVE_LOW>;

  status = "okay";

    hitest@0{

      reg = <0>;

      compatible = "linux,spidev";

      spi-max-frequency = <10000000>;

  };

};

===============================================================

and I also add pinctrl_ecspiX in iomuxc like bellowed:

&iomuxc{

.....

  pinctrl_ecspi1: ecspi1grp {

    fsl,pins = <

      MX8MQ_IOMUXC_ECSPI1_MOSI_ECSPI1_MOSI 0x16

      MX8MQ_IOMUXC_ECSPI1_MISO_ECSPI1_MISO 0x16

      MX8MQ_IOMUXC_ECSPI1_SCLK_ECSPI1_SCLK 0x1816

      MX8MQ_IOMUXC_ECSPI1_SS0_GPIO5_IO9 0x16

    >;

  };

  pinctrl_ecspi2: ecspi2grp {

    fsl,pins = <

      MX8MQ_IOMUXC_ECSPI2_MOSI_ECSPI2_MISO 0x16

      MX8MQ_IOMUXC_ECSPI2_MISO_ECSPI2_MOSI 0x16

      MX8MQ_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0x1816

      MX8MQ_IOMUXC_ECSPI2_SS0_GPIO5_IO13 0x16

    >;

  };

===========================================================

After added it, I do cross-compile the kernel and install the new .dtb and Image files on my board.

It can detect /dev/spidev0.0 & /dev/spidev1.0.

And in user application, The spidev0.0 can opened and work well. it's not problem. (read/write well with the device which is connected on ecspi1 channel)

But spidev1.0 doesn't work well. It can be accessed by open() function and also worked well with ioctl() functions. They returned correct value. but when I call the read() and write() functions, nothing happened. I check the physical pins with my oscilloscope and it doesn't send any signal on SCK, SI, SO and CS pins.

0 Kudos
1 Reply

485 Views
igorpadykov
NXP Employee
NXP Employee

Hi JiHwan

 

for i.MX8MQ ecspi2 example one can look on

https://github.com/boundarydevices/linux-imx6/blob/boundary-imx_5.4.x_2.3.0/arch/arm64/boot/dts/free...

 

Best regards
igor

0 Kudos