Skip to content

Commit aef4af4

Browse files
committed
Bugfix - waiting for first ADC read to complete after ADC enable.
1 parent 163ef56 commit aef4af4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cores/arduino/wiring_analog.c

+3
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ uint32_t analogRead(uint32_t pin)
165165
syncADC();
166166
ADC->SWTRIG.bit.START = 1;
167167

168+
// Waiting for the 1st conversion to complete
169+
while (ADC->INTFLAG.bit.RESRDY == 0);
170+
168171
// Clear the Data Ready flag
169172
ADC->INTFLAG.reg = ADC_INTFLAG_RESRDY;
170173

0 commit comments

Comments
 (0)