Skip to main content
Zaher
Senior II
December 16, 2018
Question

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

  • December 16, 2018
  • 2 replies
  • 564 views

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?

    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    December 16, 2018

    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 VenmoUp vote any posts that you find helpful, it shows what's working..
    Zaher
    ZaherAuthor
    Senior II
    December 16, 2018

    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.