Skip to content

Commit bfb4c5a

Browse files
committed
Reset spinlocks on startup.
Avoids RTT related lockup.
1 parent 3570265 commit bfb4c5a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/main.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,6 @@ extern "C" {
217217
fn main() -> ! {
218218
cortex_m::interrupt::disable();
219219

220-
// BIOS_VERSION has a trailing `\0` as that is what the BIOS/OS API requires.
221-
info!("{} starting...", &BIOS_VERSION[0..BIOS_VERSION.len() - 1]);
222-
223220
// Grab the singleton containing all the RP2040 peripherals
224221
let mut pp = pac::Peripherals::take().unwrap();
225222
// Grab the singleton containing all the generic Cortex-M peripherals
@@ -229,9 +226,15 @@ fn main() -> ! {
229226
// (as opposed to a cold-start) is unreliable.
230227
reset_dma_engine(&mut pp);
231228

229+
// Reset the spinlocks.
230+
pp.SIO.spinlock[31].reset();
231+
232232
// Needed by the clock setup
233233
let mut watchdog = hal::watchdog::Watchdog::new(pp.WATCHDOG);
234234

235+
// BIOS_VERSION has a trailing `\0` as that is what the BIOS/OS API requires.
236+
info!("{} starting...", &BIOS_VERSION[0..BIOS_VERSION.len() - 1]);
237+
235238
// Run at 126 MHz SYS_PLL, 48 MHz, USB_PLL. This is important, we as clock
236239
// the PIO at ÷ 5, to give 25.2 MHz (which is close enough to the 25.175
237240
// MHz standard VGA pixel clock).

0 commit comments

Comments
 (0)