Skip to content

Commit 3076772

Browse files
mck1117dron0gus
authored andcommitted
apply correct (?) H7 ADC errata fix
1 parent b4d5659 commit 3076772

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

firmware/hw_layer/ports/stm32/stm32_adc_v4.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ static constexpr ADCConversionGroup convGroupSlow = {
9797
.num_channels = slowChannelCount,
9898
.end_cb = adc_callback,
9999
.error_cb = nullptr,
100-
.cfgr = ADC_CFGR_EXTEN_0 | (4 << ADC_CFGR_EXTSEL_Pos), // External trigger ch4, rising edge: TIM3 TRGO
100+
// OVRMOD=1 is required by H7 errata "ADC slave data may be shifted in Dual regular simultaneous mode" -
101+
// without it, a single-DMA-channel read of CDR can leave the slave's samples offset from the master's.
102+
.cfgr = ADC_CFGR_EXTEN_0 | (4 << ADC_CFGR_EXTSEL_Pos) | ADC_CFGR_OVRMOD, // External trigger ch4, rising edge: TIM3 TRGO
101103
.cfgr2 = (H7_ADC_OVERSAMPLE - 1) << ADC_CFGR2_OVSR_Pos | // Oversample by Nx (register contains N-1)
102104
H7_ADC_SHIFT_BITS << ADC_CFGR2_OVSS_Pos | // shift the result right log2(N) bits to make a 16 bit result out of the internal oversample sum
103105
ADC_CFGR2_ROVSE, // Enable oversampling

0 commit comments

Comments
 (0)