Attaching SPI Devices via MikroE Click Connector
The STM32MP1-BSB rev 4A board supports SPI devices connected over MikroE Click connector J1
.
This application note describes how to connect an SPI Flash device to the STM32MP1-BSB rev 4A board and enable support of the device in the Linux kernel.
Plug a jumper on pins 1-2 of
JP4
("NSS").Connect the SPI Flash dongle (e.g., the
ST25P32V6P
Flash device) to STM32MP1-BSB as follows:J1A.7
- VCCJ1A.8
- GNDJ1A.3
- #SSJ1A.4
- CLKJ1A.6
- MOSIJ1A.5
- MISO
Modify the board’s Linux device tree to include the Flash device node to the SPI1 device note:
&spi1 { pinctrl-names = "default", "sleep"; pinctrl-0 = <&spi1_pins_a>; pinctrl-1 = <&spi1_sleep_pins_a>; cs-gpios = <&gpioz 3 GPIO_ACTIVE_LOW>; /delete-property/dmas; /delete-property/dma-names; status = "okay"; flash: flash@0 { #address-cells = <1>; #size-cells = <1>; compatible = "st,m25p32", "jedec,spi-nor"; spi-max-frequency = <1000000>; reg = <0>; }; };
Re-build the kernel as described in Building Linux Kernel.
Copy the
fitImage
kernel file to the/boot
directory on the board.Boot the board and check that the attached SPI Flash is detected by the driver:
root@stm32mp15-bsb:~# dmesg ... [ 15.756232] spi-nor spi0.0: m25p32 (4096 Kbytes)
Prepare the Flash device for usage by erasing it and mount it for JFFS2 file system:
root@stm32mp15-bsb:~# flash_erase -j /dev/mtd0 root@stm32mp15-bsb:~# mount -t jffs2 /dev/mtdblock0 /mnt