AnsweredAssumed Answered

Use Spidev MCP23s17

Question asked by Romain Nosho on Nov 21, 2018
Latest reply on Nov 22, 2018 by igorpadykov

Hi everyone,

 

I want to control a mcp23s17 on a i.MX6ul via "/dev/spidev1.0" interface.

 

I have change my Devicetree like following:

  

&ecspi2 {
   fsl,spi-num-chipselects = <4>;
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_ecspi2 &pinctrl_ecspi2_cs>;
   cs-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>;
   status = "okay";

   /* spidev examlpe */
   anotherspidev@0 {
      compatible = "spidev";
      spi-max-frequency = <30000000>;
      reg = <0>;
   };
};

&iomuxc {
pinctrl_ecspi2_cs: ecspi2_cs_grp {
   fsl,pins = <
      MX6UL_PAD_UART4_RX_DATA__ECSPI2_SS0  0x17059
   >;
};

pinctrl_ecspi2: ecspi2grp {
fsl,pins = <
      MX6UL_PAD_UART5_TX_DATA__ECSPI2_MOSI   0x1b0b1
      MX6UL_PAD_UART5_RX_DATA__ECSPI2_MISO   0x1b0b1
      MX6UL_PAD_UART4_TX_DATA__ECSPI2_SCLK   0x1b0b1
   >;
};
}

With

dmesg | grep spi 
I get

[ 1.036501] spi_imx 2008000.ecspi: registered master spi0
[ 1.037659] spi spi0.0: spi_imx_setup: mode 0, 8 bpw, 30000000 hz
[ 1.037713] spi spi0.0: setup mode 0, 8 bits/w, 30000000 Hz max --> 0
[ 1.038699] spi_imx 2008000.ecspi: registered child spi0.0
[ 1.039459] spi spi0.1: spi_imx_setup: mode 0, 8 bpw, 30000000 hz
[ 1.039505] spi spi0.1: setup mode 0, 8 bits/w, 30000000 Hz max --> 0
[ 1.040399] spi_imx 2008000.ecspi: registered child spi0.1
[ 1.041087] spi spi0.2: spi_imx_setup: mode 0, 8 bpw, 30000000 hz
[ 1.041134] spi spi0.2: setup mode 0, 8 bits/w, 30000000 Hz max --> 0
[ 1.042000] spi_imx 2008000.ecspi: registered child spi0.2
[ 1.042701] spi spi0.3: spi_imx_setup: mode 0, 8 bpw, 30000000 hz
[ 1.042747] spi spi0.3: setup mode 0, 8 bits/w, 30000000 Hz max --> 0
[ 1.043699] spi_imx 2008000.ecspi: registered child spi0.3
[ 1.043730] spi_imx 2008000.ecspi: probed
[ 1.047833] spi_imx 200c000.ecspi: registered master spi1
[ 1.048814] spi spi1.0: spi_imx_setup: mode 0, 8 bpw, 30000000 hz
[ 1.048865] spi spi1.0: setup mode 0, 8 bits/w, 30000000 Hz max --> 0
[ 1.049865] spi_imx 200c000.ecspi: registered child spi1.0
[ 1.049896] spi_imx 200c000.ecspi: probed
[ 1.053747] spi_imx 2014000.ecspi: registered master spi3
[ 1.054704] spi spi3.0: spi_imx_setup: mode 0, 8 bpw, 20000000 hz
[ 1.054751] spi spi3.0: setup mode 0, 8 bits/w, 20000000 Hz max --> 0

 

I used the code provides in this example to test the mcp23s17 but it doesn't works.


Can you help me please ?

Thank you in advance.

Romain

Outcomes