Analog and Digital in the same pin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-04 8:20 AM
sorry for my english
I have a LCD TFT 480x320 with touch, and the pins like for the arduino. He is working very fine with STM32F407ZG, its all OK, I converted MCUFRIEND_KBV, with help from developer, to stm32. But i need to use the touch, but theproblem is in this. The touch, share pins with the digital pins. the touch analog read is in the same pin of the CS (sample).
In Arduino, its easy, only change pinmode from digital to analog, read analog, and then turn again to digital.
But in stm32cubeide, where i need to turn on the ADC and INx on the .ioc, I need to know. Can I turn on the ADC, and in the run time, turn off to use the pin as digital, and turn on only when i need to read the touch?
Thanks a lot.
Moacir Jr.
- Labels:
-
LCD-LTDC
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-04 9:01 AM
yes if you hack cubemx which assumes static config. set cube mx in analog mode, then manually change mode pin to digital input. you also need to check if you need to activate internal pull up/down resistor if needed in analog mode....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-04 9:41 AM
Read about the GPIO MODER register in the reference manual. Use bitwise operators on it to set pin modes at runtime.​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-04 9:58 AM
cool.. i will try do this... idea...
But one question, why have pins, like PE14 and PE15, that have GPIO Analog type, but do not have ADC or IN connected?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-04 9:58 AM
Yes, i know MODER from NXP LPC Arm. I am using HAL functions in STM32. But i think this is valid too... thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-04 10:36 AM
> I am using HAL functions in STM32.
Of course you can do it with HAL functions too, just the documentation is not too usable.
> why have pins, like PE14 and PE15, that have GPIO Analog type, but do not have ADC or IN connected?
It is recommended to configure unused pins as analog to reduce power consumption. Don't bother with it unless your board runs on battery power.
