- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
}
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Should this be posted in USB forum ?
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
so where I should post it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
At the bottom of this page a whole section, forum, on USB controllers -
Regards, Dana.