cancel
Showing results for 
Search instead for 
Did you mean: 

How to use STM32L152 Internal Ref for ADC?

Tom
Associate II
Posted on February 19, 2014 at 15:28

Hello,

I'm using  STM32L152 64pin MCU and don't know how to enable internal 1,2V Ref voltage for the ADC1.

The ADC works well but is seems to use Vref+/- pins (I have ca 2,8V at these) by default.

Btw. I'm on Discovery  STM32L152C-DISCO board.

Thanks in advance

Tomasz

#stm32l152-reference-voltage-1 #2
6 REPLIES 6
chen
Associate II
Posted on February 19, 2014 at 15:50

Hi

''I'm using  STM32L152 64pin MCU and don't know how to enable internal 1,2V Ref voltage for the ADC1.''

What 1.2V internal reference?

I do not see such a thing on the block diagram.

raptorhal2
Lead
Posted on February 19, 2014 at 16:30

The 1.2V Ref is automagically self enabled. If you wish to read it by converting it, then you need a conversion enable for it.

Cheers, Hal

Tom
Associate II
Posted on February 19, 2014 at 18:19

Hi!

What I meant was that I wanted the internal 1,2V ref be the reference voltage for the ADC.

Indeed I can measure it on ADC_Channel_17 and it reads 1689 (as by default the ADC takes as ref the voltage on Vref +/- pins).

From what I see in the ADC block diagram Vrefint can be measured as any ADC_IN but there is no info if Vrefint can be the reference voltage  for ADC itself?

This is strange to me as what is the use of internal 1,2V ref. voltage to be ''just measured'' by the ADC while in the first place the DSheet should explain how it make it the reference voltage for the ADC...

Regards

Tomasz

chen
Associate II
Posted on February 19, 2014 at 18:30

Hi

''From what I see in the ADC block diagram Vrefint can be measured as any ADC_IN but there is no info if Vrefint can be the reference voltage  for ADC itself?

This is strange to me as what is the use of internal 1,2V ref. voltage to be ''just measured'' by the ADC while in the first place the DSheet should explain how it make it the reference voltage for the ADC...''

Yes, like you I could not see it on the ADC block diagram.

However, it is in one of the other diagrams. It does state that Vintref is selectable as a ADC source.

So, yes it is possible, my bad.

''This is strange to me as what is the use of internal 1,2V ref. voltage to be ''just measured'' by the ADC''

It is referenced in the section about measuring the ARMcore temperature. You will have to re-read the section on reading the temperature and see if it makes any more sense.

Tom
Associate II
Posted on February 20, 2014 at 10:48

Hi

What diagram do you mean? Please advise in which datasheet have you found this?

Regards

Tomasz

chen
Associate II
Posted on February 20, 2014 at 11:02

Hi Tom

Doc : RM0038

Revision : DocID15965 Rev 8

This is the reference manual.

Diagram : Figure 22. Routing interface (RI) block diagram for low and medium density devices

or

Figure 23. Routing interface (RI) block diagram for medium+ density devices

(Depends which category the STM32L152 falls into)

''This is strange to me as what is the use of internal1,2V ref. voltage to be ''just measured'' by the ADC while in the firstplace''

I had a thought about this. If the STM32 is being power directly off a battery (unregulated supply) eg a CR2032, and the supply to the ADC is also off the battery, the supply voltage can vary.

The internal reference can be used to calibrate the ADC in this case.