DART-6UL SPI: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
Line 28: Line 28:


<pre>
<pre>
/*
pinctrl_sai1: sai1grp {
        fsl,pins = <
                MX6UL_PAD_CSI_DATA05__SAI1_TX_BCLK      0x11088
                MX6UL_PAD_CSI_DATA04__SAI1_TX_SYNC      0x17088
                MX6UL_PAD_CSI_DATA06__SAI1_RX_DATA      0x11088
                MX6UL_PAD_CSI_DATA07__SAI1_TX_DATA      0x11088
        >;
};
*/
pinctrl_ecspi1_1: ecspi1grp {
pinctrl_ecspi1_1: ecspi1grp {
fsl,pins = <
fsl,pins = <
Line 47: Line 37:
};
};
</pre>
</pre>
Pick and choose the right chip select and you can also have multiple chip selects.
Note: The pins here were set arbitrarily. You should set them based on your hardware design, and make sure they are not conflicting with other devices in the device tree.<br>  you can also have multiple chip selects.<br>
* Compile the Linux kernel and device tree.
* Compile the Linux kernel and device tree.
* For testing use the application:<br>https://raw.githubusercontent.com/varigit/linux-2.6-imx/master/Documentation/spi/spidev_test.c
* For testing use the application:<br>https://raw.githubusercontent.com/varigit/linux-2.6-imx/master/Documentation/spi/spidev_test.c

Revision as of 18:35, 8 November 2016

DART-6UL- SPI

Testing SPI from user space require some changes.

  • Configure your kernel and add spidev driver. Device Drivers -> SPI support -> <*> User mode SPI device driver support
  • Add spidev and pinctrl to your device tree
&ecspi1 {
	fsl,spi-num-chipselects = <1>;
	cs-gpios = <&gpio4 26 0>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_ecspi1_1>;
	status = "okay";

        chip1: spidev@0 {
               compatible = "spidev";
               spi-max-frequency = <12000000>;
               reg = <0>;
        };
/*
        chip2: spidev@1 {
               compatible = "spidev";
               spi-max-frequency = <20000000>;
               reg = <1>;
	};
*/
};
pinctrl_ecspi1_1: ecspi1grp {
	fsl,pins = <
		MX6UL_PAD_CSI_DATA07__ECSPI1_MISO	0x100b1
		MX6UL_PAD_CSI_DATA06__ECSPI1_MOSI	0x100b1
		MX6UL_PAD_CSI_DATA04__ECSPI1_SCLK	0x100b1
		MX6UL_PAD_CSI_DATA05__GPIO4_IO26	0x80000000
	>;
};

Note: The pins here were set arbitrarily. You should set them based on your hardware design, and make sure they are not conflicting with other devices in the device tree.
you can also have multiple chip selects.