diff --git a/CHANGELOG.md b/CHANGELOG.md index a6ac2d08e..af4de5035 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix docs.rs documentation builds (#1129) - Fix circular DMA (#1144) - Fix `hello_rgb` example for ESP32 (#1173) +- Fix timer `now` for esp32c3 and esp32c6 ### Changed diff --git a/esp-hal/src/timer.rs b/esp-hal/src/timer.rs index 5aa5dbff4..dae0a11d2 100644 --- a/esp-hal/src/timer.rs +++ b/esp-hal/src/timer.rs @@ -420,8 +420,15 @@ where fn now(&self) -> u64 { let reg_block = unsafe { &*TG::register_block() }; + #[cfg(not(any(esp32c3, esp32c6)))] reg_block.t0update().write(|w| unsafe { w.bits(0) }); + #[cfg(any(esp32c3, esp32c6))] + { + reg_block.t0update().write(|w| w.update().set_bit()); + while reg_block.t0update().read().update().bit_is_set() {} + } + let value_lo = reg_block.t0lo().read().bits() as u64; let value_hi = (reg_block.t0hi().read().bits() as u64) << 32;