2 Replies Latest reply on Sep 6, 2019 5:43 AM by MaPe_1936286

    GPIO both Analog and Digital

    MaPe_1936286

      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

        • 1. Re: GPIO both Analog and Digital
          JoMe_264151

          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

          • 2. Re: GPIO both Analog and Digital
            MaPe_1936286

            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