2019-11-15 08:55 AM
When the input to the ADC (in the STM8L151G6) is floating, it reads approximately a mid level value. For example, if the ADC's reference voltage is 3 volts it reads around 1.7 volts. Why does this happen? We can't find a register setting that causes this to happen. We were expecting it to read 0 volts. How can we make it read 0 volts?
2019-11-15 09:32 AM
If an input is floating that means its voltage is not pulled explicitly to any level on a board. So you can't expect any specific conversion result. You could use pull-down resisor if you need zero
2019-11-15 09:51 AM
Indeed capacitor is going to need somewhere for the electrons to be going.
Perhaps you can just commit a grounded ADC pin, and interleave to that channel before to the one that might be floating?
2019-11-15 10:06 AM
Ocasionally, I have similar question.
I'm using ADC on STM32WB55CG.
It has no specific Vref pin, so the Vref is connected to VDDA inernally. VDDA = 3V.
In a differential mode I have one pin always equal to 1.5V and the other one [0; 3]V. I expect the conversion result to be [-2048; 2047] or at least [0; 4096] as the ADC is 12 bit. But in fact I get about 1985 when inputs are equal and the whole range of results is somewhat [1000; 3000]
What am I doing wrong?