Electronics > Microcontrollers

STM32 alternating between working and not working

(1/4) > >>

yashrk:
Hey!

I am working with STM32L051K8 with ADS114S06 ADC.
While most of the code runs fine and as expected, the error we are getting in the raw ADC value is higher in the alternate power cycle. That is at the input of 50mV we are expecting to get ~20970 from the ADC, once we will get 20982 which is a reasonable 0.03% error of the full span. But after the power cycle, we will get a value in the range of 21080 with an error of 0.33%. Again after doing few a power cycles, we go back to getting 0.03% error, and again after few power cycles, it will go bad, so on and so forth.

The only thing that solves the problem is adding a huge delay between two acquisitions on the scale of 25mS and above.
I have tried changing Sample Per Seconds in the ADC with no luck. I'm just not sure where to start digging.

Some more information:
1. The controller is running at 4.194MHz
2. ADC is set for continuous conversion mode, a gain of 32, low latency filter, 2K SPS and uses internal reference and current sources.

georges80:
Without a heck of a lot more details, we're only guessing...

Could be dirty power, power not coming up stable, analog path to the ADC, phase of the moon etc...

cheers,
george.

Psi:
yeah, sounds like you have AC noise on your signal

Scope the signal at the ADC pin with the scope ground connected to the nearest ground spot to the signal pin.

yashrk:

--- Quote from: Psi on May 14, 2021, 05:32:38 am ---yeah, sounds like you have AC noise on your signal

Scope the signal at the ADC pin with the scope ground connected to the nearest ground spot to the signal pin.

--- End quote ---

I also just tried reducing the gain to 1 and increasing the input voltage to 1V, get a higher signal-to-noise ratio.

Volt   Expected    Actual    Error
1   13106.8   13213   -0.32%
1   13106.8   13143   -0.11%

yashrk:
Hey,

I have narrowed the problem down to the ADC itself. After adding reset in the main loop the value started to switch between the errors without the system power cycling.
I have also added a schematic of the ADC section.

[attach=1]

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version