Change ADC ref on STM32 M4 (STM32F407VGT6)

mikroC, mikroBasic and mikroPascal for PRO ARM® MCUs, supporting STM32, Tiva, Kinetis, & CEC devices
Post Reply
Author
Message
PauloFelix
Posts: 2
Joined: 10 Oct 2017 18:36

Change ADC ref on STM32 M4 (STM32F407VGT6)

#1 Post by PauloFelix » 10 Oct 2017 18:49

I'm currently using a mikromedia for STM32 (STM32F407VGT6) with mikroC pro for arm compiler. According to the schematics, the VREF for the ADC peripheral is 1.8 V. However, I want to change it to 3.3 V for my application. The mikroC PRO for ARM Libraries, particularly, the ADC libraries, has the method ADCx_Init_Advanced(). Although this function is used to change the Vref, the Library Manager of my project do not include it somehow. I'm thinking that for this MCU it is not possible to do it.

Am I right? Or is there any other way of changing the VREF for this development system (e.g., use an external REF)?

Thanks

Paulo
Attachments
Library Manager
Library Manager
Capture.PNG (22.93 KiB) Viewed 4480 times

User avatar
dusan.poluga
mikroElektronika team
Posts: 780
Joined: 02 Feb 2017 14:21

Re: Change ADC ref on STM32 M4 (STM32F407VGT6)

#2 Post by dusan.poluga » 11 Oct 2017 16:05

Hi,

Their are two voltage references to chose from.
The internal 1.2 voltage and the external voltage reference (set to 1.8V).

It is possible to achieve a higher voltage reference by modifying the hardware.

Best Regards,
Dusan Poluga.

PauloFelix
Posts: 2
Joined: 10 Oct 2017 18:36

Re: Change ADC ref on STM32 M4 (STM32F407VGT6)

#3 Post by PauloFelix » 11 Oct 2017 18:29

Hi dusan.poluga,

thank you for your reply.

Unfortunately, changing the hardware is not an option. It is risky and I dont want to damage the development board.

Thank you anyway for the information.

Regards,

Paulo

User avatar
dusan.poluga
mikroElektronika team
Posts: 780
Joined: 02 Feb 2017 14:21

Re: Change ADC ref on STM32 M4 (STM32F407VGT6)

#4 Post by dusan.poluga » 17 Oct 2017 09:33

Hi,

I am glad that i could answer your questions.

Best Regards,
Dusan Poluga.

guidofor
Posts: 5
Joined: 22 Mar 2021 18:08

Re: Change ADC ref on STM32 M4 (STM32F407VGT6)

#5 Post by guidofor » 02 Dec 2021 18:05

Hello,

I have the same problem in a custom board with the STM32F407VG, it is not possible to select the ADC reference because the ADCx_Init_Advanced function exists onli in the online help for the M4 family but if trying to use it the linker conmplies about missing identifier. In theory it should allow choosing among _ADC_EXTERNAL_VREFH, _ADC_INTERNAL_FVRH2_048V and _ADC_INTERNAL_FVRH2_5V so the only way to initialise the ADC is with ADCx_Init which by defaults sets the ADC reference to the Vdd supply. I hope this is resolved ASAP. Thank you.

Kind Regards

User avatar
darko.ilijevski
Posts: 581
Joined: 21 Mar 2017 16:57

Re: Change ADC ref on STM32 M4 (STM32F407VGT6)

#6 Post by darko.ilijevski » 06 Dec 2021 10:53

Hello,
I think you misunderstood my colleague's post: most of the STM32F MCUs use a factory-calibrated voltage reference source (VREFINT), hardwired internally to one of the input ADC channels. For F407VG, it is hardwired to the ADC1_IN17 channel. The use of the VREFINT is counterintuitive, especially for someone from the PIC/PIC32 environment, where the internal reference voltage source is used in the ADC process, directly. The STM32F can't select the VREFINT for the conversion process but rather as a known voltage reference to which the full-scale measurement is compared. This allows deriving the precise value of the actual VREF. Therefore, having ADC_Init_Advanced() function would not help with this.

STM32_ADC.png
STM32_ADC.png (41.59 KiB) Viewed 1631 times

It is quite a long explanation, so please refer to the article in the following link. Everything is explained there very clearly and in great detail: http://www.efton.sk/STM32/STM32_VREF.pdf
I have also attached the article here if the original server is taken down.

BR,
Darko
Attachments
STM32_VREF.pdf
(73.06 KiB) Downloaded 52 times
BR,
Darko

Post Reply

Return to “ARM PRO Compilers”