VAR-SOM-MX6 SPI: Difference between revisions

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


Pick and choose the right chip select and you can also have multiple chip selects.
Pick and choose the right chip select and you can also have multiple chip selects.
* Compile the Linux kernel and device tree.
* Continue following the [[VAR-SOM-MX6_Yocto_Jethro_R4_Build_Linux_out_of_tree|Build Linux from source code]] guide to build the kernel and device trees and to copy them to your SD card. Don't forget to also build and install the kernel modules.
* 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 12:41, 1 November 2016

VAR-SOM-MX6 - 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

For VAR-SOM-MX6, edit arch/arm/boot/dts/imx6qdl-var-som.dtsi
For DART-MX6, edit arch/arm/boot/dts/imx6qdl-var-dart.dtsi

&ecspi1 {
	fsl,spi-num-chipselects = <1>;
	cs-gpios = <&gpio4 9 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 = <
		MX6QDL_PAD_KEY_COL1__ECSPI1_MISO	0x100b1
		MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI	0x100b1
		MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK	0x100b1
		MX6QDL_PAD_KEY_ROW1__GPIO4_IO09      0x80000000
	>;
};

Pick and choose the right chip select and you can also have multiple chip selects.