Skip to main content
Associate
March 16, 2026
Solved

STM32U585OIY6QTR ADC reading garbage values

  • March 16, 2026
  • 4 replies
  • 563 views

I am planning to do an aging test which need capture the voltage of a net, but i found STM32U585OIY6QTR report a value about 40 while the actual voltage of ADC channel is close to VREF.

Then i write a simple ADC demo to verify ADC configuration, and run my code on B-U585I-IOT02A board(based on STM32U585AII6Q), it report a correct value, but the same code report a wrong value on my board.I use ADC1  CHANNEL2(GPIOC GPIO_PIN_1) on both board.

The only difference between B-U585I-IOT02A and my hardware is the different VREF i think(B-U585I-IOT02A use 3.3V, but my board use 2.5V).

Is there any difference on ADC usage between STM32U585AII6Q and STM32U585OIY6QTR?

You can find my ioc file and code in attachment, can anyone help me check my configuration?

Image20260316112201.pngImage20260316112207.png

 

Best answer by Francis_Fu

Thanks you for the reminder.

Finally, i found the root cause. I use the "erase full chip memory" function of Cube programmer to restore all option byte, and didn't check the actual value of TZEN, so TZEN is opened when i did the test. The correct method to close the TrustZone is set RDP first and close TZEN.

4 replies

jiangfan
ST Employee
March 16, 2026

Frankly speaking, your descriptions and your results can't match.

As your code did not work on your board, you may do simple test on your board - to measure 0V and Vref first to see if OK or not - to ensure your board (hardware) is OK first.

Associate
March 17, 2026

Thanks for your reply!

Sure, I fogot to add these message. This ADC channel return a value about 40 when connected to 0V and VDDA, it doesn't change according to channel voltage.

Actually, i have a project with trustzone enabled shows that hardware have no issue, but i don't have the source code.

jiangfan
ST Employee
March 17, 2026

According to your explanation, you use same code on B-U585I-IOT02A board (based on STM32U585AII6Q) and your board (STM32U585OIY6QTR), you need to ensure that the ADC channel and GPIO pin (you did not share such information) are the same between 2 boards. So, you may check and ensure same the ADC channel and GPIO pin.

TDK
Super User
March 16, 2026

Is your board designed correctly? Is there a cap on VDDA/VREF+ and is the voltage buffer enabled? Show schematic if you can.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate
March 17, 2026

Thanks for your reply!

Actually, i have a project with trustzone enabled shows that hardware have no issue, but i don't have the source code.

So, this issue more likely to caused by configuration.

Mike_ST
Technical Moderator
March 20, 2026

Hello,

>> "The only difference between B-U585I-IOT02A and my hardware is the different VREF i think(B-U585I-IOT02A use 3.3V, but my board use 2.5V)."

In your code I see :

/* Value of analog reference voltage (Vref+), connected to analog voltage */
/* supply Vdda (unit: mV). */
#define VDDA_APPLI (3300UL). Maybe you have to update to #define VDDA_APPLI (2500UL)

Another thing I see in the code, is that the ADC1 input frequency is on the low end (HSI16 / ADC presc 2 = 8MHz). Too high or too low frequency may give wrong reading, don't know if this is the case here, but please check the STM32U585 datasheet.

 

 

jiangfan
ST Employee
April 2, 2026

OK, in the end it turns out that the issue was due to TrustZone security (TZEN = 1). The issue description is in line with behavior of TrustZone not properly treated.