cancel
Showing results for 
Search instead for 
Did you mean: 

Simulating Alternate Function Input

jpeacock2399
Associate II
Posted on October 26, 2011 at 20:27

In the STM32 reference manual (

Doc ID 13902 Rev 13

) in section 9.1.4 it states:

It is also possible to emulate the AFI input pin by software by programming the GPIO controller. In this case, the port should be configured in Alternate Function Output mode. And obviously, the corresponding port should not be driven externally as it will be driven by the software using the GPIO controller.

 

 

The question is how to use this?  I'd like to simulate encoder inputs to TIM4.  But if I set the GPIO B6 (TIM4 CH1) and B7 (TIM4 CH2) pins to alternale output it disconnects the ODR output register, so how can I set/reset the B6 and B7 pins in software?  CPU is an STM32F103Z on a STM3210E eval board.

  Jack Peacock

#gpio-alternate-function
2 REPLIES 2
Posted on October 26, 2011 at 21:59

According to the pin diagram, I think you'll find you need to program the pin as a ''GPIO Output Push-Pull'', and the AF Input will then read the state you are driving via normal GPIO settings.

GPIO vs AF Output is selected via a mux, so setting it as AF Output appears to be nonsensical.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
rigomate
Associate II
Posted on September 03, 2012 at 09:52

Just for those who read this and are wondering:

Setting the pin to Output Push-Pull, as clive1 suggested, is indeed correct.