cancel
Showing results for 
Search instead for 
Did you mean: 

Using same GPIO_PINs as input and output while the port is configured as "OUTPUT PP" AN4666

Zaher
Senior II

I'm trying to do something similar to what have been covered by the application note AN4666 "Parallel synchronous transmission using GPIO and DMA" but now I'm testing without DMA functionality. Right now, I can write/send data to GPIO port using:

GPIOC->ODR = DataBuf[i];

But when I need to read data back, can I use the following:

ReadBuf[i] = GPIOC->IDR;

without any modification to the GPIO Port configurations, or I need to re-configure the post as "INPUT" before I can read data? If port is configured as "OUTPUT OD", can I read the GPIO as stated earlier?

2 REPLIES 2

Well you can read back what it sees externally, which should be what you've written unless you have other devices attached which are conflicting/fighting with the levels you are asserting.

If you have other things driving that you want to read, you should put the mode of the pin to input.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Zaher
Senior II

Yes, I have a device attached to lowest 8-bits of GPIOC, so basically I want to read what the device sends over to the port and not values asserted by me. So, it has to be configured as input before reading the port.