aboutsummaryrefslogtreecommitdiff
path: root/examples/nrf54l15
diff options
context:
space:
mode:
authornerwalt <[email protected]>2025-08-07 09:07:29 -0600
committernerwalt <[email protected]>2025-08-08 09:56:00 -0600
commita165339276e751909a88f685760f4cabb71e50d1 (patch)
tree23aedb8e0913e1f25a45576d51d71214815ba9ee /examples/nrf54l15
parentf2be66a5f94a655696407e2e7bc81c322aab3ea1 (diff)
Adds RRAMC support for the nrf54l15
Adds an Nvmc driver alias for compatibility
Diffstat (limited to 'examples/nrf54l15')
-rw-r--r--examples/nrf54l15/Cargo.toml2
-rw-r--r--examples/nrf54l15/src/bin/nvmc.rs44
2 files changed, 46 insertions, 0 deletions
diff --git a/examples/nrf54l15/Cargo.toml b/examples/nrf54l15/Cargo.toml
index faa3a4abe..5f1ee50a0 100644
--- a/examples/nrf54l15/Cargo.toml
+++ b/examples/nrf54l15/Cargo.toml
@@ -16,5 +16,7 @@ panic-probe = { version = "1.0.0", features = ["print-defmt"] }
16cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } 16cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
17cortex-m-rt = "0.7.0" 17cortex-m-rt = "0.7.0"
18 18
19embedded-storage = "0.3.1"
20
19[profile.release] 21[profile.release]
20debug = 2 22debug = 2
diff --git a/examples/nrf54l15/src/bin/nvmc.rs b/examples/nrf54l15/src/bin/nvmc.rs
new file mode 100644
index 000000000..f990604cd
--- /dev/null
+++ b/examples/nrf54l15/src/bin/nvmc.rs
@@ -0,0 +1,44 @@
1#![no_std]
2#![no_main]
3
4use defmt::{info, unwrap};
5use embassy_executor::Spawner;
6use embassy_nrf::nvmc::{Nvmc, PAGE_SIZE};
7use embedded_storage::nor_flash::{NorFlash, ReadNorFlash};
8use {defmt_rtt as _, panic_probe as _};
9
10#[embassy_executor::main]
11async fn main(_spawner: Spawner) {
12 let p = embassy_nrf::init(Default::default());
13 info!("Hello RRAMC NVMC!");
14
15 let mut f = Nvmc::new(p.RRAMC);
16
17 const ADDR: u32 = 0x80000;
18 let mut buf = [0u8; 4];
19
20 info!("Reading...");
21 unwrap!(f.read(ADDR, &mut buf));
22 info!("Read: {=[u8]:x}", buf);
23
24 info!("Erasing...");
25 unwrap!(f.erase(ADDR, ADDR + PAGE_SIZE as u32));
26
27 info!("Reading...");
28 unwrap!(f.read(ADDR, &mut buf));
29 info!("Read: {=[u8]:x}", buf);
30
31 info!("Writing...");
32 // 16 B (128-bit) write minimum
33 let out: [u8; 16] = [
34 0xaa, 0xaa, 0xaa, 0xaa, 0xbb, 0xbb, 0xbb, 0xbb, 0xcc, 0xcc, 0xcc, 0xcc, 0xdd, 0xdd, 0xdd, 0xdd,
35 ];
36 unwrap!(f.write(ADDR, &out));
37
38 info!("Reading...");
39 // Can read arbitrary sizes
40 for addr in (ADDR..ADDR + 16).step_by(4) {
41 unwrap!(f.read(addr, &mut buf));
42 info!("Read: {=[u8]:x}", buf);
43 }
44}