cancel
Showing results for 
Search instead for 
Did you mean: 

Reading value on GPIO analog mode

Pawe? Jab?o?ski
Associate II
Posted on December 20, 2016 at 11:49

Hi,

could tell me someone, how to read value on GPIO analog mode (not ADC analog on AF mode). I was Googled this, and I just found that this mode has 8-bits converter. How can I recieve value from this, using HAL library? I need to configure something else in STM32CubeMX?

#gpio #analog #mode #stm32
2 REPLIES 2
Posted on December 20, 2016 at 11:54

Show the link you googled.

JW

Seb
ST Employee
Posted on December 20, 2016 at 12:34

The description is a bit blur.

For GPIO with Analog function, the pin structure looks like this: (reference manual)

0690X00000605u3QAA.png

If you want to know the input voltage level, make sure the pull-up and pull-down are disabled (unless wanting to self test)

Then reading the GPIO Input Register (IDR) to read the pin level respective to datasheet high-low threshold voltage spec.

There is no alternate function for the ADC, ADC has a mux to multiple channels going to selected GPIO as the one above.

I guess that if the pin is not connected and the GPIO is forced as output low or high, the ADC or Analog input can be read/converted. Does it make sense?