Skip to main content
Pawe? Jab?o?ski
Associate II
December 20, 2016
Question

Reading value on GPIO analog mode

  • December 20, 2016
  • 2 replies
  • 1195 views
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
This topic has been closed for replies.

2 replies

waclawek.jan
Super User
December 20, 2016
Posted on December 20, 2016 at 11:54

Show the link you googled.

JW

Seb
ST Employee
December 20, 2016
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?