The NXP i.MX6UL CPU has four SPI buses.

On the ConnectCore 6UL system-on-module:

  • All four SPI ports are available (multiplexed with other functionality)

On the ConnectCore 6UL SBC Express:

  • SPI3 port is available at the expansion header

On the ConnectCore 6UL SBC Pro:

  • SPI1 port is available at SPI connector

Kernel configuration

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

  • Freescale i.MX SPI controllers interface (CONFIG_SPI_IMX)

This option is enabled as built-in on the default ConnectCore 6UL kernel configuration file.

Kernel driver

The driver for the SPI interface is located at:

File Description


SPI driver

Device tree bindings and customization

The i.MX6UL SPI interface device tree binding is documented at Documentation/devicetree/bindings/spi/fsl-imx-cspi.yaml.

The common i.MX6UL 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 GPIOs that will work as chip select lines using property cs-gpios.

  • Configure the IOMUX of the pads that will work as SPI port plus the GPIOs to be used as chip select lines.

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

Example: SPI1 port (as master) on the ConnectCore 6UL SBC Pro

ConnectCore 6UL SBC Pro device tree
/* ECSPI1 */
&ecspi1 {
	num-cs = <1>;
	cs-gpios = <&gpio3 26 GPIO_ACTIVE_LOW>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_ecspi1_master>;
	status = "disabled";


&iomuxc {
	imx6ul-ccimx6ul {

		pinctrl_ecspi1_master: ecspi1grp1 {
			fsl,pins = <
				MX6UL_PAD_LCD_DATA21__GPIO3_IO26	0x10b0 /* Chip Select */
				/* SPI1_IRQ_N */
				MX6UL_PAD_SNVS_TAMPER8__GPIO5_IO08	0x1b0b0


SPI user space usage

The SPI bus cannot be accessed directly from user space. Instead, it is accessed via the SPI client drivers. However, a special sample client driver allows raw access to the SPI bus.

SPI device interface

The Linux kernel offers a sample client driver called spidev that gives you read and write data access to the SPI bus through the /dev interface. You can find this driver under the kernel configuration option User mode SPI device driver support (CONFIG_SPI_SPIDEV). On Digi Embedded Yocto this driver is enabled as a loadable module. The default device tree includes the spidev node in the device tree as an SPI device hanging from the SPI bus:

ConnectCore 6UL SBC Pro device tree
/* ECSPI1 (as master) */
&ecspi1 {
	status = "okay";

	 * Add your slave devices here. Next is an example of spidev.
	spidev@0 {
		reg = <0>;
		compatible = "rohm,dh2228fv";
		spi-max-frequency = <1000000>;

To use it, load the spidev module from user space:

# modprobe spidev
Spidev is not a real hardware SPI slave device but a detail of how Linux controls a device.

Linux will create a device node in the form /dev/spidevX.Y device node where:

  • X corresponds to the SPI port index, starting from 0.

  • Y corresponds to the SPI bus chip select, starting from 0.

Sample application

An example application called apix-spi-example is included in the dey-examples-digiapix recipe (part of dey-examples package) of the meta-digi layer. This application is an example of how to write data to an external EEPROM (24FC1026) and read it back using Digi APIx library on the ConnectCore 6UL platform.

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

See SPI API for more information about the SPI APIx.