Skip to content

Commit 7c1ab3e

Browse files
committed
samples: mspi_flash: add support for some boards
this commit enables building and running the sample on stm32h573i_dk board,stm32h735g_disco board, arduino_giga_r1 board, and b_u585i_iot02a board by providing the required overlay and configuration updates. Signed-off-by: Sara Touqan <[email protected]> Signed-off-by: Sarah Younis <[email protected]> Signed-off-by: Mohammad Odeh <[email protected]>
1 parent e035e16 commit 7c1ab3e

File tree

8 files changed

+283
-0
lines changed

8 files changed

+283
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2025 EXALT Technologies.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
CONFIG_LOG=y
5+
CONFIG_MSPI_LOG_LEVEL_INF=y
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Copyright (c) 2025 EXALT Technologies.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* Replace the quadspi by a "st,stm32-qspi-controller" compatible */
8+
/delete-node/ &n25q128a1;
9+
10+
/ {
11+
aliases {
12+
/* The sample gets the DT_ALIAS(flash0) as the mspi device */
13+
flash0 = &n25q128a;
14+
};
15+
16+
qspi_memory: qspi-memory@90000000 {
17+
compatible = "zephyr,memory-region";
18+
device_type = "memory";
19+
reg = <0x90000000 DT_SIZE_M(256)>;
20+
zephyr,memory-region = "QSPI";
21+
zephyr,memory-attr = <DT_MEM_ARM(ATTR_MPU_FLASH)>;
22+
};
23+
};
24+
25+
&quadspi {
26+
compatible = "st,stm32-qspi-controller";
27+
reg = <0x52005000 0x1000>, <0x90000000 DT_SIZE_M(256)>;
28+
interrupts = <92 0>;
29+
clocks = <&rcc STM32_CLOCK(AHB3, 14U)>;
30+
clock-names = "qspix";
31+
#address-cells = <1>;
32+
#size-cells = <0>;
33+
clock-frequency = <DT_FREQ_M(72)>;
34+
op-mode = "MSPI_OP_MODE_CONTROLLER";
35+
duplex = "MSPI_HALF_DUPLEX";
36+
37+
status = "okay";
38+
pinctrl-0 = <&quadspi_clk_pf10 &quadspi_bk1_ncs_pg6
39+
&quadspi_bk1_io0_pd11 &quadspi_bk1_io1_pd12
40+
&quadspi_bk1_io2_pe2 &quadspi_bk1_io3_pf6>;
41+
pinctrl-names = "default";
42+
43+
n25q128a: qspi-nor-flash@0 {
44+
compatible = "jedec,mspi-nor";
45+
reg = <0>;
46+
size = <DT_SIZE_M(128)>; /* 128 Mbits */
47+
status = "okay";
48+
49+
mspi-max-frequency = <DT_FREQ_M((72))>;
50+
mspi-io-mode = "MSPI_IO_MODE_SINGLE";
51+
mspi-data-rate = "MSPI_DATA_RATE_SINGLE";
52+
mspi-hardware-ce-num = <0>;
53+
read-command = <0x0b>;
54+
write-command = <0x02>;
55+
command-length = "INSTR_1_BYTE";
56+
address-length = "ADDR_3_BYTE";
57+
rx-dummy = <8>;
58+
tx-dummy = <0>;
59+
jedec-id = [1f 89 01];
60+
61+
partitions {
62+
compatible = "fixed-partitions";
63+
#address-cells = <1>;
64+
#size-cells = <1>;
65+
66+
slot1_partition: partition@0 {
67+
label = "image-1";
68+
reg = <0x00000000 DT_SIZE_M(1)>;
69+
};
70+
71+
storage_partition: partition@100000 {
72+
label = "storage";
73+
reg = <0x00100000 DT_SIZE_M(15)>;
74+
};
75+
};
76+
};
77+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONFIG_LOG=y
2+
CONFIG_MSPI_LOG_LEVEL_INF=y
3+
CONFIG_MSPI_DMA=y
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (c) 2025 EXALT Technologies.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* Replace the octospi2 by a "st,stm32-ospi-controller" compatible */
8+
/delete-node/ &octospi2;
9+
10+
/ {
11+
aliases {
12+
/* The sample gets the DT_ALIAS(flash0) as the mspi device */
13+
flash0 = &mx25lm51245;
14+
};
15+
16+
soc {
17+
octospi2: spi@420d2400 {
18+
compatible = "st,stm32-ospi-controller";
19+
reg = <0x420d2400 0x400>, <0x70000000 DT_SIZE_M(256)>;
20+
interrupts = <120 0>;
21+
clock-names = "ospix", "ospi-ker", "ospi-mgr";
22+
clocks = <&rcc STM32_CLOCK(AHB2_2, 8)>,
23+
<&rcc STM32_SRC_SYSCLK OCTOSPI_SEL(0)>,
24+
<&rcc STM32_CLOCK(AHB2, 21)>;
25+
#address-cells = <1>;
26+
#size-cells = <0>;
27+
op-mode = "MSPI_OP_MODE_CONTROLLER";
28+
pinctrl-0 = <&octospim_p2_clk_pf4 &octospim_p2_ncs_pi5
29+
&octospim_p2_io0_pf0 &octospim_p2_io1_pf1
30+
&octospim_p2_io2_pf2 &octospim_p2_io3_pf3
31+
&octospim_p2_io4_ph9 &octospim_p2_io5_ph10
32+
&octospim_p2_io6_ph11 &octospim_p2_io7_ph12
33+
&octospim_p2_dqs_pf12>;
34+
pinctrl-names = "default";
35+
dmas = <&gpdma1 12 41 0x10480>; /* request 41 for OCTOSPI2 */
36+
dma-names = "tx_rx";
37+
status = "okay";
38+
39+
mx25lm51245: ospi-nor-flash@0 {
40+
compatible = "jedec,mspi-nor";
41+
reg = <0>;
42+
size = <DT_SIZE_M(512)>; /* 512 Megabits */
43+
mspi-max-frequency = <DT_FREQ_M(50)>;
44+
mspi-io-mode = "MSPI_IO_MODE_OCTAL";
45+
mspi-data-rate = "MSPI_DATA_RATE_DUAL"; /* as first step */
46+
mspi-hardware-ce-num = <0>;
47+
read-command = <0xEE11>; /* ReaD 4Bytes */
48+
command-length = "INSTR_2_BYTE";
49+
write-command = <0x12ED>; /* WRite 4Bytes */
50+
rx-dummy = <20>;
51+
jedec-id = [c2 85 3a];
52+
status = "okay";
53+
54+
partitions {
55+
compatible = "fixed-partitions";
56+
#address-cells = <1>;
57+
#size-cells = <1>;
58+
59+
partition@0 {
60+
label = "nor";
61+
reg = <0x00000000 DT_SIZE_M(4)>;
62+
};
63+
};
64+
};
65+
};
66+
};
67+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CONFIG_LOG=y
2+
CONFIG_MSPI_LOG_LEVEL_INF=y
3+
CONFIG_HEAP_MEM_POOL_SIZE=8192
4+
CONFIG_MSPI_DMA=y
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2025 STMicroelectronics
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* Replace the xspi1 by a "st,stm32-mspi-controller" compatible */
8+
/delete-node/ &xspi1;
9+
10+
/ {
11+
aliases {
12+
/* The sample gets the DT_ALIAS(flash0) as the mspi device */
13+
flash0 = &mx25lm51245;
14+
};
15+
16+
soc {
17+
xspi1: mspi@47001400 {
18+
compatible = "st,stm32-xspi-controller";
19+
reg = <0x47001400 0x400>, <0x90000000 DT_SIZE_M(256)>;
20+
interrupts = <78 0>;
21+
clock-names = "xspix", "xspi-ker";
22+
clocks = <&rcc STM32_CLOCK(AHB4, 20U)>,
23+
<&rcc STM32_SRC_PLL1_Q OCTOSPI1_SEL(1)>;
24+
#address-cells = <1>;
25+
#size-cells = <0>;
26+
clock-frequency = <0x17d7840>;
27+
op-mode = "MSPI_OP_MODE_CONTROLLER";
28+
status = "okay";
29+
pinctrl-0 = <&octospi1_io0_pb1 &octospi1_io1_pd12
30+
&octospi1_io2_pc2 &octospi1_io3_pd13
31+
&octospi1_io4_ph2 &octospi1_io5_ph3
32+
&octospi1_io6_pg9 &octospi1_io7_pc0
33+
&octospi1_clk_pf10 &octospi1_ncs_pg6
34+
&octospi1_dqs_pb2>;
35+
pinctrl-names = "default";
36+
dmas = <&gpdma1 4 57 STM32_DMA_PERIPH_TX
37+
&gpdma1 5 57 STM32_DMA_PERIPH_RX>;
38+
dma-names = "tx", "rx";
39+
40+
mx25lm51245: ospi-nor-flash@0 {
41+
compatible = "jedec,mspi-nor";
42+
reg = <0>;
43+
size = <DT_SIZE_M(512)>; /* 512 Mbits */
44+
status = "okay";
45+
read-command = <0xEE11>;
46+
write-command = <0x12ED>;
47+
rx-dummy = <20>;
48+
mspi-max-frequency = <DT_FREQ_M(50)>;
49+
mspi-io-mode = "MSPI_IO_MODE_OCTAL";
50+
mspi-data-rate = "MSPI_DATA_RATE_DUAL";
51+
mspi-hardware-ce-num = <0>;
52+
command-length = "INSTR_2_BYTE";
53+
jedec-id = [c2 85 3a];
54+
};
55+
};
56+
};
57+
};
58+
59+
&gpdma1 {
60+
status = "okay";
61+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONFIG_LOG=y
2+
CONFIG_MSPI_LOG_LEVEL_INF=y
3+
CONFIG_ARM_MPU=n
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright (c) 2025 EXALT Technologies.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* Replace the octospi1 by a "st,stm32-ospi-controller" compatible */
8+
/delete-node/ &octospi1;
9+
10+
/ {
11+
aliases {
12+
flash0 = &mx25lm51245;
13+
};
14+
15+
soc {
16+
octospi1: spi@52005000 {
17+
compatible = "st,stm32-ospi-controller";
18+
reg = <0x52005000 0x1000>, <0x90000000 DT_SIZE_M(256)>;
19+
interrupts = <92 0>;
20+
clock-names = "ospix", "ospi-ker";
21+
clocks = <&rcc STM32_CLOCK(AHB3, 14)>,
22+
<&rcc STM32_SRC_PLL1_Q OSPI_SEL(1)>;
23+
#address-cells = <1>;
24+
#size-cells = <0>;
25+
op-mode = "MSPI_OP_MODE_CONTROLLER";
26+
pinctrl-0 = <&octospim_p1_clk_pf10 &octospim_p1_ncs_pg6
27+
&octospim_p1_io0_pd11 &octospim_p1_io1_pd12
28+
&octospim_p1_io2_pe2 &octospim_p1_io3_pd13
29+
&octospim_p1_io4_pd4 &octospim_p1_io5_pd5
30+
&octospim_p1_io6_pg9 &octospim_p1_io7_pd7
31+
&octospim_p1_dqs_pb2>;
32+
pinctrl-names = "default";
33+
status = "okay";
34+
35+
mx25lm51245: ospi-nor-flash@0 {
36+
compatible = "jedec,mspi-nor";
37+
reg = <0>;
38+
size = <DT_SIZE_M(512)>;
39+
status = "okay";
40+
mspi-max-frequency = <DT_FREQ_M(50)>;
41+
mspi-io-mode = "MSPI_IO_MODE_OCTAL";
42+
mspi-data-rate = "MSPI_DATA_RATE_SINGLE";
43+
mspi-hardware-ce-num = <0>;
44+
read-command = <0xEC13>;
45+
write-command = <0x12ED>;
46+
command-length = "INSTR_2_BYTE";
47+
rx-dummy = <20>;
48+
jedec-id = [c2 85 3a];
49+
50+
partitions {
51+
compatible = "fixed-partitions";
52+
#address-cells = <1>;
53+
#size-cells = <1>;
54+
55+
partition@0 {
56+
label = "nor";
57+
reg = <0x00000000 DT_SIZE_M(4)>;
58+
};
59+
};
60+
};
61+
};
62+
};
63+
};

0 commit comments

Comments
 (0)