The NXP {cpu-family} CPU has three SPI buses and a Flexible SPI interface with two ports than can operate as Quad-SPI.

On the ConnectCore 8M Mini system-on-module:

  • All three SPI ports are available (multiplexed with other functionality) either on the castellated or LGA pads.

  • Quad-SPI A port is available on the LGA pads.

On the ConnectCore 8M Mini Development Kit:

  • The SPI3 interface is connected to an SPI CAN controller (MCP2517FD). See Controller Area Network (CAN) for more information.

  • None of the SPI buses are available on any connector of the ConnectCore 8M Mini Development Kit.

Kernel configuration

You can manage the SPI driver support through the kernel configuration option:

  • Freescale i.MX SPI controller (CONFIG_SPI_IMX)

This option is enabled as built-in on the default ConnectCore 8M Mini kernel configuration file.

Kernel driver

File Description

drivers/spi/spi-imx.c

i.MX SPI driver

Device tree bindings and customization

The {cpu-family} SPI interface device tree binding is documented at Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt.

The common {cpu-family} CPU device tree defines all the SPI ports. The platform device tree must:

  • Enable the required SPI port, by setting the status property to "okay".

  • Choose the chip selects using property cs-gpios and their number using property fsl,spi-num-chipselects.

  • Configure the IOMUX of the pads that will work as SPI port.

  • Add the SPI slave devices as children of the SPI bus node.

Example: SPI3 port (as master) on the ConnectCore 8M Mini Development Kit

ConnectCore 8M Mini Development Kit device tree
&ecspi3 {
	#address-cells = <1>;
	#size-cells = <0>;
	num-cs = <1>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_ecspi3 &pinctrl_ecspi3_cs>;
	cs-gpios = <&gpio5 25 GPIO_ACTIVE_LOW>;
	status = "okay";

	/* SPI slave devices come here */
};

&iomuxc {
	pinctrl_ecspi3: ecspi3grp {
		fsl,pins = <
			MX8MM_IOMUXC_UART1_RXD_ECSPI3_SCLK		0x82
			MX8MM_IOMUXC_UART1_TXD_ECSPI3_MOSI		0x82
			MX8MM_IOMUXC_UART2_RXD_ECSPI3_MISO		0x82
		>;
	};

	pinctrl_ecspi3_cs: ecspi3cs {
		fsl,pins = <
			MX8MM_IOMUXC_UART2_TXD_GPIO5_IO25		0x40000
		>;
	};
};

SPI user space usage

You can access the SPI interfaces from your Android application. See SPI API for more information about the SPI APIx.

Sample application

The SPI Sample Application demonstrates the usage of the SPI API by monitoring the communication with a slave device. The application allows reading, writing and transferring data to the slave device.

Go to GitHub to see the application instructions and source code.

Quad-SPI

Quad-SPI bus cannot be used on the ConnectCore 8M Mini Development Kit out of the box. Quad-SPI interface lines conflict with the LVDS and HDMI interfaces. Besides, the ConnectCore 8M Mini Development Kit doesn’t contain any Quad-SPI slave device.

Digi Embedded for Android includes a sample reference device tree overlay that enables the Quad-SPI bus to interface a NOR Flash memory. This device tree overlay disables all conflicting interfaces of the ConnectCore 8M Mini Development Kit.