Add workaround for F2 errata

This commit is contained in:
Joonas Javanainen 2022-03-27 18:45:10 +03:00
parent a16fef21e1
commit 83211c2b61
No known key found for this signature in database
GPG key ID: D39CCA5CB19B9179

View file

@ -166,6 +166,15 @@ fn main() {
None => TokenStream::new(),
};
let after_enable = if chip_name.starts_with("stm32f2") {
// Errata: ES0005 - 2.1.11 Delay after an RCC peripheral clock enabling
quote! {
cortex_m::asm::dsb();
}
} else {
TokenStream::new()
};
let pname = format_ident!("{}", p.name);
let clk = format_ident!("{}", rcc.clock.to_ascii_lowercase());
let en_reg = format_ident!("{}", en.register.to_ascii_lowercase());
@ -180,7 +189,8 @@ fn main() {
}
fn enable() {
critical_section::with(|_| unsafe {
crate::pac::RCC.#en_reg().modify(|w| w.#set_en_field(true))
crate::pac::RCC.#en_reg().modify(|w| w.#set_en_field(true));
#after_enable
})
}
fn disable() {