


To enable the SPIDEV interface in the kernel, the rootfs project has the CONFIG_SPI_SPIDEV option enabled by default. This interface is frequently used in embedded applications to control SPI devices (such as, for instance, SPI sensors) directly from user space code. In the example above, the client SPI device driver for both devices is SPIDEV ( compatible = "linux,spidev" ), which provides access to the SPI device from the user space using raw SPI transactions.

In this example, we connect two SPI devices to the SPI2 bus on the STM32F7 and use the PB9 and PD6 singals as the chip selects for these two SPI devices. Consult the "Alternate function mapping" information from the STM32F7 Datasheet to select the appropriate pins and the AF (Alternate Function) values:Īnother kernel configuration file that you will have to edit for sure defines information about SPI buses enabled in your application as well as about SPI devices connected to each SPI bus: If your design makes use of the SPI controllers in a non-default way, you may have to edit the following file in order to define application specific allocation of SPI interfaces to the STM32F7 pins. The STM32F7 allows different alternate pin selection for each SPI controller. There are 6 SPI controllers available in the STM32F7. However, you would still have to perform some configuration of the Linux kernel in order to access specific SPI devices connected to the STM32F7 in your embedded design. Appropriate kernel configuration options are enabled in the rootfs project that is installed to each STM32F7 System-On-Module shipped by Emcraft. The Linux kernel provides a device driver for the SPI controller of the STM32F7.
