Skip to content

Commit 4d6f717

Browse files
LMESTMadbridge
authored andcommitted
Increase L0 ADC sample time
With default sampling time, the MBED2 and CI test shield tests would fail because the stabilization slope of ADC is relatively slow. ERROR (out:0.8000) - (in:0.7407) = (0.0593) ERROR (out:0.9000) - (in:0.8354) = (0.0646) ERROR (out:1.0000) - (in:0.9289) = (0.0711) This is related to the 10kOhms resistors used to connect Ain to Aout mounted on the CI shileds, and internal capacitance of L0 targets. If connecting Ain and Aout with wires, bypassing the resistors, the test is passed. So we're increasing the sampling time to let the automated ci shiled tests PASS. OK (out:0.8000) - (in:0.7863) = (0.0137) OK (out:0.9000) - (in:0.8869) = (0.0131) OK (out:1.0000) - (in:0.9844) = (0.0156)
1 parent 50ea935 commit 4d6f717

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

targets/TARGET_STM/TARGET_STM32L0/analogin_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void analogin_init(analogin_t *obj, PinName pin)
7373
AdcHandle.Init.OversamplingMode = DISABLE;
7474
AdcHandle.Init.ClockPrescaler = ADC_CLOCKPRESCALER_PCLK_DIV1;
7575
AdcHandle.Init.Resolution = ADC_RESOLUTION12b;
76-
AdcHandle.Init.SamplingTime = ADC_SAMPLETIME_41CYCLES_5;
76+
AdcHandle.Init.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
7777
AdcHandle.Init.ScanConvMode = ADC_SCAN_DIRECTION_FORWARD;
7878
AdcHandle.Init.DataAlign = ADC_DATAALIGN_RIGHT;
7979
AdcHandle.Init.ContinuousConvMode = DISABLE;

0 commit comments

Comments
 (0)