mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-10-02 14:44:32 +00:00
stm32: xspi wait for prescaler change
This is documented as being required (and is done by stm32cube), hasn't been observed as a problem though.
This commit is contained in:
parent
65f849a589
commit
e22fe7cbcf
@ -335,8 +335,17 @@ impl<'d, T: Instance, M: PeriMode> Xspi<'d, T, M> {
|
|||||||
w.set_prescaler(config.clock_prescaler);
|
w.set_prescaler(config.clock_prescaler);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Wait for busy flag to clear after changing prescaler, during calibration
|
||||||
|
while T::REGS.sr().read().busy() {}
|
||||||
|
|
||||||
T::REGS.cr().modify(|w| {
|
T::REGS.cr().modify(|w| {
|
||||||
w.set_dmm(dual_quad);
|
w.set_dmm(dual_quad);
|
||||||
|
|
||||||
|
// TODO: at the moment only ncs1 seems to get passed in?
|
||||||
|
// Only one must be selected
|
||||||
|
assert!(!(ncs1.is_some() && ncs2.is_some()));
|
||||||
|
assert!(!(ncs1.is_none() && ncs2.is_none()));
|
||||||
|
w.set_cssel(if ncs1.is_some() { Cssel::B_0X0 } else { Cssel::B_0X1 });
|
||||||
});
|
});
|
||||||
|
|
||||||
T::REGS.tcr().modify(|w| {
|
T::REGS.tcr().modify(|w| {
|
||||||
@ -344,14 +353,6 @@ impl<'d, T: Instance, M: PeriMode> Xspi<'d, T, M> {
|
|||||||
w.set_dhqc(config.delay_hold_quarter_cycle);
|
w.set_dhqc(config.delay_hold_quarter_cycle);
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: at the moment only ncs1 seems to get passed in?
|
|
||||||
// Only one must be selected
|
|
||||||
assert!(!(ncs1.is_some() && ncs2.is_some()));
|
|
||||||
assert!(!(ncs1.is_none() && ncs2.is_none()));
|
|
||||||
T::REGS.cr().modify(|w| {
|
|
||||||
w.set_cssel(if ncs1.is_some() { Cssel::B_0X0 } else { Cssel::B_0X1 });
|
|
||||||
});
|
|
||||||
|
|
||||||
// Enable peripheral
|
// Enable peripheral
|
||||||
T::REGS.cr().modify(|w| {
|
T::REGS.cr().modify(|w| {
|
||||||
w.set_en(true);
|
w.set_en(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user