aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/boot/application/stm32f7/Cargo.toml2
-rw-r--r--examples/boot/application/stm32wb-dfu/src/main.rs4
-rw-r--r--examples/boot/application/stm32wl/src/bin/a.rs2
-rw-r--r--examples/boot/application/stm32wl/src/bin/b.rs2
-rw-r--r--examples/boot/bootloader/stm32wb-dfu/src/main.rs4
-rw-r--r--examples/mimxrt6/Cargo.toml4
-rw-r--r--examples/mimxrt6/build.rs2
-rw-r--r--examples/mimxrt6/src/bin/crc.rs175
-rw-r--r--examples/mimxrt6/src/bin/rng.rs40
-rw-r--r--examples/mimxrt6/src/lib.rs6
-rw-r--r--examples/nrf52840/src/bin/twim.rs4
-rw-r--r--examples/nrf52840/src/bin/twim_lowpower.rs2
-rw-r--r--examples/rp/src/bin/overclock.rs64
-rw-r--r--examples/rp/src/bin/overclock_manual.rs81
-rw-r--r--examples/rp/src/bin/sharing.rs2
-rw-r--r--examples/rp/src/bin/uart_buffered_split.rs2
-rw-r--r--examples/rp/src/bin/uart_unidir.rs2
-rw-r--r--examples/rp235x/src/bin/blinky.rs2
-rw-r--r--examples/rp235x/src/bin/blinky_wifi.rs2
-rw-r--r--examples/rp235x/src/bin/blinky_wifi_pico_plus_2.rs2
-rw-r--r--examples/rp235x/src/bin/overclock.rs74
-rw-r--r--examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs6
-rw-r--r--examples/rp235x/src/bin/sharing.rs2
-rw-r--r--examples/rp235x/src/bin/uart_buffered_split.rs2
-rw-r--r--examples/rp235x/src/bin/uart_unidir.rs2
-rw-r--r--examples/stm32f7/Cargo.toml2
-rw-r--r--examples/stm32h7/src/bin/adc_dma.rs2
-rw-r--r--examples/stm32h7/src/bin/sai.rs8
-rw-r--r--examples/stm32h7/src/bin/spi_bdma.rs2
-rw-r--r--examples/stm32h723/src/bin/spdifrx.rs4
-rw-r--r--examples/stm32h755cm4/src/bin/blinky.rs2
-rw-r--r--examples/stm32h755cm7/src/bin/blinky.rs2
-rw-r--r--examples/stm32l4/Cargo.toml2
-rw-r--r--examples/stm32l5/Cargo.toml2
-rw-r--r--examples/stm32wl/src/bin/blinky.rs2
-rw-r--r--examples/stm32wl/src/bin/button.rs2
-rw-r--r--examples/stm32wl/src/bin/button_exti.rs2
-rw-r--r--examples/stm32wl/src/bin/flash.rs2
-rw-r--r--examples/stm32wl/src/bin/random.rs2
-rw-r--r--examples/stm32wl/src/bin/rtc.rs2
-rw-r--r--examples/stm32wl/src/bin/uart_async.rs2
41 files changed, 485 insertions, 45 deletions
diff --git a/examples/boot/application/stm32f7/Cargo.toml b/examples/boot/application/stm32f7/Cargo.toml
index 6a5a500de..d62c67742 100644
--- a/examples/boot/application/stm32f7/Cargo.toml
+++ b/examples/boot/application/stm32f7/Cargo.toml
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
8embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" } 8embassy-sync = { version = "0.6.2", path = "../../../../embassy-sync" }
9embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread"] } 9embassy-executor = { version = "0.7.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread"] }
10embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] } 10embassy-time = { version = "0.4.0", path = "../../../../embassy-time", features = [ "tick-hz-32_768"] }
11embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32f767zi", "time-driver-any", "exti"] } 11embassy-stm32 = { version = "0.2.0", path = "../../../../embassy-stm32", features = ["stm32f767zi", "time-driver-any", "exti", "single-bank"] }
12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] } 12embassy-boot-stm32 = { version = "0.2.0", path = "../../../../embassy-boot-stm32", features = [] }
13embassy-embedded-hal = { version = "0.3.0", path = "../../../../embassy-embedded-hal" } 13embassy-embedded-hal = { version = "0.3.0", path = "../../../../embassy-embedded-hal" }
14 14
diff --git a/examples/boot/application/stm32wb-dfu/src/main.rs b/examples/boot/application/stm32wb-dfu/src/main.rs
index 0ab99ff90..dda2b795b 100644
--- a/examples/boot/application/stm32wb-dfu/src/main.rs
+++ b/examples/boot/application/stm32wb-dfu/src/main.rs
@@ -44,7 +44,7 @@ async fn main(_spawner: Spawner) {
44 let mut config_descriptor = [0; 256]; 44 let mut config_descriptor = [0; 256];
45 let mut bos_descriptor = [0; 256]; 45 let mut bos_descriptor = [0; 256];
46 let mut control_buf = [0; 64]; 46 let mut control_buf = [0; 64];
47 let mut state = Control::new(firmware_state, DfuAttributes::CAN_DOWNLOAD); 47 let mut state = Control::new(firmware_state, DfuAttributes::CAN_DOWNLOAD, ResetImmediate);
48 let mut builder = Builder::new( 48 let mut builder = Builder::new(
49 driver, 49 driver,
50 config, 50 config,
@@ -54,7 +54,7 @@ async fn main(_spawner: Spawner) {
54 &mut control_buf, 54 &mut control_buf,
55 ); 55 );
56 56
57 usb_dfu::<_, _, ResetImmediate>(&mut builder, &mut state, Duration::from_millis(2500)); 57 usb_dfu(&mut builder, &mut state, Duration::from_millis(2500));
58 58
59 let mut dev = builder.build(); 59 let mut dev = builder.build();
60 dev.run().await 60 dev.run().await
diff --git a/examples/boot/application/stm32wl/src/bin/a.rs b/examples/boot/application/stm32wl/src/bin/a.rs
index 127de0237..e4526927f 100644
--- a/examples/boot/application/stm32wl/src/bin/a.rs
+++ b/examples/boot/application/stm32wl/src/bin/a.rs
@@ -20,7 +20,7 @@ static APP_B: &[u8] = &[0, 1, 2, 3];
20#[cfg(not(feature = "skip-include"))] 20#[cfg(not(feature = "skip-include"))]
21static APP_B: &[u8] = include_bytes!("../../b.bin"); 21static APP_B: &[u8] = include_bytes!("../../b.bin");
22 22
23#[link_section = ".shared_data"] 23#[unsafe(link_section = ".shared_data")]
24static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); 24static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
25 25
26#[embassy_executor::main] 26#[embassy_executor::main]
diff --git a/examples/boot/application/stm32wl/src/bin/b.rs b/examples/boot/application/stm32wl/src/bin/b.rs
index 768dadf8b..6016a9555 100644
--- a/examples/boot/application/stm32wl/src/bin/b.rs
+++ b/examples/boot/application/stm32wl/src/bin/b.rs
@@ -11,7 +11,7 @@ use embassy_stm32::SharedData;
11use embassy_time::Timer; 11use embassy_time::Timer;
12use panic_reset as _; 12use panic_reset as _;
13 13
14#[link_section = ".shared_data"] 14#[unsafe(link_section = ".shared_data")]
15static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); 15static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
16 16
17#[embassy_executor::main] 17#[embassy_executor::main]
diff --git a/examples/boot/bootloader/stm32wb-dfu/src/main.rs b/examples/boot/bootloader/stm32wb-dfu/src/main.rs
index b09d53cf0..28216806e 100644
--- a/examples/boot/bootloader/stm32wb-dfu/src/main.rs
+++ b/examples/boot/bootloader/stm32wb-dfu/src/main.rs
@@ -55,7 +55,7 @@ fn main() -> ! {
55 let mut config_descriptor = [0; 256]; 55 let mut config_descriptor = [0; 256];
56 let mut bos_descriptor = [0; 256]; 56 let mut bos_descriptor = [0; 256];
57 let mut control_buf = [0; 4096]; 57 let mut control_buf = [0; 4096];
58 let mut state = Control::new(updater, DfuAttributes::CAN_DOWNLOAD); 58 let mut state = Control::new(updater, DfuAttributes::CAN_DOWNLOAD, ResetImmediate);
59 let mut builder = Builder::new( 59 let mut builder = Builder::new(
60 driver, 60 driver,
61 config, 61 config,
@@ -77,7 +77,7 @@ fn main() -> ! {
77 msos::PropertyData::RegMultiSz(DEVICE_INTERFACE_GUIDS), 77 msos::PropertyData::RegMultiSz(DEVICE_INTERFACE_GUIDS),
78 )); 78 ));
79 79
80 usb_dfu::<_, _, _, ResetImmediate, 4096>(&mut builder, &mut state); 80 usb_dfu::<_, _, _, _, 4096>(&mut builder, &mut state);
81 81
82 let mut dev = builder.build(); 82 let mut dev = builder.build();
83 embassy_futures::block_on(dev.run()); 83 embassy_futures::block_on(dev.run());
diff --git a/examples/mimxrt6/Cargo.toml b/examples/mimxrt6/Cargo.toml
index 8fc510c47..b0c56f003 100644
--- a/examples/mimxrt6/Cargo.toml
+++ b/examples/mimxrt6/Cargo.toml
@@ -12,8 +12,8 @@ defmt-rtt = "1.0"
12 12
13embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } 13embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] }
14embassy-futures = { version = "0.1.1", path = "../../embassy-futures" } 14embassy-futures = { version = "0.1.1", path = "../../embassy-futures" }
15embassy-imxrt = { version = "0.1.0", path = "../../embassy-imxrt", features = ["defmt", "mimxrt685s", "unstable-pac", "time", "time-driver-rtc"] } 15embassy-imxrt = { version = "0.1.0", path = "../../embassy-imxrt", features = ["defmt", "mimxrt685s", "unstable-pac", "time", "time-driver-os-timer"] }
16embassy-time = { version = "0.4", path = "../../embassy-time" } 16embassy-time = { version = "0.4", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
17embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } 17embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] }
18embedded-hal-1 = { package = "embedded-hal", version = "1.0" } 18embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
19embedded-hal-async = "1.0.0" 19embedded-hal-async = "1.0.0"
diff --git a/examples/mimxrt6/build.rs b/examples/mimxrt6/build.rs
index 9c0ed3213..56010dfd6 100644
--- a/examples/mimxrt6/build.rs
+++ b/examples/mimxrt6/build.rs
@@ -25,7 +25,7 @@ fn main() {
25 .write_all( 25 .write_all(
26 format!( 26 format!(
27 r##" 27 r##"
28#[link_section = ".biv"] 28#[unsafe(link_section = ".biv")]
29#[used] 29#[used]
30static BOOT_IMAGE_VERSION: u32 = 0x{:02x}{:02x}{:02x}00; 30static BOOT_IMAGE_VERSION: u32 = 0x{:02x}{:02x}{:02x}00;
31"##, 31"##,
diff --git a/examples/mimxrt6/src/bin/crc.rs b/examples/mimxrt6/src/bin/crc.rs
new file mode 100644
index 000000000..005a250e5
--- /dev/null
+++ b/examples/mimxrt6/src/bin/crc.rs
@@ -0,0 +1,175 @@
1#![no_std]
2#![no_main]
3
4extern crate embassy_imxrt_examples;
5
6use defmt::*;
7use embassy_executor::Spawner;
8use embassy_imxrt::crc::{Config, Crc, Polynomial};
9use {defmt_rtt as _, panic_probe as _};
10
11#[embassy_executor::main]
12async fn main(_spawner: Spawner) {
13 let mut p = embassy_imxrt::init(Default::default());
14 let data = b"123456789";
15
16 info!("Initializing CRC");
17
18 // CRC-CCITT
19 let mut crc = Crc::new(p.CRC.reborrow(), Default::default());
20 let output = crc.feed_bytes(data);
21 defmt::assert_eq!(output, 0x29b1);
22
23 // CRC16-ARC
24 let mut crc = Crc::new(
25 p.CRC.reborrow(),
26 Config {
27 polynomial: Polynomial::Crc16,
28 reverse_in: true,
29 reverse_out: true,
30 complement_out: false,
31 seed: 0,
32 ..Default::default()
33 },
34 );
35 let output = crc.feed_bytes(data);
36 defmt::assert_eq!(output, 0xbb3d);
37
38 // CRC16-CMS
39 let mut crc = Crc::new(
40 p.CRC.reborrow(),
41 Config {
42 polynomial: Polynomial::Crc16,
43 reverse_in: false,
44 reverse_out: false,
45 complement_out: false,
46 seed: 0xffff,
47 ..Default::default()
48 },
49 );
50 let output = crc.feed_bytes(data);
51 defmt::assert_eq!(output, 0xaee7);
52
53 // CRC16-DDS-110
54 let mut crc = Crc::new(
55 p.CRC.reborrow(),
56 Config {
57 polynomial: Polynomial::Crc16,
58 reverse_in: false,
59 reverse_out: false,
60 complement_out: false,
61 seed: 0x800d,
62 ..Default::default()
63 },
64 );
65 let output = crc.feed_bytes(data);
66 defmt::assert_eq!(output, 0x9ecf);
67
68 // CRC16-MAXIM-DOW
69 let mut crc = Crc::new(
70 p.CRC.reborrow(),
71 Config {
72 polynomial: Polynomial::Crc16,
73 reverse_in: true,
74 reverse_out: true,
75 complement_out: true,
76 seed: 0,
77 ..Default::default()
78 },
79 );
80 let output = crc.feed_bytes(data);
81 defmt::assert_eq!(output, 0x44c2);
82
83 // CRC16-MODBUS
84 let mut crc = Crc::new(
85 p.CRC.reborrow(),
86 Config {
87 polynomial: Polynomial::Crc16,
88 reverse_in: true,
89 reverse_out: true,
90 complement_out: false,
91 seed: 0xffff,
92 ..Default::default()
93 },
94 );
95 let output = crc.feed_bytes(data);
96 defmt::assert_eq!(output, 0x4b37);
97
98 // CRC32-BZIP2
99 let mut crc = Crc::new(
100 p.CRC.reborrow(),
101 Config {
102 polynomial: Polynomial::Crc32,
103 reverse_in: false,
104 reverse_out: false,
105 complement_out: true,
106 seed: 0xffff_ffff,
107 ..Default::default()
108 },
109 );
110 let output = crc.feed_bytes(data);
111 defmt::assert_eq!(output, 0xfc89_1918);
112
113 // CRC32-CKSUM
114 let mut crc = Crc::new(
115 p.CRC.reborrow(),
116 Config {
117 polynomial: Polynomial::Crc32,
118 reverse_in: false,
119 reverse_out: false,
120 complement_out: true,
121 seed: 0,
122 ..Default::default()
123 },
124 );
125 let output = crc.feed_bytes(data);
126 defmt::assert_eq!(output, 0x765e_7680);
127
128 // CRC32-ISO-HDLC
129 let mut crc = Crc::new(
130 p.CRC.reborrow(),
131 Config {
132 polynomial: Polynomial::Crc32,
133 reverse_in: true,
134 reverse_out: true,
135 complement_out: true,
136 seed: 0xffff_ffff,
137 ..Default::default()
138 },
139 );
140 let output = crc.feed_bytes(data);
141 defmt::assert_eq!(output, 0xcbf4_3926);
142
143 // CRC32-JAMCRC
144 let mut crc = Crc::new(
145 p.CRC.reborrow(),
146 Config {
147 polynomial: Polynomial::Crc32,
148 reverse_in: true,
149 reverse_out: true,
150 complement_out: false,
151 seed: 0xffff_ffff,
152 ..Default::default()
153 },
154 );
155 let output = crc.feed_bytes(data);
156 defmt::assert_eq!(output, 0x340b_c6d9);
157
158 // CRC32-MPEG-2
159 let mut crc = Crc::new(
160 p.CRC.reborrow(),
161 Config {
162 polynomial: Polynomial::Crc32,
163 reverse_in: false,
164 reverse_out: false,
165 complement_out: false,
166 seed: 0xffff_ffff,
167 ..Default::default()
168 },
169 );
170 let output = crc.feed_bytes(data);
171 defmt::assert_eq!(output, 0x0376_e6e7);
172
173 info!("end program");
174 cortex_m::asm::bkpt();
175}
diff --git a/examples/mimxrt6/src/bin/rng.rs b/examples/mimxrt6/src/bin/rng.rs
new file mode 100644
index 000000000..5f64cb96a
--- /dev/null
+++ b/examples/mimxrt6/src/bin/rng.rs
@@ -0,0 +1,40 @@
1#![no_std]
2#![no_main]
3
4extern crate embassy_imxrt_examples;
5
6use defmt::*;
7use embassy_executor::Spawner;
8use embassy_imxrt::rng::Rng;
9use embassy_imxrt::{bind_interrupts, peripherals, rng};
10use rand::RngCore;
11use {defmt_rtt as _, panic_probe as _};
12
13bind_interrupts!(struct Irqs {
14 RNG => rng::InterruptHandler<peripherals::RNG>;
15});
16
17#[embassy_executor::main]
18async fn main(_spawner: Spawner) {
19 let p = embassy_imxrt::init(Default::default());
20
21 info!("Initializing RNG");
22 let mut rng = Rng::new(p.RNG, Irqs);
23 let mut buf = [0u8; 65];
24
25 // Async interface
26 unwrap!(rng.async_fill_bytes(&mut buf).await);
27 info!("random bytes: {:02x}", buf);
28
29 // RngCore interface
30 let mut random_bytes = [0; 16];
31
32 let random_u32 = rng.next_u32();
33 let random_u64 = rng.next_u64();
34
35 rng.fill_bytes(&mut random_bytes);
36
37 info!("random_u32 {}", random_u32);
38 info!("random_u64 {}", random_u64);
39 info!("random_bytes {}", random_bytes);
40}
diff --git a/examples/mimxrt6/src/lib.rs b/examples/mimxrt6/src/lib.rs
index da6e14427..3c3ea1981 100644
--- a/examples/mimxrt6/src/lib.rs
+++ b/examples/mimxrt6/src/lib.rs
@@ -6,15 +6,15 @@ use {defmt_rtt as _, panic_probe as _};
6// auto-generated version information from Cargo.toml 6// auto-generated version information from Cargo.toml
7include!(concat!(env!("OUT_DIR"), "/biv.rs")); 7include!(concat!(env!("OUT_DIR"), "/biv.rs"));
8 8
9#[link_section = ".otfad"] 9#[unsafe(link_section = ".otfad")]
10#[used] 10#[used]
11static OTFAD: [u8; 256] = [0; 256]; 11static OTFAD: [u8; 256] = [0; 256];
12 12
13#[rustfmt::skip] 13#[rustfmt::skip]
14#[link_section = ".fcb"] 14#[unsafe(link_section = ".fcb")]
15#[used] 15#[used]
16static FCB: FlexSPIFlashConfigurationBlock = FlexSPIFlashConfigurationBlock::build(); 16static FCB: FlexSPIFlashConfigurationBlock = FlexSPIFlashConfigurationBlock::build();
17 17
18#[link_section = ".keystore"] 18#[unsafe(link_section = ".keystore")]
19#[used] 19#[used]
20static KEYSTORE: [u8; 2048] = [0; 2048]; 20static KEYSTORE: [u8; 2048] = [0; 2048];
diff --git a/examples/nrf52840/src/bin/twim.rs b/examples/nrf52840/src/bin/twim.rs
index ceaafd784..e30a3855d 100644
--- a/examples/nrf52840/src/bin/twim.rs
+++ b/examples/nrf52840/src/bin/twim.rs
@@ -9,6 +9,7 @@ use defmt::*;
9use embassy_executor::Spawner; 9use embassy_executor::Spawner;
10use embassy_nrf::twim::{self, Twim}; 10use embassy_nrf::twim::{self, Twim};
11use embassy_nrf::{bind_interrupts, peripherals}; 11use embassy_nrf::{bind_interrupts, peripherals};
12use static_cell::ConstStaticCell;
12use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
13 14
14const ADDRESS: u8 = 0x50; 15const ADDRESS: u8 = 0x50;
@@ -22,7 +23,8 @@ async fn main(_spawner: Spawner) {
22 let p = embassy_nrf::init(Default::default()); 23 let p = embassy_nrf::init(Default::default());
23 info!("Initializing TWI..."); 24 info!("Initializing TWI...");
24 let config = twim::Config::default(); 25 let config = twim::Config::default();
25 let mut twi = Twim::new(p.TWISPI0, Irqs, p.P0_03, p.P0_04, config); 26 static RAM_BUFFER: ConstStaticCell<[u8; 16]> = ConstStaticCell::new([0; 16]);
27 let mut twi = Twim::new(p.TWISPI0, Irqs, p.P0_03, p.P0_04, config, RAM_BUFFER.take());
26 28
27 info!("Reading..."); 29 info!("Reading...");
28 30
diff --git a/examples/nrf52840/src/bin/twim_lowpower.rs b/examples/nrf52840/src/bin/twim_lowpower.rs
index 8a6f958eb..f7380e20d 100644
--- a/examples/nrf52840/src/bin/twim_lowpower.rs
+++ b/examples/nrf52840/src/bin/twim_lowpower.rs
@@ -30,6 +30,7 @@ async fn main(_p: Spawner) {
30 loop { 30 loop {
31 info!("Initializing TWI..."); 31 info!("Initializing TWI...");
32 let config = twim::Config::default(); 32 let config = twim::Config::default();
33 let mut ram_buffer = [0u8; 16];
33 34
34 // Create the TWIM instance with borrowed singletons, so they're not consumed. 35 // Create the TWIM instance with borrowed singletons, so they're not consumed.
35 let mut twi = Twim::new( 36 let mut twi = Twim::new(
@@ -38,6 +39,7 @@ async fn main(_p: Spawner) {
38 p.P0_03.reborrow(), 39 p.P0_03.reborrow(),
39 p.P0_04.reborrow(), 40 p.P0_04.reborrow(),
40 config, 41 config,
42 &mut ram_buffer,
41 ); 43 );
42 44
43 info!("Reading..."); 45 info!("Reading...");
diff --git a/examples/rp/src/bin/overclock.rs b/examples/rp/src/bin/overclock.rs
new file mode 100644
index 000000000..83b17308b
--- /dev/null
+++ b/examples/rp/src/bin/overclock.rs
@@ -0,0 +1,64 @@
1//! # Overclocking the RP2040 to 200 MHz
2//!
3//! This example demonstrates how to configure the RP2040 to run at 200 MHz.
4
5#![no_std]
6#![no_main]
7
8use defmt::*;
9use embassy_executor::Spawner;
10use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig};
11use embassy_rp::config::Config;
12use embassy_rp::gpio::{Level, Output};
13use embassy_time::{Duration, Instant, Timer};
14use {defmt_rtt as _, panic_probe as _};
15
16const COUNT_TO: i64 = 10_000_000;
17
18#[embassy_executor::main]
19async fn main(_spawner: Spawner) -> ! {
20 // Set up for clock frequency of 200 MHz, setting all necessary defaults.
21 let config = Config::new(ClockConfig::system_freq(200_000_000).unwrap());
22
23 // Initialize the peripherals
24 let p = embassy_rp::init(config);
25
26 // Show CPU frequency for verification
27 let sys_freq = clk_sys_freq();
28 info!("System clock frequency: {} MHz", sys_freq / 1_000_000);
29 // Show core voltage for verification
30 let core_voltage = core_voltage().unwrap();
31 info!("Core voltage: {}", core_voltage);
32
33 // LED to indicate the system is running
34 let mut led = Output::new(p.PIN_25, Level::Low);
35
36 loop {
37 // Reset the counter at the start of measurement period
38 let mut counter = 0;
39
40 // Turn LED on while counting
41 led.set_high();
42
43 let start = Instant::now();
44
45 // This is a busy loop that will take some time to complete
46 while counter < COUNT_TO {
47 counter += 1;
48 }
49
50 let elapsed = Instant::now() - start;
51
52 // Report the elapsed time
53 led.set_low();
54 info!(
55 "At {}Mhz: Elapsed time to count to {}: {}ms",
56 sys_freq / 1_000_000,
57 counter,
58 elapsed.as_millis()
59 );
60
61 // Wait 2 seconds before starting the next measurement
62 Timer::after(Duration::from_secs(2)).await;
63 }
64}
diff --git a/examples/rp/src/bin/overclock_manual.rs b/examples/rp/src/bin/overclock_manual.rs
new file mode 100644
index 000000000..dea5cfb3c
--- /dev/null
+++ b/examples/rp/src/bin/overclock_manual.rs
@@ -0,0 +1,81 @@
1//! # Overclocking the RP2040 to 200 MHz manually
2//!
3//! This example demonstrates how to manually configure the RP2040 to run at 200 MHz.
4
5#![no_std]
6#![no_main]
7
8use defmt::*;
9use embassy_executor::Spawner;
10use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig, CoreVoltage, PllConfig};
11use embassy_rp::config::Config;
12use embassy_rp::gpio::{Level, Output};
13use embassy_time::{Duration, Instant, Timer};
14use {defmt_rtt as _, panic_probe as _};
15
16const COUNT_TO: i64 = 10_000_000;
17
18/// Configure the RP2040 for 200 MHz operation by manually specifying the PLL settings.
19fn configure_manual_overclock() -> Config {
20 // Set the PLL configuration manually, starting from default values
21 let mut config = Config::default();
22
23 // Set the system clock to 200 MHz
24 config.clocks = ClockConfig::manual_pll(
25 12_000_000, // Crystal frequency, 12 MHz is common. If using custom, set to your value.
26 PllConfig {
27 refdiv: 1, // Reference divider
28 fbdiv: 100, // Feedback divider
29 post_div1: 3, // Post divider 1
30 post_div2: 2, // Post divider 2
31 },
32 CoreVoltage::V1_15, // Core voltage, should be set to V1_15 for 200 MHz
33 );
34
35 config
36}
37
38#[embassy_executor::main]
39async fn main(_spawner: Spawner) -> ! {
40 // Initialize with our manual overclock configuration
41 let p = embassy_rp::init(configure_manual_overclock());
42
43 // Show CPU frequency for verification
44 let sys_freq = clk_sys_freq();
45 info!("System clock frequency: {} MHz", sys_freq / 1_000_000);
46 // Show core voltage for verification
47 let core_voltage = core_voltage().unwrap();
48 info!("Core voltage: {}", core_voltage);
49
50 // LED to indicate the system is running
51 let mut led = Output::new(p.PIN_25, Level::Low);
52
53 loop {
54 // Reset the counter at the start of measurement period
55 let mut counter = 0;
56
57 // Turn LED on while counting
58 led.set_high();
59
60 let start = Instant::now();
61
62 // This is a busy loop that will take some time to complete
63 while counter < COUNT_TO {
64 counter += 1;
65 }
66
67 let elapsed = Instant::now() - start;
68
69 // Report the elapsed time
70 led.set_low();
71 info!(
72 "At {}Mhz: Elapsed time to count to {}: {}ms",
73 sys_freq / 1_000_000,
74 counter,
75 elapsed.as_millis()
76 );
77
78 // Wait 2 seconds before starting the next measurement
79 Timer::after(Duration::from_secs(2)).await;
80 }
81}
diff --git a/examples/rp/src/bin/sharing.rs b/examples/rp/src/bin/sharing.rs
index 5416e20ce..497c4f845 100644
--- a/examples/rp/src/bin/sharing.rs
+++ b/examples/rp/src/bin/sharing.rs
@@ -31,7 +31,7 @@ use rand::RngCore;
31use static_cell::{ConstStaticCell, StaticCell}; 31use static_cell::{ConstStaticCell, StaticCell};
32use {defmt_rtt as _, panic_probe as _}; 32use {defmt_rtt as _, panic_probe as _};
33 33
34type UartAsyncMutex = mutex::Mutex<CriticalSectionRawMutex, UartTx<'static, UART0, uart::Async>>; 34type UartAsyncMutex = mutex::Mutex<CriticalSectionRawMutex, UartTx<'static, uart::Async>>;
35 35
36struct MyType { 36struct MyType {
37 inner: u32, 37 inner: u32,
diff --git a/examples/rp/src/bin/uart_buffered_split.rs b/examples/rp/src/bin/uart_buffered_split.rs
index da7e94139..3adbc18ab 100644
--- a/examples/rp/src/bin/uart_buffered_split.rs
+++ b/examples/rp/src/bin/uart_buffered_split.rs
@@ -48,7 +48,7 @@ async fn main(spawner: Spawner) {
48} 48}
49 49
50#[embassy_executor::task] 50#[embassy_executor::task]
51async fn reader(mut rx: BufferedUartRx<'static, UART0>) { 51async fn reader(mut rx: BufferedUartRx) {
52 info!("Reading..."); 52 info!("Reading...");
53 loop { 53 loop {
54 let mut buf = [0; 31]; 54 let mut buf = [0; 31];
diff --git a/examples/rp/src/bin/uart_unidir.rs b/examples/rp/src/bin/uart_unidir.rs
index a45f40756..c2c8dfad8 100644
--- a/examples/rp/src/bin/uart_unidir.rs
+++ b/examples/rp/src/bin/uart_unidir.rs
@@ -39,7 +39,7 @@ async fn main(spawner: Spawner) {
39} 39}
40 40
41#[embassy_executor::task] 41#[embassy_executor::task]
42async fn reader(mut rx: UartRx<'static, UART1, Async>) { 42async fn reader(mut rx: UartRx<'static, Async>) {
43 info!("Reading..."); 43 info!("Reading...");
44 loop { 44 loop {
45 // read a total of 4 transmissions (32 / 8) and then print the result 45 // read a total of 4 transmissions (32 / 8) and then print the result
diff --git a/examples/rp235x/src/bin/blinky.rs b/examples/rp235x/src/bin/blinky.rs
index a36029f92..8a2464fbb 100644
--- a/examples/rp235x/src/bin/blinky.rs
+++ b/examples/rp235x/src/bin/blinky.rs
@@ -14,7 +14,7 @@ use {defmt_rtt as _, panic_probe as _};
14 14
15// Program metadata for `picotool info`. 15// Program metadata for `picotool info`.
16// This isn't needed, but it's recomended to have these minimal entries. 16// This isn't needed, but it's recomended to have these minimal entries.
17#[link_section = ".bi_entries"] 17#[unsafe(link_section = ".bi_entries")]
18#[used] 18#[used]
19pub static PICOTOOL_ENTRIES: [embassy_rp::binary_info::EntryAddr; 4] = [ 19pub static PICOTOOL_ENTRIES: [embassy_rp::binary_info::EntryAddr; 4] = [
20 embassy_rp::binary_info::rp_program_name!(c"Blinky Example"), 20 embassy_rp::binary_info::rp_program_name!(c"Blinky Example"),
diff --git a/examples/rp235x/src/bin/blinky_wifi.rs b/examples/rp235x/src/bin/blinky_wifi.rs
index ef029867a..8c352ebc4 100644
--- a/examples/rp235x/src/bin/blinky_wifi.rs
+++ b/examples/rp235x/src/bin/blinky_wifi.rs
@@ -18,7 +18,7 @@ use {defmt_rtt as _, panic_probe as _};
18 18
19// Program metadata for `picotool info`. 19// Program metadata for `picotool info`.
20// This isn't needed, but it's recommended to have these minimal entries. 20// This isn't needed, but it's recommended to have these minimal entries.
21#[link_section = ".bi_entries"] 21#[unsafe(link_section = ".bi_entries")]
22#[used] 22#[used]
23pub static PICOTOOL_ENTRIES: [embassy_rp::binary_info::EntryAddr; 4] = [ 23pub static PICOTOOL_ENTRIES: [embassy_rp::binary_info::EntryAddr; 4] = [
24 embassy_rp::binary_info::rp_program_name!(c"Blinky Example"), 24 embassy_rp::binary_info::rp_program_name!(c"Blinky Example"),
diff --git a/examples/rp235x/src/bin/blinky_wifi_pico_plus_2.rs b/examples/rp235x/src/bin/blinky_wifi_pico_plus_2.rs
index 2a919a1ea..0a5bccfb3 100644
--- a/examples/rp235x/src/bin/blinky_wifi_pico_plus_2.rs
+++ b/examples/rp235x/src/bin/blinky_wifi_pico_plus_2.rs
@@ -18,7 +18,7 @@ use {defmt_rtt as _, panic_probe as _};
18 18
19// Program metadata for `picotool info`. 19// Program metadata for `picotool info`.
20// This isn't needed, but it's recomended to have these minimal entries. 20// This isn't needed, but it's recomended to have these minimal entries.
21#[link_section = ".bi_entries"] 21#[unsafe(link_section = ".bi_entries")]
22#[used] 22#[used]
23pub static PICOTOOL_ENTRIES: [embassy_rp::binary_info::EntryAddr; 4] = [ 23pub static PICOTOOL_ENTRIES: [embassy_rp::binary_info::EntryAddr; 4] = [
24 embassy_rp::binary_info::rp_program_name!(c"Blinky Example"), 24 embassy_rp::binary_info::rp_program_name!(c"Blinky Example"),
diff --git a/examples/rp235x/src/bin/overclock.rs b/examples/rp235x/src/bin/overclock.rs
new file mode 100644
index 000000000..5fd97ef97
--- /dev/null
+++ b/examples/rp235x/src/bin/overclock.rs
@@ -0,0 +1,74 @@
1//! # Overclocking the RP2350 to 200 MHz
2//!
3//! This example demonstrates how to configure the RP2350 to run at 200 MHz instead of the default 150 MHz.
4//!
5//! ## Note
6//!
7//! As of yet there is no official support for running the RP235x at higher clock frequencies and/or other core voltages than the default.
8//! Doing so may cause unexpected behavior and/or damage the chip.
9
10#![no_std]
11#![no_main]
12
13use defmt::*;
14use embassy_executor::Spawner;
15use embassy_rp::clocks::{clk_sys_freq, core_voltage, ClockConfig, CoreVoltage};
16use embassy_rp::config::Config;
17use embassy_rp::gpio::{Level, Output};
18use embassy_time::{Duration, Instant, Timer};
19use {defmt_rtt as _, panic_probe as _};
20
21const COUNT_TO: i64 = 10_000_000;
22
23#[embassy_executor::main]
24async fn main(_spawner: Spawner) -> ! {
25 // Set up for clock frequency of 200 MHz, setting all necessary defaults.
26 let mut config = Config::new(ClockConfig::system_freq(200_000_000).unwrap());
27
28 // since for the rp235x there is no official support for higher clock frequencies, `system_freq()` will not set a voltage for us.
29 // We need to guess the core voltage, that is needed for the higher clock frequency. Going with a small increase from the default 1.1V here, based on
30 // what we know about the RP2040. This is not guaranteed to be correct.
31 config.clocks.core_voltage = CoreVoltage::V1_15;
32
33 // Initialize the peripherals
34 let p = embassy_rp::init(config);
35
36 // Show CPU frequency for verification
37 let sys_freq = clk_sys_freq();
38 info!("System clock frequency: {} MHz", sys_freq / 1_000_000);
39 // Show core voltage for verification
40 let core_voltage = core_voltage().unwrap();
41 info!("Core voltage: {}", core_voltage);
42
43 // LED to indicate the system is running
44 let mut led = Output::new(p.PIN_25, Level::Low);
45
46 loop {
47 // Reset the counter at the start of measurement period
48 let mut counter = 0;
49
50 // Turn LED on while counting
51 led.set_high();
52
53 let start = Instant::now();
54
55 // This is a busy loop that will take some time to complete
56 while counter < COUNT_TO {
57 counter += 1;
58 }
59
60 let elapsed = Instant::now() - start;
61
62 // Report the elapsed time
63 led.set_low();
64 info!(
65 "At {}Mhz: Elapsed time to count to {}: {}ms",
66 sys_freq / 1_000_000,
67 counter,
68 elapsed.as_millis()
69 );
70
71 // Wait 2 seconds before starting the next measurement
72 Timer::after(Duration::from_secs(2)).await;
73 }
74}
diff --git a/examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs b/examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs
index ccc601661..61af94560 100644
--- a/examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs
+++ b/examples/rp235x/src/bin/pio_rotary_encoder_rxf.rs
@@ -16,7 +16,7 @@ use pio::{Common, Config, FifoJoin, Instance, InterruptHandler, Pio, PioPin, Shi
16use {defmt_rtt as _, panic_probe as _}; 16use {defmt_rtt as _, panic_probe as _};
17 17
18// Program metadata for `picotool info` 18// Program metadata for `picotool info`
19#[link_section = ".bi_entries"] 19#[unsafe(link_section = ".bi_entries")]
20#[used] 20#[used]
21pub static PICOTOOL_ENTRIES: [embassy_rp::binary_info::EntryAddr; 4] = [ 21pub static PICOTOOL_ENTRIES: [embassy_rp::binary_info::EntryAddr; 4] = [
22 embassy_rp::binary_info::rp_program_name!(c"example_pio_rotary_encoder_rxf"), 22 embassy_rp::binary_info::rp_program_name!(c"example_pio_rotary_encoder_rxf"),
@@ -88,8 +88,8 @@ impl<'d, T: Instance, const SM: usize> PioEncoder<'d, T, SM> {
88 Self { sm } 88 Self { sm }
89 } 89 }
90 90
91 pub async fn read(&mut self) -> u32 { 91 pub async fn read(&mut self) -> i32 {
92 self.sm.get_rxf_entry(0) 92 self.sm.get_rxf_entry(0) as i32
93 } 93 }
94} 94}
95 95
diff --git a/examples/rp235x/src/bin/sharing.rs b/examples/rp235x/src/bin/sharing.rs
index 5416e20ce..497c4f845 100644
--- a/examples/rp235x/src/bin/sharing.rs
+++ b/examples/rp235x/src/bin/sharing.rs
@@ -31,7 +31,7 @@ use rand::RngCore;
31use static_cell::{ConstStaticCell, StaticCell}; 31use static_cell::{ConstStaticCell, StaticCell};
32use {defmt_rtt as _, panic_probe as _}; 32use {defmt_rtt as _, panic_probe as _};
33 33
34type UartAsyncMutex = mutex::Mutex<CriticalSectionRawMutex, UartTx<'static, UART0, uart::Async>>; 34type UartAsyncMutex = mutex::Mutex<CriticalSectionRawMutex, UartTx<'static, uart::Async>>;
35 35
36struct MyType { 36struct MyType {
37 inner: u32, 37 inner: u32,
diff --git a/examples/rp235x/src/bin/uart_buffered_split.rs b/examples/rp235x/src/bin/uart_buffered_split.rs
index f707c4b5e..7cad09f9b 100644
--- a/examples/rp235x/src/bin/uart_buffered_split.rs
+++ b/examples/rp235x/src/bin/uart_buffered_split.rs
@@ -48,7 +48,7 @@ async fn main(spawner: Spawner) {
48} 48}
49 49
50#[embassy_executor::task] 50#[embassy_executor::task]
51async fn reader(mut rx: BufferedUartRx<'static, UART0>) { 51async fn reader(mut rx: BufferedUartRx) {
52 info!("Reading..."); 52 info!("Reading...");
53 loop { 53 loop {
54 let mut buf = [0; 31]; 54 let mut buf = [0; 31];
diff --git a/examples/rp235x/src/bin/uart_unidir.rs b/examples/rp235x/src/bin/uart_unidir.rs
index 4e98f9e1e..45c9c8407 100644
--- a/examples/rp235x/src/bin/uart_unidir.rs
+++ b/examples/rp235x/src/bin/uart_unidir.rs
@@ -39,7 +39,7 @@ async fn main(spawner: Spawner) {
39} 39}
40 40
41#[embassy_executor::task] 41#[embassy_executor::task]
42async fn reader(mut rx: UartRx<'static, UART1, Async>) { 42async fn reader(mut rx: UartRx<'static, Async>) {
43 info!("Reading..."); 43 info!("Reading...");
44 loop { 44 loop {
45 // read a total of 4 transmissions (32 / 8) and then print the result 45 // read a total of 4 transmissions (32 / 8) and then print the result
diff --git a/examples/stm32f7/Cargo.toml b/examples/stm32f7/Cargo.toml
index 9fbe2efc3..1a46931d9 100644
--- a/examples/stm32f7/Cargo.toml
+++ b/examples/stm32f7/Cargo.toml
@@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8# Change stm32f777zi to your chip name, if necessary. 8# Change stm32f777zi to your chip name, if necessary.
9embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32f777zi", "memory-x", "unstable-pac", "time-driver-any", "exti"] } 9embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32f777zi", "memory-x", "unstable-pac", "time-driver-any", "exti", "single-bank"] }
10embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } 11embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] }
12embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
diff --git a/examples/stm32h7/src/bin/adc_dma.rs b/examples/stm32h7/src/bin/adc_dma.rs
index dc775f18a..f06b5d06e 100644
--- a/examples/stm32h7/src/bin/adc_dma.rs
+++ b/examples/stm32h7/src/bin/adc_dma.rs
@@ -8,7 +8,7 @@ use embassy_stm32::Config;
8use embassy_time::Timer; 8use embassy_time::Timer;
9use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
10 10
11#[link_section = ".ram_d3"] 11#[unsafe(link_section = ".ram_d3")]
12static mut DMA_BUF: [u16; 2] = [0; 2]; 12static mut DMA_BUF: [u16; 2] = [0; 2];
13 13
14#[embassy_executor::main] 14#[embassy_executor::main]
diff --git a/examples/stm32h7/src/bin/sai.rs b/examples/stm32h7/src/bin/sai.rs
index 95ffe257a..01937593a 100644
--- a/examples/stm32h7/src/bin/sai.rs
+++ b/examples/stm32h7/src/bin/sai.rs
@@ -16,9 +16,9 @@ const DMA_BUFFER_LENGTH: usize = HALF_DMA_BUFFER_LENGTH * 2; // 2 half-blocks
16const SAMPLE_RATE: u32 = 48000; 16const SAMPLE_RATE: u32 = 48000;
17 17
18//DMA buffer must be in special region. Refer https://embassy.dev/book/#_stm32_bdma_only_working_out_of_some_ram_regions 18//DMA buffer must be in special region. Refer https://embassy.dev/book/#_stm32_bdma_only_working_out_of_some_ram_regions
19#[link_section = ".sram1_bss"] 19#[unsafe(link_section = ".sram1_bss")]
20static mut TX_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit(); 20static mut TX_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit();
21#[link_section = ".sram1_bss"] 21#[unsafe(link_section = ".sram1_bss")]
22static mut RX_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit(); 22static mut RX_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit();
23 23
24#[embassy_executor::main] 24#[embassy_executor::main]
@@ -112,8 +112,10 @@ async fn main(_spawner: Spawner) {
112 let mut buf = [0u32; HALF_DMA_BUFFER_LENGTH]; 112 let mut buf = [0u32; HALF_DMA_BUFFER_LENGTH];
113 113
114 loop { 114 loop {
115 sai_receiver.read(&mut buf).await.unwrap(); 115 // write() must be called before read() to start the master (transmitter)
116 // clock used by the receiver
116 sai_transmitter.write(&buf).await.unwrap(); 117 sai_transmitter.write(&buf).await.unwrap();
118 sai_receiver.read(&mut buf).await.unwrap();
117 } 119 }
118} 120}
119 121
diff --git a/examples/stm32h7/src/bin/spi_bdma.rs b/examples/stm32h7/src/bin/spi_bdma.rs
index 9166fe9b6..5a7dff572 100644
--- a/examples/stm32h7/src/bin/spi_bdma.rs
+++ b/examples/stm32h7/src/bin/spi_bdma.rs
@@ -16,7 +16,7 @@ use static_cell::StaticCell;
16use {defmt_rtt as _, panic_probe as _}; 16use {defmt_rtt as _, panic_probe as _};
17 17
18// Defined in memory.x 18// Defined in memory.x
19#[link_section = ".ram_d3"] 19#[unsafe(link_section = ".ram_d3")]
20static mut RAM_D3: GroundedArrayCell<u8, 256> = GroundedArrayCell::uninit(); 20static mut RAM_D3: GroundedArrayCell<u8, 256> = GroundedArrayCell::uninit();
21 21
22#[embassy_executor::task] 22#[embassy_executor::task]
diff --git a/examples/stm32h723/src/bin/spdifrx.rs b/examples/stm32h723/src/bin/spdifrx.rs
index bc8249ced..a04d7cb34 100644
--- a/examples/stm32h723/src/bin/spdifrx.rs
+++ b/examples/stm32h723/src/bin/spdifrx.rs
@@ -24,10 +24,10 @@ const HALF_DMA_BUFFER_LENGTH: usize = BLOCK_LENGTH * CHANNEL_COUNT;
24const DMA_BUFFER_LENGTH: usize = HALF_DMA_BUFFER_LENGTH * 2; // 2 half-blocks 24const DMA_BUFFER_LENGTH: usize = HALF_DMA_BUFFER_LENGTH * 2; // 2 half-blocks
25 25
26// DMA buffers must be in special regions. Refer https://embassy.dev/book/#_stm32_bdma_only_working_out_of_some_ram_regions 26// DMA buffers must be in special regions. Refer https://embassy.dev/book/#_stm32_bdma_only_working_out_of_some_ram_regions
27#[link_section = ".sram1"] 27#[unsafe(link_section = ".sram1")]
28static mut SPDIFRX_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit(); 28static mut SPDIFRX_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit();
29 29
30#[link_section = ".sram4"] 30#[unsafe(link_section = ".sram4")]
31static mut SAI_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit(); 31static mut SAI_BUFFER: GroundedArrayCell<u32, DMA_BUFFER_LENGTH> = GroundedArrayCell::uninit();
32 32
33#[embassy_executor::main] 33#[embassy_executor::main]
diff --git a/examples/stm32h755cm4/src/bin/blinky.rs b/examples/stm32h755cm4/src/bin/blinky.rs
index b5c547839..39112c1f5 100644
--- a/examples/stm32h755cm4/src/bin/blinky.rs
+++ b/examples/stm32h755cm4/src/bin/blinky.rs
@@ -10,7 +10,7 @@ use embassy_stm32::SharedData;
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
13#[link_section = ".ram_d3.shared_data"] 13#[unsafe(link_section = ".ram_d3.shared_data")]
14static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); 14static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
15 15
16#[embassy_executor::main] 16#[embassy_executor::main]
diff --git a/examples/stm32h755cm7/src/bin/blinky.rs b/examples/stm32h755cm7/src/bin/blinky.rs
index 94d2226c0..b30bf4de8 100644
--- a/examples/stm32h755cm7/src/bin/blinky.rs
+++ b/examples/stm32h755cm7/src/bin/blinky.rs
@@ -10,7 +10,7 @@ use embassy_stm32::SharedData;
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
13#[link_section = ".ram_d3.shared_data"] 13#[unsafe(link_section = ".ram_d3.shared_data")]
14static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); 14static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
15 15
16#[embassy_executor::main] 16#[embassy_executor::main]
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml
index b609110af..239bfcd79 100644
--- a/examples/stm32l4/Cargo.toml
+++ b/examples/stm32l4/Cargo.toml
@@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8# Change stm32l4s5vi to your chip name, if necessary. 8# Change stm32l4s5vi to your chip name, if necessary.
9embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l4r5zi", "memory-x", "time-driver-any", "exti", "chrono"] } 9embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l4r5zi", "memory-x", "time-driver-any", "exti", "chrono", "dual-bank"] }
10embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } 11embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] }
12embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768", ] } 12embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768", ] }
diff --git a/examples/stm32l5/Cargo.toml b/examples/stm32l5/Cargo.toml
index fbf68c890..4c372a554 100644
--- a/examples/stm32l5/Cargo.toml
+++ b/examples/stm32l5/Cargo.toml
@@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8# Change stm32l552ze to your chip name, if necessary. 8# Change stm32l552ze to your chip name, if necessary.
9embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l552ze", "time-driver-any", "exti", "memory-x", "low-power"] } 9embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "stm32l552ze", "time-driver-any", "exti", "memory-x", "low-power", "dual-bank"] }
10embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } 11embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] }
12embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
diff --git a/examples/stm32wl/src/bin/blinky.rs b/examples/stm32wl/src/bin/blinky.rs
index ce7d0ec58..a2a90871d 100644
--- a/examples/stm32wl/src/bin/blinky.rs
+++ b/examples/stm32wl/src/bin/blinky.rs
@@ -10,7 +10,7 @@ use embassy_stm32::SharedData;
10use embassy_time::Timer; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
13#[link_section = ".shared_data"] 13#[unsafe(link_section = ".shared_data")]
14static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); 14static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
15 15
16#[embassy_executor::main] 16#[embassy_executor::main]
diff --git a/examples/stm32wl/src/bin/button.rs b/examples/stm32wl/src/bin/button.rs
index 8b5204479..21bcd2ac6 100644
--- a/examples/stm32wl/src/bin/button.rs
+++ b/examples/stm32wl/src/bin/button.rs
@@ -9,7 +9,7 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
9use embassy_stm32::SharedData; 9use embassy_stm32::SharedData;
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12#[link_section = ".shared_data"] 12#[unsafe(link_section = ".shared_data")]
13static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); 13static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
14 14
15#[entry] 15#[entry]
diff --git a/examples/stm32wl/src/bin/button_exti.rs b/examples/stm32wl/src/bin/button_exti.rs
index 8dd1a6a5e..0a8aece34 100644
--- a/examples/stm32wl/src/bin/button_exti.rs
+++ b/examples/stm32wl/src/bin/button_exti.rs
@@ -10,7 +10,7 @@ use embassy_stm32::gpio::Pull;
10use embassy_stm32::SharedData; 10use embassy_stm32::SharedData;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
13#[link_section = ".shared_data"] 13#[unsafe(link_section = ".shared_data")]
14static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); 14static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
15 15
16#[embassy_executor::main] 16#[embassy_executor::main]
diff --git a/examples/stm32wl/src/bin/flash.rs b/examples/stm32wl/src/bin/flash.rs
index 147f5d293..320a9723a 100644
--- a/examples/stm32wl/src/bin/flash.rs
+++ b/examples/stm32wl/src/bin/flash.rs
@@ -9,7 +9,7 @@ use embassy_stm32::flash::Flash;
9use embassy_stm32::SharedData; 9use embassy_stm32::SharedData;
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12#[link_section = ".shared_data"] 12#[unsafe(link_section = ".shared_data")]
13static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); 13static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
14 14
15#[embassy_executor::main] 15#[embassy_executor::main]
diff --git a/examples/stm32wl/src/bin/random.rs b/examples/stm32wl/src/bin/random.rs
index df2ed0054..68b9d7d00 100644
--- a/examples/stm32wl/src/bin/random.rs
+++ b/examples/stm32wl/src/bin/random.rs
@@ -14,7 +14,7 @@ bind_interrupts!(struct Irqs{
14 RNG => rng::InterruptHandler<peripherals::RNG>; 14 RNG => rng::InterruptHandler<peripherals::RNG>;
15}); 15});
16 16
17#[link_section = ".shared_data"] 17#[unsafe(link_section = ".shared_data")]
18static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); 18static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
19 19
20#[embassy_executor::main] 20#[embassy_executor::main]
diff --git a/examples/stm32wl/src/bin/rtc.rs b/examples/stm32wl/src/bin/rtc.rs
index 69a9ddc4c..d3709120f 100644
--- a/examples/stm32wl/src/bin/rtc.rs
+++ b/examples/stm32wl/src/bin/rtc.rs
@@ -12,7 +12,7 @@ use embassy_stm32::{Config, SharedData};
12use embassy_time::Timer; 12use embassy_time::Timer;
13use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
14 14
15#[link_section = ".shared_data"] 15#[unsafe(link_section = ".shared_data")]
16static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); 16static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
17 17
18#[embassy_executor::main] 18#[embassy_executor::main]
diff --git a/examples/stm32wl/src/bin/uart_async.rs b/examples/stm32wl/src/bin/uart_async.rs
index ece9b9201..505a85f47 100644
--- a/examples/stm32wl/src/bin/uart_async.rs
+++ b/examples/stm32wl/src/bin/uart_async.rs
@@ -14,7 +14,7 @@ bind_interrupts!(struct Irqs{
14 LPUART1 => InterruptHandler<peripherals::LPUART1>; 14 LPUART1 => InterruptHandler<peripherals::LPUART1>;
15}); 15});
16 16
17#[link_section = ".shared_data"] 17#[unsafe(link_section = ".shared_data")]
18static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); 18static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
19 19
20/* 20/*