2021-07-14 10:15 AM
I am using a STM32L031 on a Nucleo board to sample analog inputs and VREFINT. When I sample the VREFINT voltage after another channel I observe some error that changes depending on the voltage on that previous channel. I assuming that charge is being carried from the previous sample to the VREFINT channel. I could not find this issue discussed in documentation. A long delay between the sampling helps but it is undesirable due to energy usage. How can I eliminate this issue.
A second issue is the code only works correctly when I sample channels in order. If I instead sample 5, 3, 4, VREFINT the data is incorrect. What am I missing?
I attached the code.
2021-07-14 10:37 AM
Do you observe the sampling time for VREFINT channel, specified by the datasheet?
If you switch off/on VREFBUF, you have to observe also the related delay, defined in the same table.
JW
2021-07-14 10:42 AM
Increase the sampling time to both increase accuracy and meet the datasheet requirement on sampling time for VREFINT.
ST really should make the max sampling time the default.
2021-07-14 11:03 AM
That was it. Thanks to both of you for that !!
I just need to figure out why the scan always goes 3,4,5, VREFINT even when I try 5,3,4,VREFINT. I though discontinuous meant I could pick the order.