latency

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

cross mob
Anonymous
Not applicable

hi  

   

how i can reduce latency between GPIO interrupt  trigger and  start of reading  data from GPIF using CyU3PGpifReadDataWords function 

   

the actual latency that I have is 14 us  and its very long !!!!

   

I use Fx 3 MCU

   

 

   

my callback function is 

   

void CyFxGpioIntrCb (

   

        uint8_t gpioId /* Indicates the pin that triggered the interrupt */

   

        )

   

{

   

    CyBool_t gpioValue = CyFalse;

   

    CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;

   

    uint8_t data;

   

    /* Get the status of the pin */

   

    apiRetStatus = CyU3PGpioGetValue (gpioId, &gpioValue);

   

    if (apiRetStatus == CY_U3P_SUCCESS)

   

    {

   

        /* Check status of the pin */

   

        if (gpioValue == CyTrue)

   

        {

   

 

   

            /* Set GPIO high event */

   

            CyU3PEventSet(&glFxGpioAppEvent, CY_FX_GPIOAPP_GPIO_HIGH_EVENT,

   

                    CYU3P_EVENT_OR);

   

        }

   

        else

   

        { GPIF_ReadByte(&data, 0xDD);

   

            /* Set GPIO low Event */

   

            CyU3PEventSet(&glFxGpioAppEvent, CY_FX_GPIOAPP_GPIO_LOW_EVENT,

   

                    CYU3P_EVENT_OR);

   

        }

   

    }

   

}

   

 

   

 

   

 

   

where  GPIF_ReadByte is 

   

 

   

CyU3PReturnStatus_t GPIF_ReadByte(uint8_t *buffer, uint8_t Address)

   

{

   

CyU3PReturnStatus_t apiRetStatus = CY_U3P_ERROR_FAILURE;

   

uint32_t word;

   

uint8_t state = 100;

   

int32_t Try_Counter;

   

 

   

 

   

if(GPIF_Busy_Flag)

   

{

   

/* the GPIF interface is reserved */

   

return CY_U3P_ERROR_DEVICE_BUSY;

   

}

   

/* reserve the GPIF interface */

   

GPIF_Busy_Flag=CyTrue;

   

 

   

Try_Counter = 10000;

   

do

   

{

   

apiRetStatus = CyU3PGpifGetSMState(&state);

   

Try_Counter--;

   

}while(((apiRetStatus != CY_U3P_SUCCESS) || (state != WAIT1)) && (Try_Counter));

   

 

   

if((apiRetStatus == CY_U3P_SUCCESS) && (state == WAIT1))

   

{

   

/* set the address bus */

   

CyU3PGpifInitAddrCounter((uint32_t)Address,CyFalse,CyFalse,CyFalse,0);

   

CyU3PGpifControlSWInput (CyTrue);

   

/* extract data from the data bus */

   

Try_Counter = 1000;

   

do{

   

apiRetStatus = CyU3PGpifReadDataWords (0,CyFalse, 1, &word, CYU3P_NO_WAIT);

   

}while((apiRetStatus != CY_U3P_SUCCESS) && (Try_Counter));

   

CyU3PGpifControlSWInput (CyFalse);

   

*buffer = (unsigned char)word;

   

 

   

/* free the GPIF interface */

   

GPIF_Busy_Flag=CyFalse;

   

return(apiRetStatus);

   

}

   

/* free the GPIF interface */

   

GPIF_Busy_Flag=CyFalse;

   

return CY_U3P_ERROR_DEVICE_BUSY;

   

}

0 Likes
3 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Should this be posted in USB forum ?

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 so where I should post it 

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

At the bottom of this page a whole section, forum, on USB controllers -

   

 

   

www.cypress.com/

   

 

   

Regards, Dana.

0 Likes