Skip to content

Commit 834dc73

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 4c519da commit 834dc73

8 files changed

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

0 commit comments

Comments
 (0)