cancel
Showing results for 
Search instead for 
Did you mean: 

Question about ADC versus GPIO Analog

Posted on April 03, 2015 at 04:23

In STM32CubeMX, when I click on a pin, the following are two of the choices amongst others are presented to me.

I want to understand what the difference is between ADC1_IN0 versus GPIO_Analog.

I have looked through numerous manuals and all over the Internet and all through ST Microelectronics website and cannot find a definitive answer. What is the difference, if any, why would I use one over the other, it at all?

#gpio-analog-adc #mx-gpio-analog
11 REPLIES 11
raptorhal2
Lead
Posted on April 03, 2015 at 22:34

GPIO Analog puts the pin in a low power state. ADC_IN0 will allow you to rank the channel for ADC conversion.

A code generation option in MX generates code to place all unused pins in GPIO Analog mode.

Cheers, Hal

Posted on April 04, 2015 at 04:07

Does that mean that GPIO Analog is also a disabled state or rather, currently unused?

The RM0090 Reference manual is extremely terse as to what GPIO Analog is. The diagram implies that Analog input and Analog output are still connected internally somewhere.

If the mode is set to GPIO Analog, is the pin usable at all, or for the current firmware load it is simply in a low power high impedance state?

raptorhal2
Lead
Posted on April 04, 2015 at 15:12

A GPIO Analog pin is usable as an analog input or output pin, but if you are using CubeMX, you have to edit the MX generated code each time to, for example, add an ADC channel. Let MX do the work for you.

Regards, Hal

Posted on April 04, 2015 at 16:49

Let me try this again.

ADC, Analog Digital Converter. A single voltage sample through successive approximation becomes represented by a 12 bit binary value that can be manipulated.

A GPIO, Analog input is usable as an analog input or output pin. This alternative configuration mode does not have an ADC or DAC hooked up to the pin, so how can it be used as an analog input or output.

What is the functional difference between ADC or GPIO analog input when a pin is defined in either configuration mode.

ADC = binary representaion of sampled voltage.

Analog input = ????? (Not an ADC!, so what is it?)

raptorhal2
Lead
Posted on April 04, 2015 at 18:09

It is a port pin with no pullup, pull down or Schmit trigger function.

Cheers, Hal

Posted on April 05, 2015 at 00:06

Hal, I read this manual, RM0090 Reference manual.

I read 8.3.12 Analog configuration, so I got all that.

When I read 13 Analog-to-digital converter (ADC), obviously I follow that too.

Now, my understanding is that, 8.4.1 GPIO port mode register (GPIOx_MODER) (x = A..I/J/K) when set as per the following table,

00: Input (reset state)

01: General purpose output mode

10: Alternate function mode

11: Analog mode,

gets me to Alternate function mode (a peripheral such as an ADC or DAC) or Analog mode. So, the two appear to be mutually exclusive in the manual as well, thus reflecting the operation of STM32CubeMX.

So, I ask again, what does GPIO Analog input give me for functionality? What does it do? It's not an op-amp input, it's not a VCO input, what is it?

Posted on April 05, 2015 at 05:07

Maybe I missed something here, not being overly familiar with the ARM nor the STM design.

STM32CubeMX enables me to choose, ADC1 IN0 or GPIO Analog Input.

If I choose ADC1 IN0, STM32CubeMX also chooses GPIO Analog Input in the background for me.

If I choose GPIO Analog Input, then the pin is set to consume as minimal amount of power as is feasibly possibly, and, as this is the mode that I chose, STM32CubeMX shows the ADC1 IN0 as not being available it is now displayed in RED.

Is this what you have been trying to tell me?

raptorhal2
Lead
Posted on April 05, 2015 at 15:47

Yes.

You have summarized it very eloquently.

Undoubtedly this question will arise again with someone else. Whoever responds can point to this thread for an answer.

Cheers, Hal

dgrobinson
Associate
Posted on December 29, 2015 at 19:14

This is not clear to me.

I need a bunch of PWM outputs and ADC inputs.  On the STM32F429, if I want to use the LCD and SDRAM interfaces, it becomes someone problematic.  

My question this: There are pins labeled as GPIO_analog in STM32CubeMX.  Is it possible to use them with an ADC?