FX3/CX3(CYUSB3065) GPIO does not generate input interrupts

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

cross mob
YaXi_4492421
Level 2
Level 2
10 replies posted 10 questions asked 5 replies posted

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);

0 Likes
1 Solution

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

Regards,
Rashi

View solution in original post

0 Likes
4 Replies
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

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;

gpio_intr.PNG

If this doesn't help, please share the firmware  (.c) file

Regards,

Rashi

Regards,
Rashi
0 Likes

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?

0 Likes

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

Regards,
Rashi
0 Likes

Thank you very much! I can now enter GPIO interrupt.

0 Likes