Skip to content

Commit adf9ad9

Browse files
ExaltZephyrExaltZephyr
authored andcommitted
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 36d7122 commit adf9ad9

File tree

8 files changed

+317
-0
lines changed

8 files changed

+317
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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
6+
CONFIG_USB_DEVICE_STACK=y
7+
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=y
8+
CONFIG_LOG_MODE_DEFERRED=y
9+
CONFIG_USB_CDC_ACM=y
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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+
chosen {
12+
zephyr,console = &cdc_acm_uart0;
13+
zephyr,shell-uart = &cdc_acm_uart0;
14+
zephyr,uart-mcumgr = &cdc_acm_uart0;
15+
};
16+
17+
aliases {
18+
/* The sample gets the DT_ALIAS(flash0) as the mspi device */
19+
flash0 = &n25q128a;
20+
};
21+
22+
qspi_memory: qspi-memory@90000000 {
23+
compatible = "zephyr,memory-region";
24+
device_type = "memory";
25+
reg = <0x90000000 DT_SIZE_M(256)>;
26+
zephyr,memory-region = "QSPI";
27+
zephyr,memory-attr = <DT_MEM_ARM(ATTR_MPU_FLASH)>;
28+
};
29+
};
30+
31+
&usbotg_fs {
32+
status = "okay";
33+
pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
34+
pinctrl-names = "default";
35+
36+
cdc_acm_uart0: cdc_acm_uart0 {
37+
status = "okay";
38+
compatible = "zephyr,cdc-acm-uart";
39+
};
40+
};
41+
42+
&cdc_acm_uart0 {
43+
status = "okay";
44+
};
45+
46+
&quadspi {
47+
compatible = "st,stm32-qspi-controller";
48+
reg = <0x52005000 0x1000>, <0x90000000 DT_SIZE_M(256)>;
49+
interrupts = <92 0>;
50+
clocks = <&rcc STM32_CLOCK(AHB3, 14U)>;
51+
clock-names = "qspix";
52+
#address-cells = <1>;
53+
#size-cells = <0>;
54+
clock-frequency = <DT_FREQ_M(25)>;
55+
op-mode = "MSPI_CONTROLLER";
56+
duplex = "MSPI_HALF_DUPLEX";
57+
58+
status = "okay";
59+
pinctrl-0 = <&quadspi_clk_pf10 &quadspi_bk1_ncs_pg6
60+
&quadspi_bk1_io0_pd11 &quadspi_bk1_io1_pd12
61+
&quadspi_bk1_io2_pe2 &quadspi_bk1_io3_pf6>;
62+
pinctrl-names = "default";
63+
64+
n25q128a: qspi-nor-flash@0 {
65+
compatible = "jedec,mspi-nor";
66+
reg = <0>;
67+
size = <DT_SIZE_M(128)>; /* 128 Mbits */
68+
status = "okay";
69+
70+
mspi-max-frequency = <DT_FREQ_M(25)>;
71+
mspi-io-mode = "MSPI_IO_MODE_SINGLE";
72+
mspi-data-rate = "MSPI_DATA_RATE_SINGLE";
73+
mspi-hardware-ce-num = <0>;
74+
read-command = <0x0b>;
75+
write-command = <0x02>;
76+
command-length = "INSTR_1_BYTE";
77+
address-length = "ADDR_3_BYTE";
78+
rx-dummy = <8>;
79+
tx-dummy = <0>;
80+
jedec-id = [1f 89 01];
81+
82+
partitions {
83+
compatible = "fixed-partitions";
84+
#address-cells = <1>;
85+
#size-cells = <1>;
86+
87+
slot1_partition: partition@0 {
88+
label = "image-1";
89+
reg = <0x00000000 DT_SIZE_M(1)>;
90+
};
91+
92+
storage_partition: partition@100000 {
93+
label = "storage";
94+
reg = <0x00100000 DT_SIZE_M(15)>;
95+
};
96+
};
97+
};
98+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_LOG=y
2+
CONFIG_MSPI_LOG_LEVEL_INF=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+
status = "okay";
29+
pinctrl-0 = <&octospim_p2_clk_pf4 &octospim_p2_ncs_pi5
30+
&octospim_p2_io0_pf0 &octospim_p2_io1_pf1
31+
&octospim_p2_io2_pf2 &octospim_p2_io3_pf3
32+
&octospim_p2_io4_ph9 &octospim_p2_io5_ph10
33+
&octospim_p2_io6_ph11 &octospim_p2_io7_ph12
34+
&octospim_p2_dqs_pf12>;
35+
pinctrl-names = "default";
36+
dmas = <&gpdma1 12 41 0x10480>; /* request 41 for OCTOSPI2 */
37+
dma-names = "tx_rx";
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+
status = "okay";
45+
mspi-io-mode = "MSPI_IO_MODE_OCTAL";
46+
mspi-data-rate = "MSPI_DATA_RATE_DUAL"; /* as first step */
47+
mspi-hardware-ce-num = <0>;
48+
read-command = <0xEE11>; /* ReaD 4Bytes */
49+
command-length = "INSTR_2_BYTE";
50+
write-command = <0x12ED>; /* WRite 4Bytes */
51+
rx-dummy = <20>;
52+
jedec-id = [c2 85 3a];
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: 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_HEAP_MEM_POOL_SIZE=8192
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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_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+
partitions {
56+
compatible = "fixed-partitions";
57+
#address-cells = <1>;
58+
#size-cells = <1>;
59+
60+
slot0_partition: partition@0 {
61+
label = "nor";
62+
reg = <0x00000000 DT_SIZE_M(64)>;
63+
};
64+
};
65+
};
66+
};
67+
};
68+
};
69+
70+
&gpdma1 {
71+
status = "okay";
72+
};
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)