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...!
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>
...
...
}
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>;
};
};
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!
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 Alvaro Martinez 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
According to the default PCB, R1724,R1725,R1726,R1727 are disconnected.Maybe that's why you get nothing on J1704.
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";
};
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
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
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
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..
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
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!
Take a look at the qspi node from
linux-2.6-imx.git - Freescale i.MX Linux Tree
Regards,
Fabio Estevam
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..