GPIO AF mode
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-06-06 12:35 AM
Posted on June 06, 2011 at 09:35
Hi,
Lets say i want to connect analog signal to ADC channel12 (which is default pin is PORTC-2). Should i configure GPIOC-2 mode as: GPIO_Mode_AIN or GPIO_Mode_AF_OD/PP? I suppose GPIO_Mode_AIN, so when do i use GPIO_Mode_AF_OD/PP? Thanks - Udi #gpio-mode
Labels:
- Labels:
-
GPIO-EXTI
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-06-06 12:51 AM
Posted on June 06, 2011 at 09:51
''when do i use GPIO_Mode_AF_OD/PP?''
When you have an
A
lternateF
unction that requiresO
pen-D
rain orP
ush-P
ull drive; eg, a USART or I2C...?Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-06-06 2:53 AM
Posted on June 06, 2011 at 11:53 Hi Neil, According to this FAQ:
http://www.st.com/stonline/faq/faqview.php?ids=1222
AFIO clock should be enabled when doing remap for peripheral pin (and not if it use its default pin), therefore i asked if the same thing goes for GPIO mode. Specifically, ADC channel pin should be used as GPIO_Mode_AIN or GPIO_Mode_AF?Thanks - Udi
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-06-06 2:21 PM
Posted on June 06, 2011 at 23:21 The terminology is confusing. Using a GPIO pin as an input to the ADC converter is clearly an ''alternate function'' by the everyday understanding of that phrase. But not here. You set the pin mode to 0, Ain, not to one of the 'Alternate Function' modes, to turn on the analog switch to the ADC and turn off the input buffers. The ''turn off the input buffers'' is an important phrase. Anytime there isn't a digital level on a pin, it should be set to pull-up/pull-down (for no connection) or analog input (if something is driving the pin to a middle level, such as the DAC output).
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-06-09 1:08 AM
Posted on June 09, 2011 at 10:08
Thanks Donald, It makes sense.
