- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use GPIO for input interrupt, but I can't get in to interrupt, may I ask where I made a mistake? Here is my initialization and interrupt code:
// gpio int
void CyFxGpioIntrCb (uint8_t gpioId)
{
CyBool_t gpioValue = CyFalse;
CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;
/* Get the status of the pin */
apiRetStatus = CyU3PGpioGetValue (gpioId, &gpioValue);
if (gpioValue == CyTrue)
{
CyU3PGpioSetValue (22, CyFalse); // FOR IR LED
}
else
{
CyU3PGpioSetValue (22, CyTrue); // FOR IR LED
}
if( GPIO_SSOR_XVS == gpioId)
{
}
}
// init gpio
void
CyFxGpioInit (void)
{
CyU3PGpioClock_t gpioClock;
CyU3PGpioComplexConfig_t gpioConfig;
CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;
/* 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;
vJackyTestPrintNormal (4, "CyU3PGpioInit begin\n");
apiRetStatus = CyU3PGpioInit(&gpioClock, CyFxGpioIntrCb);
if (apiRetStatus != 0)
{
/* Error Handling */
vJackyTestPrintErr (4, "CyU3PGpioInit failed, error code = %d\n", apiRetStatus);
// CyFxAppErrorHandler(apiRetStatus);
}
CyU3PGpioSimpleConfig_t gpioConf = {0};
gpioConf.inputEn = CyTrue;
gpioConf.driveLowEn = CyFalse;
gpioConf.driveHighEn = CyFalse;
gpioConf.outValue = CyFalse;
gpioConf.intrMode = CY_U3P_GPIO_INTR_BOTH_EDGE;
apiRetStatus = CyU3PGpioSetSimpleConfig (44, &gpioConf);
}
main function:
io_cfg.gpioSimpleEn[1] = io_cfg.gpioSimpleEn[1] | FX3_GPIO_TO_HIFLAG(44);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
If you want the GPIO interrupt, you don't have to call CyU3PMipicsiInitializeGPIO API. You just need to call CyU3PGpioInit.
Are you getting the interrupt callback now?
If not please share the firmware file (.c)
Regards,
Rashi
Rashi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
1) Please check whether this CyU3PGpioSetSimpleConfig API is passing successfully or having some error, by using dome debug prints (error handling)
2) Also, confirm you have not used MipiCsiInitializeGpio() API in the code. If used please comment out because it internally calls GpioInit() API (without callback)
3) To check the CyFxGpioIntrCb is called, call CyU3PDeviceReset(CyFalse) API at the beginning of CyFxGpioIntrCb function.
4) You can also try to disable the GPIO in the IO Matrix and enable it using CyU3PDeviceGpioOverride API to enable GPIO
io_cfg.gpioSimpleEn[1] = 0;
If this doesn't help, please share the firmware (.c) file
Regards,
Rashi
Rashi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your help! Should I use the CyU3PMipicsiInitializeGPIO, MipiCsiInitializeGpio is what you said. I dropped my CyU3PMipicsiInitializeGPIO annotations, using only the CyFxGpioInit, I whether meet CyU3PMipicsiInitializeGPIO Settings?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
If you want the GPIO interrupt, you don't have to call CyU3PMipicsiInitializeGPIO API. You just need to call CyU3PGpioInit.
Are you getting the interrupt callback now?
If not please share the firmware file (.c)
Regards,
Rashi
Rashi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much! I can now enter GPIO interrupt.