cancel
Showing results for 
Search instead for 
Did you mean: 

How to conveniently read GPIO while it is in AF mode ?

sprhawk
Associate II
Posted on November 05, 2015 at 17:59

I'm interfacing with TI CC1101, it need to check MISO pin to low before start SPI transaction.

Shall I change MISO pin to AF mode to Input mode before I read, and then change it back to AF mode to start SPI.

Is  there a convenient way to do so ? ( I think GPIO_Init is a little overhead )

Or I can just read the pin as normal input pin in AF mode ?
4 REPLIES 4
Posted on November 05, 2015 at 18:37

And what does the RM (you did not tell us what STM32 model you have in mind) say, in Alternate function configuration sub-chapter of GPIO chapter, on read accesses to the input data register?

JW

Posted on November 05, 2015 at 18:49

I'd expect GPIOx->IDR would work transparently.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
thomfischer
Senior
Posted on November 05, 2015 at 18:57

Hello,

which processor family ?,

I am doing something comparable in STM32F4 with WS Signal on I2S interface.

I just read the PIN which is configured in AF-mode as normal Input pin with

HAL_GPIO_ReadPin().

If you have a look at the

Figure 25. Basic structure of a five-volt tolerant I/O port bit

in reference manual ,

you can see that the input signal goes parallel to the Alternate function input and the Input data register,

so I think, that you always can read the state of a Pin, even if it is in AF-mode.

best regards

sprhawk
Associate II
Posted on November 05, 2015 at 20:41

Thanks for all your replies.

I will do just read pins.

My processor is STM32F4 series