- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is my code
CyU3PGpioSimpleConfig_t gpioConfig;
gpioConfig.outValue = CyFalse;
gpioConfig.inputEn = CyFalse;
gpioConfig.driveLowEn = CyTrue;
gpioConfig.driveHighEn = CyTrue;
gpioConfig.intrMode = CY_U3P_GPIO_NO_INTR;
CyU3PDeviceGpioOverride(17, CyTrue);
CyU3PGpioSetSimpleConfig(17, &gpioConfig);
CyU3PGpioSimpleSetValue(17 , CyTrue);
In this way, I can not set GPIO17(CTL0) to high. I just test it with DVK. The pin only connect to oscilloscope.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
It should work normally.
I am assuming that you are initializing the GPIO module before calling the code that you pasted here.
GPIO module can be initialized as follows:
/* Init the GPIO module */
gpioClock.fastClkDiv = 2;
gpioClock.slowClkDiv = 0;
gpioClock.simpleDiv = CY_U3P_GPIO_SIMPLE_DIV_BY_2;
gpioClock.clkSrc = CY_U3P_SYS_CLK;
gpioClock.halfDiv = 0;
/* Initialize Gpio interface */
apiRetStatus = CyU3PGpioInit(&gpioClock, NULL);
Are you saying that it is not working only when you configure GPIF II in 32-bit mode. or it is not working at all for you. Please let me know.
Thanks,
sai krishna.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you seeing any of these APIs returning some error code?.
Thanks,
sai krishna.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
void
GpioOutputThread_Entry (
uint32_t input)
{
CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;
/* Initialize Debug module */
apiRetStatus = CyFxDebugInit();
if (apiRetStatus != CY_U3P_SUCCESS)
{
/* Error handling */
CyU3PDebugPrint (4, "Debug module initialization failed, error code = %d\n",
apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}
/* Initialize GPIO module. */
CyFxGpioInit ();
CyU3PGpioSimpleConfig_t gpioConfig;
CyU3PGpioClock_t gpioClock;
for (;;)
{
gpioClock.fastClkDiv = 2;
gpioClock.slowClkDiv = 0;
gpioClock.simpleDiv = CY_U3P_GPIO_SIMPLE_DIV_BY_2;
gpioClock.clkSrc = CY_U3P_SYS_CLK;
gpioClock.halfDiv = 0;
/* Initialize Gpio interface */
apiRetStatus = CyU3PGpioInit(&gpioClock, NULL);
if (apiRetStatus != CY_U3P_SUCCESS)
{
/* Error handling */
CyU3PDebugPrint (4, "CyU3PGpioInit failed, error code = %d\n",
apiRetStatus);
// CyFxAppErrorHandler(apiRetStatus);
}
gpioConfig.outValue = CyFalse;
gpioConfig.inputEn = CyFalse;
gpioConfig.driveLowEn = CyTrue;
gpioConfig.driveHighEn = CyTrue;
gpioConfig.intrMode = CY_U3P_GPIO_NO_INTR;
apiRetStatus = CyU3PDeviceGpioOverride(17, CyTrue);
if (apiRetStatus != CY_U3P_SUCCESS)
{
/* Error handling */
CyU3PDebugPrint (4, "CyU3PDeviceGpioOverride failed, error code = %d\n",
apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}
apiRetStatus = CyU3PGpioSetSimpleConfig(17, &gpioConfig);
if (apiRetStatus != CY_U3P_SUCCESS)
{
/* Error handling */
CyU3PDebugPrint (4, "CyU3PGpioSetSimpleConfig failed, error code = %d\n",
apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}
apiRetStatus = CyU3PGpioSimpleSetValue(17 , CyTrue);
if (apiRetStatus != CY_U3P_SUCCESS)
{
/* Error handling */
CyU3PDebugPrint (4, "CyU3PGpioSimpleSetValue failed, error code = %d\n",
apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}
/* Set the GPIO 21 to high */
apiRetStatus = CyU3PGpioSimpleSetValue (21, CyTrue);
if (apiRetStatus != CY_U3P_SUCCESS)
{
/* Error handling */
CyU3PDebugPrint (4, "CyU3PGpioSetValue failed, error code = %d\n",
apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}
/* Wait for two seconds */
CyU3PThreadSleep(2000);
CyU3PGpioSetValue(17 , CyFalse);
if (apiRetStatus != CY_U3P_SUCCESS)
{
/* Error handling */
CyU3PDebugPrint (4, "CyU3PGpioSetValue failed, error code = %d\n",
apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}
/* Set the GPIO 21 to low */
apiRetStatus = CyU3PGpioSimpleSetValue (21, CyFalse);
if (apiRetStatus != CY_U3P_SUCCESS)
{
/* Error handling */
CyU3PDebugPrint (4, "CyU3PGpioSetValue failed, error code = %d\n",
apiRetStatus);
CyFxAppErrorHandler(apiRetStatus);
}
/* Wait for two seconds */
CyU3PThreadSleep(2000);
}
}
I only modify this function in GpioApp project. GPIO21 work prefect and GPIO17 always 0. Here is serial port output: CyU3PGpioInit failed before output, error code = 67
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It worked. The 38-MIC-BRK-2 board is not pin to pin connect. I tested wrong pin.
Thanks