stm32l1/rcc: set required flash bits for high frequencies

As is done for lots of other families
This commit is contained in:
Greg V 2022-01-14 20:14:59 +03:00
parent 2310003f39
commit 456b56d4fd
2 changed files with 9 additions and 2 deletions

View file

@ -1,5 +1,5 @@
use crate::pac::rcc::vals::{Hpre, Msirange, Plldiv, Pllmul, Pllsrc, Ppre, Sw};
use crate::pac::RCC;
use crate::pac::{FLASH, RCC};
use crate::rcc::{set_freqs, Clocks};
use crate::time::Hertz;
use crate::time::U32Ext;
@ -274,6 +274,13 @@ pub(crate) unsafe fn init(config: Config) {
}
};
// Set flash 64-bit access, prefetch and wait states
if sys_clk >= 16_000_000 {
FLASH.acr().write(|w| w.set_acc64(true));
FLASH.acr().modify(|w| w.set_prften(true));
FLASH.acr().modify(|w| w.set_latency(true));
}
RCC.cfgr().modify(|w| {
w.set_sw(sw);
w.set_hpre(config.ahb_pre.into());

@ -1 +1 @@
Subproject commit c66033b9d220ce6d148a4c90f72acd1118861bb1
Subproject commit 97877b42a7b14e753dcb3153221dc1f3865070d1