Trouble with Bulk Out transfer using Cypress CY7C64613 & uv2

I am developing a device that must send out data through the FIFO at speeds up to 4 Mbit/s. I have implemented a bulk transfer as follows:

void TD_Poll(void)                     // Called repeatedly while the device is idle
{
   if(OutOutPtr - OutInPtr > 64 | OutOutPtr < OutInPtr)
   {
      if(!(OUT2CS & 0x20))
      {
         if(OUT2BC && DMAOK)
         {
            DMAOK = FALSE;
            OUTC = OUT2BC;
            DMALEN = OUT2BC;
            DMASRC = &OUT2BUF;
            DMADEST = &OutBuffer[OutInPtr];
            DMAGO = 1;
            DMAOK = TRUE;
            OutInPtr += OUT2BC;
            if (OutInPtr >= 1024) OutInPtr = 0;
            OUT2BC = 0;
         }
      }
   }
}
In the AOUT FIFO programmable interrupt there is a similar section of code that DMA's from the OutBuffer to the A FIFO.
This code works well, but only up to 74kByte/s. Beyond that it begins skipping chunks of data. I have tried moving to an interrupt-driven design, where I place similar code in the ISR_Ep2out section but the data becomes corrupted and the interrupt does not reset. Any clues on how to remedy this would be greatly appreciated. Thanks

Jonathan Pribble

More questions in this forum