From 1a16a4fb62977895608fdb8249de91f1320c7166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20N=C3=B6lle?= Date: Thu, 30 Mar 2023 18:22:14 +0200 Subject: [PATCH 1/3] Skip /32 AHB prescaler --- src/rcc.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rcc.rs b/src/rcc.rs index a20d364..5022f24 100755 --- a/src/rcc.rs +++ b/src/rcc.rs @@ -413,6 +413,8 @@ impl RccExt for RCC { let ahb_freq = match cfgr.ahb_pre { AHBPrescaler::NotDivided => sys_clk, + // skip /32 + pre if pre as u8 & 0b0100 > 0 => sys_clk / (1 << (pre as u8 - 6)), pre => sys_clk / (1 << (pre as u8 - 7)), }; From 7d769092e2a28f9b84085b75a2a7bbb1b864673a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20N=C3=B6lle?= Date: Mon, 3 Apr 2023 20:42:38 +0200 Subject: [PATCH 2/3] Add changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e170055..04c802d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ forget to update the links at the bottom of the changelog as well.--> ### Fixes +- Correct calculation of AHB prescaler for factors > 16 ([#228]) + ### Documentation ## [v0.10.0] - 2022-08-15 From 225dc8154bf74fdbd1928e13c53504664350988c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20N=C3=B6lle?= Date: Wed, 5 Apr 2023 00:44:41 +0200 Subject: [PATCH 3/3] Fix PR link in changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04c802d..53faed7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -190,6 +190,7 @@ _Not yet tracked in this changelog._ [#226]: https://github.com/stm32-rs/stm32l0xx-hal/pull/226 +[#228]: https://github.com/stm32-rs/stm32l0xx-hal/pull/228 [#224]: https://github.com/stm32-rs/stm32l0xx-hal/pull/224 [#221]: https://github.com/stm32-rs/stm32l0xx-hal/pull/221 [#220]: https://github.com/stm32-rs/stm32l0xx-hal/pull/218