GPIF problem with EZ_USB FX2

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.

Reply to
Brian.Frohlich
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.