2024-06-03 11:19 PM
I have an issue where I can't obtain values near 2048 in the 12-bit ADC sampling of stm32wb5mmg. The actual data is shown below.
hadc1.Instance = ADC1;
hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV2;
hadc1.Init.Resolution = ADC_RESOLUTION_12B;
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE;
hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
hadc1.Init.LowPowerAutoWait = DISABLE;
hadc1.Init.ContinuousConvMode = DISABLE;
hadc1.Init.NbrOfConversion = 1;
hadc1.Init.DiscontinuousConvMode = DISABLE;
hadc1.Init.ExternalTrigConv = ADC_EXTERNALTRIG_T2_TRGO
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING
hadc1.Init.DMAContinuousRequests = DISABLE;
hadc1.Init.Overrun = ADC_OVR_DATA_PRESERVED;
hadc1.Init.OversamplingMode = DISABLE;
sConfig.Channel = ADC_CHANNEL_13;
sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SamplingTime = ADC_SAMPLETIME_12CYCLES_5;
sConfig.SingleDiff = ADC_SINGLE_ENDED;
sConfig.OffsetNumber = ADC_OFFSET_NONE;
sConfig.Offset = 0;
Despite trying to increase the sampling time and calibrate before starting sampling, the issue was not resolved. Could you tell me the solution?
2024-06-04 06:14 AM
Can't find ADC in stm32wb5mmg. Anyway, seems like DNL error, quite common issue around MSB step in all adc's.
Usually ST's ADC specified to have +-2 LSB, so jumps from 2045 to 2049 is normal. You can minimize error shifting DC level up or down , if dynamics not suffering.
2024-06-04 06:51 AM
I do not see the calibration step!
2024-06-27 04:49 PM
This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.
2024-06-27 10:00 PM - edited 2024-06-27 10:01 PM
This may be consequence of inadequate (too high impedance) reference voltage source on VREF+ (or VDDA, if VREF+ is internally connected to it).
JW