cancel
Showing results for 
Search instead for 
Did you mean: 

To know the Register value to read ADC Converted Data

Saranraj
Associate II

I am writing the code to read the ADC data from internal temp sensor and ADC.

I want to know that what is the register value to read the ADC data from there.

 

I am using STM32H743ZIT6 Micro controller. We are  using ADC3,

The ADC is set to 16-bit resolution mode

The ADC input clock is 64 MHz.  The Clock Prescaler is set to 128. The sampling time for each input is set to 810.5

 

REgards

Saranraj

10 REPLIES 10

That will be in the Reference Manual - find it on the 'Documentation' Tab of the chip's Product Page:

https://www.st.com/en/microcontrollers-microprocessors/stm32h743zi.html#documentation

 

Or use HAL if you don't want to be delving into the register documentation ...

https://www.st.com/en/embedded-software/stm32cubeh7.html

Saranraj
Associate II

Hi Neil,

   I have searched the Reference manual i am not able to identify the register settings to read the ADC Data. 

Could you help me on this ??

The ADC is described in section 25 of the Reference Manual, RM0433, starting on page 912 (Rev 8):

AndrewNeil_0-1740994138043.png

https://www.st.com/resource/en/reference_manual/rm0433-stm32h742-stm32h743753-and-stm32h750-value-line-advanced-armbased-32bit-mcus-stmicroelectronics.pdf#page=912

The register descriptions are in section 25.6, starting on page 996:

AndrewNeil_1-1740994230190.png

The Data Register:

AndrewNeil_2-1740994357441.png

 

 

You haven't said what board you're using:

How to write your question to maximize your chances to find a solution.

  • If it's an ST board, look at the examples provided by CubeMX (standalone, or via CubeIDE)
  • If it's a 3rd-party or custom board, still look at the Cube examples, but adjust for your hardware.

Hi Neil,

   Thank You for your reply. I got the register settings. We are using Custom board which uses STmicrocontroller : STM32H743ZIT6: I want to know the register setting to read the Vref Voltage which is going to the internal of the microcontroller. Since i am using internal temp sensor and ADC to read the temperature. Vref is 2.5V 

 

Saranraj_0-1741247277119.png

 

Again: look at the Cube examples, but adjust for your hardware.

Possibly better: start on an ST board, and use the examples provided by CubeMX for that board. Once you've got that working, port to your custom hardware. That way, if you get problems, you have a working reference to go back to.

Hi Neil,

  Thank You for that. Sure.. But i am not able to get register settings for read the Vref voltage which is going inside teh microcontroller. I am feeding 2.5V to the Vref.

danielbathtub
Associate III

Hi, 

1.) You need to ensure that you have set your CHSLER Registers correctly that you are actually converting the VREF channel. 

2.) You need to ensure that you have the correct sampling time(slow enough), sounds like it by how heavily you are dividing your clock. This is what I found in your MCU reference manual. 

danielbathtub_0-1741328167826.png

3.) You need to ensure you have the correct ADC settings, Are you using a trigger source into the ADC to start a conversion ? Or are you just running it in continious mode ?.  You didn't specify this. (Most applications require a sampling trigger not continious). The reference voltage is not going to change every 1 mS. Even especially with a battery !. 

4.)  Now, If you actually have the ADC Data in your regitser. Next step is to make sense of what you have, generally there is a VREF CAL Pointer somewhere in your MCU(Datasheet). That you need as a calibration value for your Reference Voltage. I found this in your MCU datasheet. 

danielbathtub_1-1741328613991.png

*This points to a 16-bit value, so declare or define it as uint16_t*. 

The formula you use to calculate your actual Vref voltage(I do it in units of mV usually). Is given below from the reference manual for this MCU. 

danielbathtub_2-1741328823405.png

So what I usually do is replace 3.3V with 3300 mV. And my result is in units of mV. 

By using this with another series(STMG0x). I have measured values that agrees with a multimeter when I measure to the unit of mV. 

 

Hope this Helps ! 

 

Hi Daniel,

 

  Thank You your reply. Yes it helps. BUt i am feeding 2.5V from external power supply. SO is it possible to read the Vref from internal microcontroller ? Any register settings are there ?

 

Have you ever done a basic ADC on any MCU ?