The STM STM32MP25 CPU has eight SPI buses.

On the ConnectCore MP25 system-on-module:

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

On the ConnectCore MP25 Development Kit:

  • SPI3 port is available at SPI connector

Kernel configuration

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

  • STMicroelectronics STM32 SPI controllers interface (CONFIG_SPI_STM32)

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

Kernel driver

The driver for the SPI interface is located at:

File Description

drivers/spi/spi-stm32.c

SPI driver

Device tree bindings and customization

The STM32MP25 SPI interface device tree binding is documented at Documentation/devicetree/bindings/spi/st,stm32-spi.yaml.

The common STM32MP25 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 pinctrl 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: SPI3 port (as master) on the ConnectCore MP25 Development Kit

ConnectCore MP25 Development Kit device tree
&spi3 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&spi3_pins_a>;
	pinctrl-1 = <&spi3_sleep_pins_a>;
	cs-gpios = <&gpiob 1 0>;
	status = "okay";

	st33htpm0: st33htpm@0{
		compatible = "st,st33htpm-spi";
		reg = <0>;
		spi-max-frequency = <33000000>;
	};
};

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 MP25 platform.

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

See SPI API for more information about the SPI APIx.