2021-12-13 07:29 AM
Hello,
I am trying to do a voltage measurement, i know i can use ADC to do it.
What a gpio is capable of when it is configured as Analog Mode? Can it measure voltages? or Can it trigger an interrupt if a defined threshold exceeds?
I need a clarification for that since i could not figure it out from the datasheet or reference manual?
Thank you
2021-12-13 07:35 AM
What STM32?
If you want to measure voltages, you need to use the ADC with the pin in analog mode. If you're interested in when it crosses a threshold, the analog watchdog could be used to trigger an event based on the converted ADC value.
Some families have a comparator which can be used to detect a threshold, but won't give you a voltage reading.
2021-12-13 10:12 AM
A GPIO pin put in "analog mode" just mean that. Analog could be ADC, DAC, comparator, etc.... it depends on what analog peripheral you activate.
ADC have channels, check the datasheet and reference manual (and errata sheet) to find which pin match which ADC channel.
Remember that most of the time, a pin that can be "analog" is up to 3.3V only (not 5V tolerant).
If you let the ADC keep scanning a channel, it most of the time have an analog watchdog feature to assist the core: It can generate a flag / interrupt when one ADC value has been out of user defined range...
2021-12-13 10:58 AM
Thank you, i understand now.