nrf-rs / nrf-hal

A Rust HAL for the nRF family of devices
Apache License 2.0
499 stars 139 forks source link

LFRC fails to start #416

Open datdenkikniet opened 1 year ago

datdenkikniet commented 1 year ago

In some, well-optimized (by the compiler) binaries, the LFRC startup code can cause erratum 3.34 to occur by restarting the LFRC oscillator between 66 and 138 us after stopping it.

It's tricky to create a reproducible example because it seems to rely on compiler optimizations whether it occurs or not, but the only code you need to run for it to occur is:

Clocks::new(peripherals.CLOCK).set_lfclk_src_rc().start_lfclk();

This code may hang forever on the events_lfclkstarted check in clocks.rs