2 Replies Latest reply on Oct 11, 2019 2:04 AM by GuSc_293616

    How to set GPIO's default's value.


      I use api "CyU3PDeviceConfigureIOMatrix" to enable some GPIOs, while enable it, Is it high or low for these GPIO's? how to set to high while is enabling?

        • 1. Re: How to set GPIO's default's value.

          Hello Peter,


          You can configure the GPIO:


              CyU3PGpioSimpleConfig_t gpioConfig;


              /* Configure GPIO 21 as output */

              gpioConfig.outValue = CyFalse;      //This will set the initial value of the GPIO to Low. You can set initial value of GPIO using this field

              gpioConfig.driveLowEn = CyFalse;

              gpioConfig.driveHighEn = CyFalse;

              gpioConfig.inputEn = CyTrue;

              gpioConfig.intrMode = CY_U3P_GPIO_NO_INTR;

              apiRetStatus = CyU3PGpioSetSimpleConfig(21, &gpioConfig);


          You can also refer to the GPIOAPP example of the SDK   Path : \Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxgpioapp




          • 2. Re: How to set GPIO's default's value.

            or some other config options:

            • TriState

              CyU3PGpioSimpleConfig_t gpioConfigTriState;

              gpioConfigTriState.intrMode   = CY_U3P_GPIO_NO_INTR;

              gpioConfigTriState.inputEn    = CyFalse;

              gpioConfigTriState.driveLowEn = CyFalse;

              gpioConfigTriState.driveHighEn= CyFalse;

              gpioConfigTriState.outValue   = CyFalse;


            • Output (high level )

            CyU3PGpioSimpleConfig_t gpioConfigOutput_On;

              gpioConfigOutput_On.outValue = CyTrue;

              gpioConfigOutput_On.driveLowEn = CyTrue;

              gpioConfigOutput_On.driveHighEn = CyTrue;

              gpioConfigOutput_On.inputEn = CyFalse;

              gpioConfigOutput_On.intrMode = CY_U3P_GPIO_NO_INTR;


            • Output (low level )

            CyU3PGpioSimpleConfig_t gpioConfigOutput_Off;

              gpioConfigOutput_Off.outValue = CyFalse;

              gpioConfigOutput_Off.driveLowEn = CyTrue;

              gpioConfigOutput_Off.driveHighEn = CyTrue;

              gpioConfigOutput_Off.inputEn = CyFalse;

              gpioConfigOutput_Off.intrMode = CY_U3P_GPIO_NO_INTR;


            • Input

              CyU3PGpioSimpleConfig_t gpioConfigInput;

              gpioConfigInput.inputEn = CyTrue;

              gpioConfigInput.driveLowEn = CyFalse;

              gpioConfigInput.driveHighEn = CyFalse;

              gpioConfigInput.outValue = CyTrue; // I think it is ignored

              gpioConfigInput.intrMode = CY_U3P_GPIO_NO_INTR;


            Keep in mind if you not set  CyU3PGpioSimpleConfig_t::driveLowEn and CyU3PGpioSimpleConfig_t::gpioConfigInput.driveHighEn to true for a output the pin keeps tristated!