You are here

FX2/FX2LP GPIF Done Interrupt Doesn't Fire | Cypress Semiconductor

Support & Community

FX2/FX2LP GPIF Done Interrupt Doesn't Fire

Last Updated: July 02, 2011

We are currently polling the GPIF done bit, but we want to use the GPIF done interrupt. When we set up the GPIF done interrupt, it does not fire. Shouldn't it fire once the endpoint FIFO has been filled so that one can start another transaction? Polling will reduce the overall throughput of the device and fail to take full advantage of the available USB 2.0 bandwidth. All of the examples in the manual show this interrupt being set up. However, the code is within a comment leading one to believe that this interrupt does not work in the FX2 part for some reason.


Generally speaking, the GPIF done interrupt should fire when after bursting GPIFTC number of bytes or words. Check to make sure that the INT4 interrupts are enabled as well as the individual GPIF done interrupt. Using the polling method is a perfectly acceptable method, and should not be a throughput limitation. In any case, here is what you need to do to setup the GPIF done interrupt and detect the event in the foreground loop, TD_Poll():

In TD_Init():

// setup INT4 as internal source for GPIF interrupts
// using INT4CLR (SFR), automatically enabled

INTSETUP |= 0x03; // Enable INT4 FIFO/GPIF Autovectoring
EXIF &= ~0x40; // just in case one was pending...
GPIFIRQ = 0x01; // clear GPIFDONE interrupt
GPIFIE = 0x01; // Enable GPIFDONE interrupt
EIE |= 0x04; // Enable INT4 ISR, EIE.2 (EIEX4=1)

The global flag gpif_done is set in the ISR:

void ISR_GpifComplete(void) interrupt 0
gpif_done = TRUE;
EXIF &= ~0x40;
INT4CLR = 0xFF; // automatically enabled at POR

The foreground loop TD_Poll detects the gpif_done flag
and clears it:

while( !( gpif_done ) ) // wait for GPIFDONE interrupt
gpif_done = FALSE; // clear gpif_done global flag

Knowledge Base Tags: 

Provide feedback on this article

Browse KB By Product

Browse KB by Type