- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Why does it work with low speed? How can I get a high speed?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use CyU3PGpioSimpleSetValue() API instead of CyU3PGpioSetValue() API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank, I have fraquency 1,33 MHz, its not a very fast but better then was before.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ,
How fast would you like to drive the GPIO?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
fast as possible
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Evgen,
1. You could set GPIO with CyU3PGpioSimpleSetValue instead of CyU3PGpioSetValue.
2. Access GPIO through register. You could check the link below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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); \
}