Simple GPIO max speed

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

cross mob
EvEv_2610591
Level 2
Level 2

Hi, I want to drive simple GPIO with max speed.

I have initialized the deviceinit and GPIO clock  as:

/* Initialize the device */

clockConfig.setSysClk400 = CyTrue;

clockConfig.cpuClkDiv     = 2;

clockConfig.dmaClkDiv     = 2;

clockConfig.mmioClkDiv    = 2;

clockConfig.useStandbyClk = CyFalse;

clockConfig.clkSrc       = CY_U3P_SYS_CLK;

/* Initialize the GPIO block */

gpioClock.fastClkDiv = 2;

gpioClock.slowClkDiv = 2;

gpioClock.simpleDiv = CY_U3P_GPIO_SIMPLE_DIV_BY_2;

gpioClock.clkSrc     = CY_U3P_SYS_CLK;

gpioClock.halfDiv   = 0;

Then I tried to create pulses:

/* Initialize test pin */

newGpioConfig.outValue = CyFalse;

newGpioConfig.driveLowEn = CyTrue;

newGpioConfig.driveHighEn = CyTrue;

newGpioConfig.inputEn = CyFalse;

newGpioConfig.intrMode = CY_U3P_GPIO_NO_INTR;

apiRetStatus = CyU3PGpioSetSimpleConfig(TEST_30, &newGpioConfig);

/* loop */

while(1){

     CyU3PGpioSetValue (TEST_30, CyFalse);

     CyU3PGpioSetValue (TEST_30, CyTrue);

}

I see that speed is too slow. Swithing frequency is very low. Frequency is about 288 kHz.

t.jpg

    Why does it work with low speed? How can I get a high speed?

0 Likes
1 Solution
ManaskantD_51
Employee
Employee
Welcome! 25 solutions authored 10 solutions authored

Use CyU3PGpioSimpleSetValue() API instead of CyU3PGpioSetValue() API

View solution in original post

0 Likes
6 Replies
ManaskantD_51
Employee
Employee
Welcome! 25 solutions authored 10 solutions authored

Use CyU3PGpioSimpleSetValue() API instead of CyU3PGpioSetValue() API

0 Likes

thank, I have fraquency 1,33 MHz, its not a very fast but better then was before.

0 Likes
YangyangC_06
Employee
Employee
750 replies posted 500 replies posted 250 replies posted

Hi ,

How fast would you like to drive the GPIO?

0 Likes

fast as possible

0 Likes

Hi Evgen,

1.     You could set GPIO with CyU3PGpioSimpleSetValue instead of CyU3PGpioSetValue.

2.     Access GPIO through register. You could check the link below

https://community.cypress.com/docs/DOC-10967

0 Likes
Anonymous
Not applicable

If you are trying to improve performance, I suggest not using CyU3PGpioSimpleSetValue() either. Figure out the configuration bits for your port and bang the GPIO register directly with writes. E.g.

#define CyU3PGpioFastSetValue(gpioId,value) {\

        GPIO->lpp_gpio_simple[gpioId] = CY_U3P_LPP_GPIO_ENABLE \

               | CY_U3P_LPP_GPIO_DRIVE_LO_EN \

               | CY_U3P_LPP_GPIO_DRIVE_HI_EN \

               | (value?CY_U3P_LPP_GPIO_OUT_VALUE:0); \

    }

0 Likes