Skip to content

Commit 133a89d

Browse files
ananglcarlescufi
authored andcommitted
samples: zephyr: drivers: Add sQSPI scenario for spi_flash and jesd216
Add NCS specific configurations for two standard Zephyr samples: spi_flash and jesd216, so that they can be run on the nRF54L15 DK using the sQSPI soft peripheral. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 64554f6 commit 133a89d

File tree

9 files changed

+252
-0
lines changed

9 files changed

+252
-0
lines changed

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,9 @@
676676
/samples/zephyr/drivers/counter/ @nrfconnect/ncs-low-level-test
677677
/samples/zephyr/drivers/audio/dmic/ @nrfconnect/ncs-low-level-test
678678
/samples/zephyr/drivers/i2c/rtio_loopback/ @nrfconnect/ncs-low-level-test
679+
/samples/zephyr/drivers/jesd216/ @nrfconnect/ncs-low-level-test
679680
/samples/zephyr/drivers/mbox/ @nrfconnect/ncs-low-level-test
681+
/samples/zephyr/drivers/spi_flash/ @nrfconnect/ncs-low-level-test
680682
/samples/zephyr/drivers/watchdog/ @nrfconnect/ncs-low-level-test
681683
/samples/zephyr/sensor/accel_polling/ @nrfconnect/ncs-low-level-test
682684
/samples/zephyr/sensor/bme680/ @nrfconnect/ncs-low-level-test
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
2+
3+
cmake_minimum_required(VERSION 3.20.0)
4+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
5+
project(flash_jesd216)
6+
7+
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers/flash)
8+
9+
target_sources(app PRIVATE ${ZEPHYR_BASE}/samples/drivers/jesd216/src/main.c)
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
&pinctrl {
2+
sqspi_default: sqspi_default {
3+
group1 {
4+
psels = <NRF_PSEL(SDP_MSPI_SCK, 2, 1)>,
5+
<NRF_PSEL(SDP_MSPI_CS0, 2, 5)>,
6+
<NRF_PSEL(SDP_MSPI_DQ0, 2, 2)>;
7+
nordic,drive-mode = <NRF_DRIVE_E0E1>;
8+
};
9+
group2 {
10+
psels = <NRF_PSEL(SDP_MSPI_DQ1, 2, 4)>,
11+
<NRF_PSEL(SDP_MSPI_DQ2, 2, 3)>,
12+
<NRF_PSEL(SDP_MSPI_DQ3, 2, 0)>;
13+
nordic,drive-mode = <NRF_DRIVE_E0E1>;
14+
bias-pull-up;
15+
};
16+
};
17+
18+
sqspi_sleep: sqspi_sleep {
19+
group1 {
20+
low-power-enable;
21+
psels = <NRF_PSEL(SDP_MSPI_SCK, 2, 1)>,
22+
<NRF_PSEL(SDP_MSPI_CS0, 2, 5)>,
23+
<NRF_PSEL(SDP_MSPI_DQ0, 2, 2)>,
24+
<NRF_PSEL(SDP_MSPI_DQ1, 2, 4)>,
25+
<NRF_PSEL(SDP_MSPI_DQ2, 2, 3)>,
26+
<NRF_PSEL(SDP_MSPI_DQ3, 2, 0)>;
27+
};
28+
};
29+
};
30+
31+
&cpuflpr_vpr {
32+
pinctrl-0 = <&sqspi_default>;
33+
pinctrl-1 = <&sqspi_sleep>;
34+
pinctrl-names = "default", "sleep";
35+
interrupts = <76 NRF_DEFAULT_IRQ_PRIORITY>;
36+
status = "okay";
37+
};
38+
39+
/ {
40+
reserved-memory {
41+
#address-cells = <1>;
42+
#size-cells = <1>;
43+
ranges;
44+
45+
softperipheral_ram: memory@2003c000 {
46+
reg = <0x2003c000 0x4000>;
47+
ranges = <0 0x2003c000 0x4000>;
48+
#address-cells = <1>;
49+
#size-cells = <1>;
50+
51+
sqspi: sqspi@3c00 {
52+
compatible = "nordic,nrf-sqspi";
53+
#address-cells = <1>;
54+
#size-cells = <0>;
55+
reg = <0x3c00 0x200>;
56+
status = "okay";
57+
zephyr,pm-device-runtime-auto;
58+
};
59+
};
60+
};
61+
};
62+
63+
/delete-node/ &mx25r64;
64+
65+
&sqspi {
66+
mx25r64: mx25r6435f@0 {
67+
compatible = "mxicy,mx25r", "jedec,mspi-nor";
68+
status = "okay";
69+
reg = <0>;
70+
jedec-id = [c2 28 17];
71+
quad-enable-requirements = "S1B6";
72+
sfdp-bfp = [
73+
e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb
74+
ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
75+
10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44
76+
30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
77+
];
78+
size = <67108864>;
79+
has-dpd;
80+
t-enter-dpd = <10000>;
81+
t-exit-dpd = <35000>;
82+
t-reset-pulse = <10000>;
83+
t-reset-recovery = <35000>;
84+
85+
mspi-max-frequency = <DT_FREQ_M(8)>;
86+
mspi-io-mode = "MSPI_IO_MODE_QUAD_1_4_4";
87+
mspi-data-rate = "MSPI_DATA_RATE_SINGLE";
88+
mspi-hardware-ce-num = <1>;
89+
mspi-cpp-mode = "MSPI_CPP_MODE_0";
90+
mspi-endian = "MSPI_BIG_ENDIAN";
91+
mspi-ce-polarity = "MSPI_CE_ACTIVE_LOW";
92+
};
93+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONFIG_STDOUT_CONSOLE=y
2+
CONFIG_FLASH=y
3+
CONFIG_FLASH_JESD216_API=y
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
sample:
2+
name: JESD216 Sample
3+
common:
4+
tags:
5+
- spi
6+
- flash
7+
harness: console
8+
harness_config:
9+
type: multi_line
10+
ordered: true
11+
regex:
12+
- "sfdp-bfp ="
13+
- "jedec-id ="
14+
tests:
15+
sample.drivers.spi.jesd216.sqspi:
16+
filter: CONFIG_MSPI_SQSPI and dt_compat_enabled("jedec,mspi-nor")
17+
integration_platforms:
18+
- nrf54l15dk/nrf54l15/cpuapp
19+
extra_args:
20+
- DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_sqspi.overlay"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
2+
3+
cmake_minimum_required(VERSION 3.20.0)
4+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
5+
project(spi_flash)
6+
7+
target_sources(app PRIVATE ${ZEPHYR_BASE}/samples/drivers/spi_flash/src/main.c)
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
&pinctrl {
2+
sqspi_default: sqspi_default {
3+
group1 {
4+
psels = <NRF_PSEL(SDP_MSPI_SCK, 2, 1)>,
5+
<NRF_PSEL(SDP_MSPI_CS0, 2, 5)>,
6+
<NRF_PSEL(SDP_MSPI_DQ0, 2, 2)>;
7+
nordic,drive-mode = <NRF_DRIVE_E0E1>;
8+
};
9+
group2 {
10+
psels = <NRF_PSEL(SDP_MSPI_DQ1, 2, 4)>,
11+
<NRF_PSEL(SDP_MSPI_DQ2, 2, 3)>,
12+
<NRF_PSEL(SDP_MSPI_DQ3, 2, 0)>;
13+
nordic,drive-mode = <NRF_DRIVE_E0E1>;
14+
bias-pull-up;
15+
};
16+
};
17+
18+
sqspi_sleep: sqspi_sleep {
19+
group1 {
20+
low-power-enable;
21+
psels = <NRF_PSEL(SDP_MSPI_SCK, 2, 1)>,
22+
<NRF_PSEL(SDP_MSPI_CS0, 2, 5)>,
23+
<NRF_PSEL(SDP_MSPI_DQ0, 2, 2)>,
24+
<NRF_PSEL(SDP_MSPI_DQ1, 2, 4)>,
25+
<NRF_PSEL(SDP_MSPI_DQ2, 2, 3)>,
26+
<NRF_PSEL(SDP_MSPI_DQ3, 2, 0)>;
27+
};
28+
};
29+
};
30+
31+
&cpuflpr_vpr {
32+
pinctrl-0 = <&sqspi_default>;
33+
pinctrl-1 = <&sqspi_sleep>;
34+
pinctrl-names = "default", "sleep";
35+
interrupts = <76 NRF_DEFAULT_IRQ_PRIORITY>;
36+
status = "okay";
37+
};
38+
39+
/ {
40+
reserved-memory {
41+
#address-cells = <1>;
42+
#size-cells = <1>;
43+
ranges;
44+
45+
softperipheral_ram: memory@2003c000 {
46+
reg = <0x2003c000 0x4000>;
47+
ranges = <0 0x2003c000 0x4000>;
48+
#address-cells = <1>;
49+
#size-cells = <1>;
50+
51+
sqspi: sqspi@3c00 {
52+
compatible = "nordic,nrf-sqspi";
53+
#address-cells = <1>;
54+
#size-cells = <0>;
55+
reg = <0x3c00 0x200>;
56+
status = "okay";
57+
zephyr,pm-device-runtime-auto;
58+
};
59+
};
60+
};
61+
};
62+
63+
/delete-node/ &mx25r64;
64+
65+
&sqspi {
66+
mx25r64: mx25r6435f@0 {
67+
compatible = "mxicy,mx25r", "jedec,mspi-nor";
68+
status = "okay";
69+
reg = <0>;
70+
jedec-id = [c2 28 17];
71+
quad-enable-requirements = "S1B6";
72+
sfdp-bfp = [
73+
e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb
74+
ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
75+
10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44
76+
30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
77+
];
78+
size = <67108864>;
79+
has-dpd;
80+
t-enter-dpd = <10000>;
81+
t-exit-dpd = <35000>;
82+
t-reset-pulse = <10000>;
83+
t-reset-recovery = <35000>;
84+
85+
mspi-max-frequency = <DT_FREQ_M(8)>;
86+
mspi-io-mode = "MSPI_IO_MODE_QUAD_1_4_4";
87+
mspi-data-rate = "MSPI_DATA_RATE_SINGLE";
88+
mspi-hardware-ce-num = <1>;
89+
mspi-cpp-mode = "MSPI_CPP_MODE_0";
90+
mspi-endian = "MSPI_BIG_ENDIAN";
91+
mspi-ce-polarity = "MSPI_CE_ACTIVE_LOW";
92+
};
93+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_STDOUT_CONSOLE=y
2+
CONFIG_FLASH=y
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
sample:
2+
name: SPI Flash Sample
3+
common:
4+
tags:
5+
- spi
6+
- flash
7+
harness: console
8+
harness_config:
9+
type: multi_line
10+
ordered: true
11+
regex:
12+
- "Test 1: Flash erase"
13+
- "Flash erase succeeded!"
14+
- "Test 2: Flash write"
15+
- "Attempting to write 4 bytes"
16+
- "Data read matches data written. Good!!"
17+
tests:
18+
sample.drivers.spi.flash.sqspi:
19+
filter: CONFIG_MSPI_SQSPI and dt_compat_enabled("jedec,mspi-nor")
20+
integration_platforms:
21+
- nrf54l15dk/nrf54l15/cpuapp
22+
extra_args:
23+
- DTC_OVERLAY_FILE="boards/nrf54l15dk_nrf54l15_cpuapp_sqspi.overlay"

0 commit comments

Comments
 (0)