STM32MP1-Old-Kits: Attaching SPI Devices via MikroE Click Connector

The STM32MP1-BSB rev 2A 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 2A board and enable support of the device in the Linux kernel.

  1. Plug a jumper on pins 1-2 of JP4 ("NSS").

  2. Connect the SPI Flash dongle (e.g., the ST25P32V6P Flash device) to STM32MP1-BSB as follows:

    • J1A.7 - VCC

    • J1A.8 - GND

    • J1A.3 - #SS

    • J1A.4 - CLK

    • J1A.6 - MOSI

    • J1A.5 - MISO

  3. 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>; }; };
  4. Re-build the kernel as described in STM32MP1-Old-Kits: Building Linux Kernel.

  5. Copy the fitImage kernel file to the /boot directory on the board.

  6. 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)
  7. 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