AnsweredAssumed Answered

Strange behavior of STM32L053 ADC

Question asked by Daric.Zoran on Feb 1, 2017
Latest reply on Feb 13, 2017 by Bessone.Danilo


By writing a program for very simple one channel ADC I faced with very strange behawior of the ADC in my MCU. During tests of the A/D converter, I read Vrefint (channel 17). If very shortly after calibration, about 1 second, I do the A/D conversion, everything is OK, I have correct value. In case I wait for a few seconds (more then 4 seconds) result is wrong. If I do second read very shortly, less then 4 second, I got correct result. If I do reading every second, the results are OK except first one. Note that incorrect value always is 2048 decimal (very strange).


In case I do reading two different channels effect is the same. This mean that I always have to do two conversions to have correct value or to do readings non-stop for all the necessary channels even if I don't need it.


In the attachment are flowcharts for ADC calibration, setup and conversion. I need to know what I'm doing wrong.


Note that clock source for the ADC is HSI at 4MHz. All other parameters except parameters changed in setup after calibration are default values after reset. Changing sampling time doesn't help.