What pins can I use for Analog Input/Output? STM32CubeMX allows every GPIO to be set to ''GPIO_Analog''?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-20 3:12 PM
Hello, I am currently using an STM32F301K6U. STM32CubeMX allows me to set pretty much any GPIO as a 'GPIOP_Analog'. However, when I go into the ADC1 under 'Peripherals' every single item is red because there is some conflict with another pin. The ST Micro rep told me I could set any GPIO as an analog input or output, so I am not understanding how this is supposed to work. How do I do an analog read on the GPIO I set as 'GPIO_Analog'? And similarly, do an analog out on these pins as well?
Thanks and any help/advice is greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-20 3:24 PM
The data sheet breaks down those connected to an ADC, ie ADC123_IN4
The reason to turn ANY pin to analogue is to turn OFF the schmitt trigger on the input that feeds down stream digital logic and GPIOx->IDR, etc. This avoids noise, and potential oscillation.
Use the ADC to measure the supported pins, use the DAC to output to supported pins. Review the Data Sheet
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-20 5:26 PM
Thank you
Turvey.Clive.002
for this answer. On the top of what you said I would like to add that switching off GPIO's Schmitt trigger also decreases a bit current consumption of MCU. That is why Analog Input is a recommended mode for all GPIOs, which are unused by application.Analog Input is a default mode of GPIOs inlow-power STM32 MCUs: STM32L0 and STM32L4. For other STM32 familiesuser has to take care about configuring unused GPIOs in Analog Input mode. This task can be easily done with STM32CubeMX:
Regards
Szymon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-20 5:28 PM
Thank you for this info. Yeah I went over the datasheet before creating the PCB and this was not very clear to me. Do you mind mentioning which page you are referring to and possible a small explanation? The datasheet in regards to ADC and DAC is very confusing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-02-20 5:37 PM
PA0 Channel1 of ADC1
PA1
Channel2 of ADC1PA2
Channel3 of ADC1PA3
Channel4 of ADC1PA4 Channel5 of ADC1 or Channel 1 of DAC1
Up vote any posts that you find helpful, it shows what's working..
