How to Toggle GPIO pin to Logic High

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

cross mob
lock attach
Attachments are accessible only for community members.
saku_4625426
Level 3
Level 3

Hello Community,

I want to toggle the GPIO pin(In my case it is GPIO 57) in order to increase the voltage going to S0-Port.

I am using custom FX3S board and transfering data from FPGA to S0-Port of FX3. But the data transfer is very slow.I checked the voltage going into SD card port it is 1.8v.So i want to make it logic high i.e 3.3 v.Where to make the changes in firmware accodingly.Thanks in Advance.

Regards,

Sai.

0 Likes
1 Solution
YashwantK_46
Moderator
Moderator
Moderator
100 solutions authored 50 solutions authored 50 likes received

Hello Sai Kumar,

You will have to add GPIO initialization in the appinit() function.

In the gpioinit(), you will have to firstly over-ride the GPIO by using CyU3PDeviceGpioOverride() function and then configure it as a simple GPIO.

You can then drive the GPIO high/low based on the polarity of the VSEL of the voltage regulator according to your need.

You can go through the SDK firmware in the path: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxgpioapp

Go through the firmware and configure the GPIO as shown in the above firmware.

Regards,

Yashwant

View solution in original post

0 Likes
7 Replies
YashwantK_46
Moderator
Moderator
Moderator
100 solutions authored 50 solutions authored 50 likes received

Hello Sai Kumar,

You will have to add GPIO initialization in the appinit() function.

In the gpioinit(), you will have to firstly over-ride the GPIO by using CyU3PDeviceGpioOverride() function and then configure it as a simple GPIO.

You can then drive the GPIO high/low based on the polarity of the VSEL of the voltage regulator according to your need.

You can go through the SDK firmware in the path: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\serialif_examples\cyfxgpioapp

Go through the firmware and configure the GPIO as shown in the above firmware.

Regards,

Yashwant

0 Likes

Hello,

I have gone through that GPIO firmware.I added the below snippet in my firmware.But still the voltage is 1.8v only.Is there anything to be done still?

  /* Initialize GPIO module. */

    CyFxGpioInit ();

   

    for (;;)

    {

        /* Set the GPIO 57 to high */

        apiRetStatus = CyU3PGpioSetValue (57, CyTrue);

        if (apiRetStatus != CY_U3P_SUCCESS)

        {

            /* Error handling */

            CyU3PDebugPrint (4, "CyU3PGpioSetValue failed, error code = %d\n",

                    apiRetStatus);

            CyFxAppErrorHandler(apiRetStatus);

        }

        /* Wait for 5 seconds */

        CyU3PThreadSleep(5000);

        /* Set the GPIO 57 to low */

        apiRetStatus = CyU3PGpioSetValue (57, CyFalse);

        if (apiRetStatus != CY_U3P_SUCCESS)

        {

            /* Error handling */

            CyU3PDebugPrint (4, "CyU3PGpioSetValue failed, error code = %d\n",

                    apiRetStatus);

            CyFxAppErrorHandler(apiRetStatus);

        }

        /* Wait for 5 seconds */

        CyU3PThreadSleep(5000);

    }

}

I also checked by commenting /* Set the GPIO 57 to low */.

Regards,

Sai.

0 Likes

Hello Sai Kumar,

In CyFxGpioInit (), you will have to do the following for GPIO 57. pastedImage_0.png

Replace 21 with 57 in both the GpioOverride API and SetSimpleConfig API as well to firstly configure the GPIO 57 as simple GPIO.

The initial state of GPIO 57 will be low, because outValue = CyFalse depicts initial state as LOW and CyTrue means initial state is HIGH.

Only after doing this you can set the value of the GPIO 57.

Regards,

Yashwant

0 Likes
lock attach
Attachments are accessible only for community members.

Hello,

I have done the steps you mentioned in previous response,but the voltage is not going to logic high(3.3v).Please refer to attached firmware.

Regards,

Sai.

0 Likes

Hello,

Please tell me if I am doing wrong.

Regards,

Sai.

0 Likes

Hello Sai,

The CyFxGpioInit() seems correct and the GPIO 57 configuration is also correct.

In the for (;;) loop, you are pulling it HIGH for 2 seconds and then pulling it LOW again and waiting for 2 seconds.

This will toggle GPIO 57 every 2 seconds and this can damage the Voltage regulator on your board because of this constant switching (If its done just to test, then its okay).

Can you probe the GPIO 57 with an oscilloscope or a logic analyzer and see if you can see the toggling of the GPIO?

Regards,
Yashwant

0 Likes

Hello,

Can you probe the GPIO 57 with an oscilloscope or a logic analyzer and see if you can see the toggling of the GPIO?

     Yeah,I checked the GPIO 57 with Multimeter and the voltage was same which is 1.8v.

(If its done just to test, then its okay).

      Yes,I kept it for testing purpose.And one thing as I mentioned in third response ,I also checked by commenting /*Set the GPIO 57 to low*/.So that I can monitor the logic high voltage(3.3v).But I dont know why the voltage is still 1.8v.Please make me clear at this point.

Regards,

Sai.

0 Likes