Merge pull request #2776 from MaxiluxSystems/fix/adc-h5-ch0

stm32: adc: v3: [h5] set OR.OP0 to 1 when ADCx_INP0 is selected, per RM
This commit is contained in:
Dario Nieuwenhuis 2024-04-05 12:59:13 +00:00 committed by GitHub
commit 370436d675
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -222,6 +222,13 @@ impl<'d, T: Instance> Adc<'d, T> {
// spin
}
// RM0492, RM0481, etc.
// "This option bit must be set to 1 when ADCx_INP0 or ADCx_INN1 channel is selected."
#[cfg(adc_h5)]
if pin.channel() == 0 {
T::regs().or().modify(|reg| reg.set_op0(true));
}
// Configure channel
Self::set_channel_sample_time(pin.channel(), self.sample_time);
@ -244,6 +251,13 @@ impl<'d, T: Instance> Adc<'d, T> {
T::regs().cr().modify(|reg| reg.set_addis(true));
// RM0492, RM0481, etc.
// "This option bit must be set to 1 when ADCx_INP0 or ADCx_INN1 channel is selected."
#[cfg(adc_h5)]
if pin.channel() == 0 {
T::regs().or().modify(|reg| reg.set_op0(false));
}
val
}