cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F405 - ADC Result Not Reaching Full Scale

racmatos
Associate

Hello,

 

I'm using the STM32F405RGT6 to continuously read 4 ADC channels with 12-bit resolution. The problem is that the results the ADC is giving seemed non-linear, as you can see in the Excel file attached, where I tested it by injecting voltage from a signal generator directly into the ADC pins.

 

The ADC configuration I'm using is as below:

 

Screenshot 2024-03-19 113502.pngScreenshot 2024-03-19 113519.png

 

The voltage reference in the MCU is as below:

 

Screenshot 2024-03-19 113734.png

 

Any thoughts on how can I fix this problem?

 

Thank you.

2 REPLIES 2
TDK
Guru

Do you have some known good hardware to try it out on? It would be good to rule out the signal generator as an error source.

I'm not sure how to interpret the data exactly. What does the asterisk mean? Seems like there a jump every 200mV, but every other increment has no jump. Sort of.

TDK_0-1710815049977.png

Are grounds connected between the board and signal generator? Does a voltmeter on the signal verify that the voltage is what you think it is?

Schematic looks fine.

I'd investigate the following possibilities:

  • Bad hardware (test it on known good hardware, or another board).
  • Bad input (multimeter to verify voltage input).
  • Super noisy power supply (verify power rail oscillation using a scope).
  • Bad test setup (verify connections, verify grounds, etc.).
If you feel a post has answered your question, please click "Accept as Solution".
racmatos
Associate

Hi @TDK 

 

Thank you for your reply.

 

The asterisk means that the value is not stable and I had to put the mean value.

 

Both grounds are well connected between the board and the signal generator, and I've also verified the voltage from the generator, it's fine.

 

I've tested the possibilities you gave me and here are the results:

  • Bad hardware (test it on known good hardware, or another board).
    • I tested using two Discoveries Boards from ST. One board using a STM32F407 as a 12-bit ADC with the exactly same code used in my main project, and one board using STM32F100 as a 12-bit DAC generating the signal. By doing that I could normally reach the full scale from the ADC (from 0 to 4095) in all 4 channels.
  • Bad input (multimeter to verify voltage input).
    • Checked. The signal generator is fine. I've also tested using a potentiometer with the same voltage source as the MCU and the results are unfortunately the same.
  • Super noisy power supply (verify power rail oscillation using a scope).
    • Checked. The power supply is fine. I've also tested removing the switching power supply and using a linear power regulator, and the results are also the same.
  • Bad test setup (verify connections, verify grounds, etc.).
    • Checked. All good.

 

I've also tested using three different STM32F405 chips, and the results are the same.