Skip to content
Snippets Groups Projects
Commit cb3c66e7 authored by Damien George's avatar Damien George
Browse files

stm32/adc: Increase sample time for internal sensors on L4 MCUs.

They need time (around 4us for VREFINT) to obtain accurate results.

Fixes issue #4022.
parent 3220cedc
No related branches found
No related tags found
No related merge requests found
...@@ -304,7 +304,13 @@ STATIC void adc_config_channel(ADC_HandleTypeDef *adc_handle, uint32_t channel) ...@@ -304,7 +304,13 @@ STATIC void adc_config_channel(ADC_HandleTypeDef *adc_handle, uint32_t channel)
sConfig.OffsetRightShift = DISABLE; sConfig.OffsetRightShift = DISABLE;
sConfig.OffsetSignedSaturation = DISABLE; sConfig.OffsetSignedSaturation = DISABLE;
#elif defined(STM32L4) #elif defined(STM32L4)
if (channel == ADC_CHANNEL_VREFINT
|| channel == ADC_CHANNEL_TEMPSENSOR
|| channel == ADC_CHANNEL_VBAT) {
sConfig.SamplingTime = ADC_SAMPLETIME_247CYCLES_5;
} else {
sConfig.SamplingTime = ADC_SAMPLETIME_12CYCLES_5; sConfig.SamplingTime = ADC_SAMPLETIME_12CYCLES_5;
}
sConfig.SingleDiff = ADC_SINGLE_ENDED; sConfig.SingleDiff = ADC_SINGLE_ENDED;
sConfig.OffsetNumber = ADC_OFFSET_NONE; sConfig.OffsetNumber = ADC_OFFSET_NONE;
sConfig.Offset = 0; sConfig.Offset = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment