AnsweredAssumed Answered

STM32L1 strange ADC reading

Question asked by emanuel.giuseppe on Feb 21, 2014
Latest reply on Feb 21, 2014 by fm
Hi, please I need a little help.
I'm using a STM32L151RCT6A in a project. We need to distiguish the hardware version of boards, so to use a single pin, we read the voltage on a partitor made of two resistor.
It is connected to pin PC5, corresponding to analog input 15.
Actually, lower resistor is 1,3kΩ and upper is 10kΩ. On 12 bits, I expect to read 471.
Now, the strange behaviour: the value read is greater, approx. 1300 to 1500 instead.
I tried to add delays, or some tests to control if value decreased because any discharge, but not, it stays at those levels.
But if I set a breakpoint after conversion, and then I retry to convert, value is correct!
I tried also to read with same code another ADC channel (nr. 4) where battery is connected, and it reads correctly.
Someone has an idea?

Outcomes