1
\$\begingroup\$

So I'm working with an AD5593R chip, which I don't expect anyone to have specific experience with, but I'm hoping there might be a general principle which I can apply.

Basically there's a control register that lets you set which of its 8 pins are GPIO output, and a separate register that lets you set which of its 8 pins are GPIO input. This confuses me slightly.

What if I set them all to 1 in both registers? Are they all output and input at the same time? Or does whatever I set most recently override the other?

I mean, what about the control register that dictates which are DAC pins? What if I try to make them all GPIO in, GPIO out, and DAC simultaneously?

How does this sort of thing usually work? The datasheet does not make it clear.

I mean, I'm not even sure what happens if I tell set all the bits to 0 in all those registers-- then what mode are the pins left in?

\$\endgroup\$
  • 1
    \$\begingroup\$ Reading a pin as an input when it is set as an output does have non-trivial functions. For example, if the output is set as open-drained, then its output value at the pin can be over-ridden by another open drained output connected to the same pin. \$\endgroup\$ – rioraxe Feb 4 '17 at 0:14
3
\$\begingroup\$

Your question was already answered on the datasheet, page 25. "When a pin is configured as both a general-purpose input and output, the primary function is as an output pin. This configuration allows the status of the output pin to be determined by reading the GPIO read configuration register"

\$\endgroup\$
  • \$\begingroup\$ Thanks very much, page 25 mostly answers my questions. I'm a little new to this sort of work; I don't know how you found that so fast. I would have sworn I read through the whole thing. \$\endgroup\$ – temporary_user_name Feb 4 '17 at 0:08
  • \$\begingroup\$ @Aerovistae you're welcome \$\endgroup\$ – Claudio Avi Chami Feb 4 '17 at 0:33
2
\$\begingroup\$

Answered in the GPIO SECTION of the data sheet.

When an I/Ox pin is set as an output, it is possible to read its status by also setting it as an input pin. When reading the status of the I/Ox pins set as inputs the status of an I/Ox pin set as both and input and output pin is also returned

\$\endgroup\$
0
\$\begingroup\$

Don't know your chip - the datasheet is likely your best bet.

Reading an output pin is common - you read its actual logic state. MCUs do that day-in and day-out. Nothing unique here.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.