STM32U535 - 14 Bit ADC1 performance - getting 5bits. 12 bit ADC4 performs as expected.
I am developing a board using an STM32U535RETQ - 64 pin QFP pkg. The part is an SMPSU capable "Q" variant - although we are only using the STM's internal LDO... NOT the SMPSU.
I am using CubeMx 6.14 and StmIDE 1.18 to produce my ioc and compilation.
The 14bit ADC1 is performing as expected when set to convert internal signals - Vdd and Vbatt.
The signal to be converted is a low frequency DC signal - we're measuring current via a precision sense resistor and instrumentation amplifier.
Calibration performed during programme "init" :-
ADC_ChannelConfTypeDef sConfig = {0};
hadc1.Instance = ADC1;
sConfig.Channel = ADC_CHANNEL_3; // Ch3 intended- ******************************************
sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SamplingTime = ADC_SAMPLETIME_12CYCLES;
sConfig.SingleDiff = ADC_SINGLE_ENDED;
sConfig.OffsetNumber = ADC_OFFSET_NONE;
sConfig.Offset = 0;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
Error_Handler();
}
if ( HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED ) != HAL_OK ) // Calibrate 14 bit ADC1 - needed to look at HAL_ADCEX driver source to determine extra ADC_Calib parameter.
{
Error_Handler(); // Handle configuration error
}We are using the ADC in a basic mode - just one single channel to convert, started by regular software conversions.
Function to read ADC1_Ch3 :-
float Read_ADC1_Ch3(void)
{
float adc1Val;
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY);
adc1Val = HAL_ADC_GetValue(&hadc1); // 14 bit converter
return adc1Val;
}When I convert any of the external channels still available ( Ch3 - the one we want, or Ch8 & Ch16 - spare I/P's ), I'm getting a cyclical swing in the reading with a 3% variation - i.e. about 5 bit performance - this repeats every several seconds.
I've looked at the I/P capacitor - nominally 1nF, values from 0-100nF have been tried without any significant difference.
Looked at the number of sample clocks - 3-814, very little difference.
The board has one, solid, Gnd plane.
ADC clock is 4MHz noimal - I've tried 250KHz-16MHz. Again - without any significant difference.
The signal I'm monitoring, measured on a 6 1/2 digit DMM is stable. The SAME SIGNAL, converted by the 12 bit ADC4 is performing as expected for a 12 bit converter. That to me almost certainly says that the issue is with the STM32 / ADC1, and not my external circuitry.
The board can be DC or battery powered - no difference on ADC1 performance.
Has anyone else encountered this issue or have any suggestions as to what the cause may be?
Thanks for any comments received.
John Haughton.
