GPIF problem with EZ_USB FX2

Oct 27, 2008 0 Replies

I am using EP8FIFO to write data to an external device via GPIF.



I initialize as so:



EP8FIFOCFG=0x01; // AutoIn/AutoOut Disabled, WORDWWIDE=1 0x01); SYNCDELAY; EP8CFG = 0xA2; // Set EP8 to Bulk OUT 512 byte double buffered SYNCDELAY;



I write the data as so:



while(!(GPIFTRIG&GPIF_Done_bit)) ;



for(i = 0; i < len; i++) { SYNCDELAY; EP8FIFOBUF[i] = p[i + 1]; i++; SYNCDELAY; EP8FIFOBUF[i] = p[i - 1]; }



SYNCDELAY; EP8BCH = 0; SYNCDELAY; EP8BCL = len;



SYNCDELAY; GPIFTCB1 = 0; SYNCDELAY; GPIFTCB0 = len/2; SYNCDELAY;



GPIFTRIG = GPIF_EP8; // Start write on EP8 SYNCDELAY; while(!(GPIFTRIG&GPIF_Done_bit)) ;



This will run two times, but hangs on the third attempt.



If I add the following initialization code:



EP8BCH = 0x80; // arm EP8OUT by writing byte count w/skip. EP8BCL = 0x80; // arm EP8OUT by writing byte count w/skip. SYNCDELAY; EP8BCH = 0x80; // arm EP8OUT by writing byte count w/skip. EP8BCL = 0x80; SYNCDELAY;


OUTPKTEND = 0x08; // arm first buffer by writing OUTPKTEND w/skip=1 SYNCDELAY; OUTPKTEND = 0x08; // arm second buffer by writing OUTPKTEND w/skip=1 SYNCDELAY;



It never hangs, but the data (FD0:FD15) is not correct.



Thanks for your help.


Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required