boards: shields: x_nucleo_gfx01m2: add x_nucleo_gfx01m2 board support

The x_nucleo_gfx01m2 is an evaluation shield sold by
STMicroelectronics. It features a MIPI DBI SPI serial TFT LCD display
and a SPI NOR Flash for graphical assets storage. A button joystick
can be used to control the GUI.

Signed-off-by: Christian Rask <christianrask2@gmail.com>
This commit is contained in:
Christian Rask 2025-05-07 19:50:32 +02:00 committed by Benjamin Cabé
commit b8ce134733
6 changed files with 247 additions and 0 deletions

View file

@ -0,0 +1,14 @@
# Copyright (c) 2025 Christian Rask
# SPDX-License-Identifier: Apache-2.0
if SHIELD_X_NUCLEO_GFX01M2
config SPI_STM32_INTERRUPT
default y
depends on SPI
config SPI_STM32_DMA
default y
depends on SPI
endif # SHIELD_X_NUCLEO_GFX01M2

View file

@ -0,0 +1,5 @@
# Copyright (c) 2025 Christian Rask
# SPDX-License-Identifier: Apache-2.0
config SHIELD_X_NUCLEO_GFX01M2
def_bool $(shields_list_contains,x_nucleo_gfx01m2)

View file

@ -0,0 +1,45 @@
/*
* Copyright (c) 2025 Christian Rask
*
* SPDX-License-Identifier: Apache-2.0
*/
&st_morpho_lcd_spi {
pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
pinctrl-names = "default";
dmas = <&dmamux1 0 17 (STM32_DMA_PERIPH_TX | STM32_DMA_PRIORITY_LOW)>,
<&dmamux1 1 16 (STM32_DMA_PERIPH_RX | STM32_DMA_PRIORITY_LOW)>;
dma-names = "tx", "rx";
};
&st_morpho_flash_spi {
pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pc2 &spi2_mosi_pc3>;
pinctrl-names = "default";
dmas = <&dmamux1 2 19 (STM32_DMA_PERIPH_TX | STM32_DMA_PRIORITY_LOW)>,
<&dmamux1 3 18 (STM32_DMA_PERIPH_RX | STM32_DMA_PRIORITY_LOW)>;
dma-names = "tx", "rx";
};
&dma1 {
status = "okay";
};
&dmamux1 {
status = "okay";
};
&spi1_miso_pa6 {
slew-rate = "very-high-speed";
};
&spi1_mosi_pa7 {
slew-rate = "very-high-speed";
};
&spi2_miso_pc2 {
slew-rate = "very-high-speed";
};
&spi2_mosi_pc3 {
slew-rate = "very-high-speed";
};

View file

@ -0,0 +1,83 @@
.. _x_nucleo_gfx01m2_shield:
X-NUCLEO-GFX01M2 Display expansion board
##############################################
Overview
********
The X-NUCLEO-GFX01M1 and X-NUCLEO-GFX01M2 expansion boards (X-NUCLEO-GFX01Mx)
add graphic user interface (GUI) capability to STM32 Nucleo-64 boards.
They feature a 2.2" SPI QVGA TFT display as well as a 64-Mbit SPI NOR Flash
memory for storing graphic images, texts and texture. The expansion boards
also offer a joystick for GUI navigation.
X-NUCLEO-GFX01M2 uses the ST morpho connector and supports up to two SPIs.
The SPI Display is compatible with the ``ilitek,ili9341`` driver and
the SPI FLASH is compatible with the ``jedec,spi-nor`` driver.
.. figure:: x_nucleo_gfx01m2.webp
:align: center
:alt: X-NUCLEO-GFX01M2
More information about the board can be found at the
`X-NUCLEO-GFX01M2 website`_.
Requirements
************
This shield can only be used with STM32 Nucleo-64 boards that provide
a configuration for ST Morpho connectors. This shield supports up to two SPIs.
Two node aliases for the LCD SPI and FLASH SPI are defined in the device tree
overlay that must reference the appropriate SPI controllers on the Nucleo
board. Consult the X-NUCLEO-GFX01M2 user manual for more information about the
SPI pinouts used on your development board:
- `X-NUCLEO-GFX01M2 SPI display expansion board User Manual`_
The SPI FLASH device does not support the Write Protection and Pause features.
For more information about interfacing the MX25L6433F FLASH device and the
ILI9341 display controller, see these documents:
- `ILI9341 Serial SPI bus TFT LCD Display Datasheet`_
- `MX25L6433F Serial SPI bus NOR FLASH Datasheet`_
Hardware configuration
**********************
The default SPI pin control of your development board may not be compatible
with the X-NUCLEO-GFX01M2 expansion board. Additionally, it is recommended
to configure the SPI pins to high speed and configure DMA channels for the
best graphics performance. See boards/nucleo_g071rb.overlay for an example
of how to do this.
Samples
*******
The :zephyr:code-sample:`display` and :zephyr:code-sample:`spi-nor` samples
can be used to test out the expansion boards functionality.
Programming
***********
Set ``--shield x_nucleo_gfx01m2`` when you invoke ``west build``. For example:
.. zephyr-app-commands::
:zephyr-app: samples/drivers/display/
:board: nucleo_g071rb
:shield: x_nucleo_gfx01m2
:goals: build
.. _X-NUCLEO-GFX01M2 website:
https://www.st.com/en/evaluation-tools/x-nucleo-gfx01m2.html#overview
.. _X-NUCLEO-GFX01M2 SPI display expansion board User Manual:
https://www.st.com/resource/en/user_manual/um2750-spi-display-expansion-boards-for-stm32-nucleo64-stmicroelectronics.pdf
.. _ILI9341 Serial SPI bus TFT LCD Display Datasheet:
https://cdn-shop.adafruit.com/datasheets/ILI9341.pdf
.. _MX25L6433F Serial SPI bus NOR FLASH Datasheet:
https://www1.futureelectronics.com/doc/Macronix/MX25L6433FZNI-08G.pdf

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View file

@ -0,0 +1,100 @@
/*
* Copyright (c) 2025 Christian Rask
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/dt-bindings/display/ili9xxx.h>
#include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>
#include <freq.h>
#include <mem.h>
/ {
chosen {
zephyr,display = &ili9341;
};
aliases {
sw0 = &joy_sel;
};
gpio_keys {
compatible = "gpio-keys";
joy_sel: joystick_selection {
label = "joystick selection";
gpios = <&st_morpho_header ST_MORPHO_R_19 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
zephyr,code = <INPUT_KEY_ENTER>;
};
joy_down: joystick_down {
label = "joystick down";
gpios = <&st_morpho_header ST_MORPHO_R_27 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
zephyr,code = <INPUT_KEY_DOWN>;
};
joy_up: joystick_up {
label = "joystick up";
gpios = <&st_morpho_header ST_MORPHO_L_38 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
zephyr,code = <INPUT_KEY_UP>;
};
joy_left: joystick_left {
label = "joystick left";
gpios = <&st_morpho_header ST_MORPHO_R_17 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
zephyr,code = <INPUT_KEY_LEFT>;
};
joy_right: joystick_right {
label = "joystick right";
gpios = <&st_morpho_header ST_MORPHO_L_34 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
zephyr,code = <INPUT_KEY_RIGHT>;
};
};
mipi_dbi {
compatible = "zephyr,mipi-dbi-spi";
spi-dev = <&st_morpho_lcd_spi>;
dc-gpios = <&st_morpho_header ST_MORPHO_R_25 GPIO_ACTIVE_HIGH>;
reset-gpios = <&st_morpho_header ST_MORPHO_L_30 GPIO_ACTIVE_LOW>;
#address-cells = <1>;
#size-cells = <0>;
write-only;
ili9341: ili9341@0 {
compatible = "ilitek,ili9341";
mipi-max-frequency = <DT_FREQ_M(32)>;
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
reg = <0>;
width = <240>;
height = <320>;
rotation = <180>;
pixel-format = <ILI9XXX_PIXEL_FORMAT_RGB565>;
frmctr1 = [00 1f]; /* 60Hz frame rate */
};
};
};
st_morpho_lcd_spi: &spi1 {};
st_morpho_flash_spi: &spi2 {};
&st_morpho_lcd_spi {
cs-gpios = <&st_morpho_header ST_MORPHO_R_21 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
status = "okay";
};
&st_morpho_flash_spi {
cs-gpios = <&st_morpho_header ST_MORPHO_R_23 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
status = "okay";
mx25l6433f: mx25l6433f@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <DT_FREQ_M(50)>;
size = <DT_SIZE_M(64)>;
has-dpd;
t-enter-dpd = <10000>;
t-exit-dpd = <100000>;
jedec-id = [c2 20 17];
};
};