SPI IMX6UL evl

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

SPI IMX6UL evl

10,287 Views
naghi
Contributor II

Hi,

How can activate the SPI on IMX6UL board? or where we can find the .dts file of this board? (FreeScale kernel  L3.14.38_IMX6UL)

Thanks

Labels (1)
Tags (2)
17 Replies

5,342 Views
shubham_soni
Contributor I

Hello All,

I was facing this same issue..

but Now fortunately i got spidev in imx board.

You Have to add this in your .dts file for node ...

         

&ecspi4 {

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

    cs-gpios = <0>;

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_ecspi4>;

    status = "okay";

    spidev@0x00 {

        compatible = "spidev";

        spi-max-frequency = <20000000>;

        reg = <0>;

    };

};

 

   pinctrl_ecspi4: ecspi4grp {
  fsl,pins = <
  MX6UL_PAD_ENET2_TX_CLK__ECSPI4_MISO    0x1b0b1
  MX6UL_PAD_ENET2_TX_EN__ECSPI4_MOSI    0x1b0b1
  MX6UL_PAD_ENET2_TX_DATA1__ECSPI4_SCLK    0x1b0b1
  MX6UL_PAD_ENET2_RX_ER__ECSPI4_SS0    0x1b0b1
  >;
  };

After adding this open .config file and enable CONFIG_SPI_SPIDEV=y or  enable it if it is commented by default.

then compile your changes by this command:

bitbake -f linux-imx -c compile

and build image.

That's it.

enjoy...!

0 Kudos
Reply

5,342 Views
dehuanxin
Contributor III

        pinctrl_ecspi1_2: ecspi1grp

          {

               fsl,pins = <

                                   MX6QDL_PAD_KEY_COL1__ECSPI1_MISO 0x100b1

                                   MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI 0x100b1

                                   MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK 0x100b1

                              >;

          };

     pinctrl_gpio_ecspi1: gpio_ecspi1_grp {

            fsl,pins = <

                MX6QDL_PAD_KEY_ROW1__GPIO4_IO09         0x010

            >;

        };

     &ecspi1 {

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

         cs-gpios = <&gpio4 9 0>;

         pinctrl-names = "default";

         pinctrl-0 = <&pinctrl_ecspi1_2>;

         status = "okay";

             chip1: spidev@0 {

                    compatible = "spidev";

                    spi-max-frequency = <500000>;

                    reg = <0>;

             };

     };

gpio_ecspi1_grp needs to be added to

     &iomuxc {

         pinctrl-names = "default";

         pinctrl-0 = < ... HERE>

     ...

     ...

     }

0 Kudos
Reply

5,342 Views
brentsink
Contributor I

Dehuan,

Shouldn't this be ECSPI4 on the Ultralite EVK board?  I've been trying with this, and it does create a /dev/spidev3.0 device, but the clock seems to be stuck at 60Hz for some reason.

pinctrl_spi3: spi3grp {

  fsl,pins = <

  MX6UL_PAD_ENET2_RX_ER__ECSPI4_SS0 0x100b1

  MX6UL_PAD_ENET2_TX_CLK__ECSPI4_MISO 0x100b1

  MX6UL_PAD_ENET2_TX_EN__ECSPI4_MOSI 0x100b1

  MX6UL_PAD_ENET2_TX_DATA1__ECSPI4_SCLK 0x100b1

  /*MX6UL_PAD_ENET2_RX_ER__ENET2_RX_ER 0x70a1 //SS0

  MX6UL_PAD_ENET2_TX_EN__ENET2_TX_EN 0x70a1 //MOSI

  MX6UL_PAD_ENET2_TX_CLK__ENET2_REF_CLK2 0x80000000 //MISO

  MX6UL_PAD_ENET2_TX_DATA1__ENET2_TDATA01 0x70a1 //SCLK

  MX6UL_PAD_ENET2_RX_ER__GPIO2_IO15*/

  >;

  };

&ecspi4 {

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

  cs-gpios = <&gpio2 15 0>;

  pinctrl-names = "default";

  pinctrl-0 = <&pinctrl_spi3>;

  status = "okay";

  spidev@0x00 {

  compatible = "spidev";

  spi-max-frequency = <10000000>;

  reg = <0>;

  };

};

0 Kudos
Reply

5,342 Views
almarto
Contributor IV

Hi Brent,

Yes, I was able to figure this out.

This is what I have in my dts file:

&ecspi4 {

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

    cs-gpios = <0>;

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_ecspi4>;

    status = "okay";

    spidev@0x00 {

        compatible = "spidev";

        spi-max-frequency = <20000000>;

        reg = <0>;

    };

};

    pinctrl_ecspi4: ecspi4grp {
   fsl,pins = <
   MX6UL_PAD_ENET2_TX_CLK__ECSPI4_MISO    0x1b0b1
   MX6UL_PAD_ENET2_TX_EN__ECSPI4_MOSI    0x1b0b1
   MX6UL_PAD_ENET2_TX_DATA1__ECSPI4_SCLK    0x1b0b1
   MX6UL_PAD_ENET2_RX_ER__ECSPI4_SS0    0x1b0b1
   >;
   };

I tested it with spidev_test.c

Hope this help!

5,342 Views
arnaudne
Contributor II

Hi everyone,

Sorry to bring up this topic back again.

I use the iMX6UL EVK and managed to get the /dev/spidev3.0 showing up (thanks to answer), but I can't write anything on the bus.

I am using the following command :

echo hello > /dev/spidev3.0

I then verified with my logic analyzer (on Arduino header J1704), nothing happens...

Can anyone help me ?

Thank you in advance.

Arnaud

0 Kudos
Reply

5,342 Views
qinghuazhu
Contributor III

According to the default PCB, R1724,R1725,R1726,R1727 are disconnected.Maybe that's why you get nothing on J1704.

0 Kudos
Reply

5,342 Views
LuisCasado
NXP Employee
NXP Employee
0 Kudos
Reply

5,342 Views
dehuanxin
Contributor III

It depends on the pinout of the board.

On my board ECSPI1 is available so I use ECSPI1.

Do you see clock configurations in other dts/dtsi files?

ecspi1: ecspi@02008000 {

    #address-cells = <1>;

    #size-cells = <0>;

    compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";

    reg = <0x02008000 0x4000>;

    interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;

    clocks = <&clks IMX6QDL_CLK_ECSPI1>,

             <&clks IMX6QDL_CLK_ECSPI1>;

    clock-names = "ipg", "per";

    status = "disabled";

};

0 Kudos
Reply

5,342 Views
igorpadykov
NXP Employee
NXP Employee

also it may be useful to look at sect.4.7.4 Running the Linux OS image

from QuadSPI attached Linux Guide and mfg tools script

mfgtool2-yocto-mx-evk-qspi-nor-n25q256a.vbs

IMX_L3.14.38-6UL_MFG_TOOL (REV L3.14.38_6ul)

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX6UL

~igor

0 Kudos
Reply

5,342 Views
almarto
Contributor IV

Hi all,

I have been able to run the Linux OS image from the QuadSPI.

I guess naghi has the same doubt as me .... which does not correspond to the answers below ... sorry if it's me who has misunderstood :-)

I would like to use SPI as I am able to use I2C on the imx6ulevk. As /dev/i2c-0 and /dev/i2c-1 are present, I can use them in my C code and connect i2c chips to the arduino connector. It works properly.

However, spidevX.Y devices are not present at /dev/ folder and so, I don't know how to use them. Could you please comment the procedure to make them available?

Thank you in advance for your collaboration.

BR

0 Kudos
Reply

5,342 Views
naghi
Contributor II

Hi Guys,

Many thanks for your answer. In fact, I have the same problem as Alvaro. It seems that by default there is no spi in the default kernel /dev/ and we need to build the custom one?

Best,

Kaveh

0 Kudos
Reply

5,342 Views
igorpadykov
NXP Employee
NXP Employee

as example one can look at

How to enable spidev on i.MX6 using kernel 3.10.9?

~igor

5,341 Views
phanikumar
Contributor III

Hi igorpadykov,

I am working on IMX6UL-EVK board. I want to run bare metal project (which does not involve any OS). Do you know how to run a helloworld project on bare metal. Could you please suggest any development tool? Do I need any extra hardware for debugging. Right now I am using processor expert. I have built the project but I don't know how to run or debug it. Could you please guide me in the right direction.

Thanks in advance..

0 Kudos
Reply

5,341 Views
almarto
Contributor IV

Hi,

I have been trying to follow the suggested example by igor, but first I would like to change the ethernet connector in the imx6ulevk. As you know, there are two ethernet controllers with a different MAC for each. From the firmware point of view, eth0 and eth1 are assigned to the same MAC. And I would like to use the other one .... How can I assign eth0 and eth1 to the other ethernet controller so that I don't have to use enet2 lines.

According to the schematics, ecspi4 (the one I want to enable in the device tree) shares some lines with enet2 and I guess they can not be used simultaneously. For instance, to stop using ENET2_TXDATA1 and use ECSPI4_CLK instead the following hardware configuration is needed: R1726 ON/R1636 OFF/R910 OFF, besides a modification in the device tree. And so, if I enable ECSPI4, I will not be able to use the ethernet controller closer to the hdmi port.

Could you please give any hint on how to do it?

BR

0 Kudos
Reply

5,341 Views
brentsink
Contributor I

Hi Alvaro,

Did you ever figure this out?  I'm trying to do the same thing and having trouble figuring out what to disable and enable in the device tree.  Thanks!

0 Kudos
Reply

5,341 Views
fabio_estevam
NXP Employee
NXP Employee

Take a look at the qspi node from

linux-2.6-imx.git - Freescale i.MX Linux Tree

Regards,

Fabio Estevam

0 Kudos
Reply

5,341 Views
phanikumar
Contributor III

Hi Fabio,

I am working on IMX6UL-EVK board. I want to run bare metal project (which does not involve any OS). Do you know how to run a helloworld project on bare metal. Could you please suggest any development tool? Do I need any extra hardware for debugging. Right now I am using processor expert. I have built the project but I don't know how to run or debug it. Could you please guide me in the right direction.

Thanks in advance..

0 Kudos
Reply