GPIO both Analog and Digital

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MaPe_1936286
Level 3
Level 3
First like received First like given Welcome!

Hi.

I’m developing a project which should run with 2 different configurations.

The configuration is set at startup and will not change runtime.

The different configurations regards the settings of two GPIO (GPIO1, GPIO2) and an OpAmp.

First configuration:

  • OpAmp is enabled
  • GPIO1 is an Analog and it is an input of Opamp(+)
  • GPIO2 is an Analog and it is an output of Opamp

Second configuration:

  • OpAmp is disabled
  • GPIO1 is a Digital Input (High Impedance)
  • GPIO2 is a Digital Output (Strong Drive)

I’ve seen on the datasheet that it is possible to configure:

  • GPIO1: both Analog and Digital Input
  • GPIO2: both Analog and Digital Output

But the datasheet notice that “should be used with care”, and I can’t find any examples.

So I would like to ask if there are some examples of GPIO configured both Analog and Digital.

Thank you

Maurizio

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Easiest solution would be to set the pin's properties at run-time after detecting the mode the project must run.

there are a few APIs to set the required mode for a pn as void Pin_SetDriveMode (uint8 mode).

Bob

View solution in original post

0 Likes
2 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Easiest solution would be to set the pin's properties at run-time after detecting the mode the project must run.

there are a few APIs to set the required mode for a pn as void Pin_SetDriveMode (uint8 mode).

Bob

0 Likes

Yes, it works.

I configured with TopDesign:

- GPIO1: both Analog and Digital Input

- GPIO2: both Analog and Digital Output.

And at startup I set the Drive Mode of GPIO2 to "High Impedance Analog" for Analog or "Strong Drive" for Digital Output.

For GPIO1 the Drive Mode must not be changed, it is "High Impedance Digital" for Analog and for Digital Input.

Thank you Bob

Bye

Maurizio

0 Likes