aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Rockstedt <[email protected]>2023-12-15 14:14:30 +0100
committerOliver Rockstedt <[email protected]>2023-12-15 14:14:30 +0100
commit560e72813292e0ceb32b25daf887bb69b48af771 (patch)
tree50c9d959ca9e7bf2fb58093093b97ea780f0c3be
parentc17fee27bb37233df7300bea3c2658f87df9dd6b (diff)
STM32H7: adjust flash latency and programming delay for series in RM0468
-rw-r--r--embassy-stm32/src/rcc/h.rs26
1 files changed, 25 insertions, 1 deletions
diff --git a/embassy-stm32/src/rcc/h.rs b/embassy-stm32/src/rcc/h.rs
index 389b2a871..15b51a398 100644
--- a/embassy-stm32/src/rcc/h.rs
+++ b/embassy-stm32/src/rcc/h.rs
@@ -832,7 +832,7 @@ fn flash_setup(clk: Hertz, vos: VoltageScale) {
832 _ => unreachable!(), 832 _ => unreachable!(),
833 }; 833 };
834 834
835 #[cfg(flash_h7)] 835 #[cfg(all(flash_h7, not(pwr_h7rm0468)))]
836 let (latency, wrhighfreq) = match (vos, clk.0) { 836 let (latency, wrhighfreq) = match (vos, clk.0) {
837 // VOS 0 range VCORE 1.26V - 1.40V 837 // VOS 0 range VCORE 1.26V - 1.40V
838 (VoltageScale::Scale0, ..=70_000_000) => (0, 0), 838 (VoltageScale::Scale0, ..=70_000_000) => (0, 0),
@@ -861,6 +861,30 @@ fn flash_setup(clk: Hertz, vos: VoltageScale) {
861 _ => unreachable!(), 861 _ => unreachable!(),
862 }; 862 };
863 863
864 // See RM0468 Rev 3 Table 16. FLASH recommended number of wait
865 // states and programming delay
866 #[cfg(all(flash_h7, pwr_h7rm0468))]
867 let (latency, wrhighfreq) = match (vos, clk.0) {
868 // VOS 0 range VCORE 1.26V - 1.40V
869 (VoltageScale::Scale0, ..=70_000_000) => (0, 0),
870 (VoltageScale::Scale0, ..=140_000_000) => (1, 1),
871 (VoltageScale::Scale0, ..=210_000_000) => (2, 2),
872 (VoltageScale::Scale0, ..=275_000_000) => (3, 3),
873 // VOS 1 range VCORE 1.15V - 1.26V
874 (VoltageScale::Scale1, ..=67_000_000) => (0, 0),
875 (VoltageScale::Scale1, ..=133_000_000) => (1, 1),
876 (VoltageScale::Scale1, ..=200_000_000) => (2, 2),
877 // VOS 2 range VCORE 1.05V - 1.15V
878 (VoltageScale::Scale2, ..=50_000_000) => (0, 0),
879 (VoltageScale::Scale2, ..=100_000_000) => (1, 1),
880 (VoltageScale::Scale2, ..=150_000_000) => (2, 2),
881 // VOS 3 range VCORE 0.95V - 1.05V
882 (VoltageScale::Scale3, ..=35_000_000) => (0, 0),
883 (VoltageScale::Scale3, ..=70_000_000) => (1, 1),
884 (VoltageScale::Scale3, ..=85_000_000) => (2, 2),
885 _ => unreachable!(),
886 };
887
864 // See RM0455 Rev 10 Table 16. FLASH recommended number of wait 888 // See RM0455 Rev 10 Table 16. FLASH recommended number of wait
865 // states and programming delay 889 // states and programming delay
866 #[cfg(flash_h7ab)] 890 #[cfg(flash_h7ab)]