2025-08-15 2:35 AM
Hi all,
I'm setting up a custom board using the STM32WL33 device.
I'm using four single-ended ADC inputs: ADC_VINM0, ADC_VINP0, ADC_VINM3, ADC_VINP3.
I would like to use DMA and sequencer, adding TEMP and VDD as 5th and 6th conversions.
I managed to got the above up and running, but:
a) appears that ALL conversion is done on 3.6V conversion range, regardless of software setup and subsequent SWITCH register settings (which appears correctly set: 0x8282); using the below macro gives correct ADC_value => mV conversion:
__HAL_ADC_CALC_DATA_TO_VOLTAGE(ADC_VIN_RANGE_3V6, adc[2], ADC_DS_DATA_WIDTH_12_BIT);
b) TEMP reading appears totally wrong. At ambient temp (30°C), ADC readings is around 726 (over 12 bits). If I readback calibration registers:
uint32_t Calib_c30 = (int32_t)*TEMPSENSOR_C30_ADDR; // =2556
uint32_t TCK_c30 = (int32_t)*TEMPSENSOR_TCK_ADDR; // =300
and use RM0511 - chpt 12.2.1 formula, I get T[°C] = -153°C (!!!)
ADC register settings:
Finally, note that COMP_x registers are at default values.
And indeed, I didn't find any documentation about estimating COMP fields: OFFSET and GAIN;
it would be possible having a GND and VREF input capability, which I didn't find, either.