I am using GPIF write waveform to send less than 512 bytes data block.
I referenced Knowledge Base Article "NextData/ActivateData in the GPIF read Waveform Interval".
In this paper,
In order to write data from the FIFO to the external peripheral, you will do an activate data first in one interval. Doing this will result in driving the first byte in the FIFO on to the GPIF data bus and then you may do a Next FIFO Data on the subsequent interval. Doing an Activate Data and a Next FIFO Data on the same interval will result in incrementing the FIFO pointer and driving the new data (pointed to by the incremented pointer) and should be done in subsequent intervals. Therefore a Next FIFO Data is required in case of GPIF Write
I activated data first in one interval(Same Data),and Next FIFO Data on the subsequent interval.
I writed 256 bytes “0x00, 0x01,…, 0xFF”,but read data is 258 bytes “0x00, 0x01,…, 0xFF,0xFE, 0xFF”.
So , last 2 byte in the FIFO,” 0xFE ,0xFF” repeated.
What is the reason?
The source code is as following.
// we are just using the default values, yes this is not necessary...
EP2CFG = 0xA2; // double buffer,bulk
EP2FIFOCFG = 0x15; //00010101 : AUTOOUT=1, ZEROLEN=1, WORDWIDE=1
EP2AUTOINLENH = 0x02; // When AUTOOUT=1, core commits IN data
EP2AUTOINLENL = 0x00; // ...when EPxAUTOINLEN value is met
EP2GPIFFLGSEL = 0x01; // FiFo empty Flag
void TD_Poll(void) // Called repeatedly while the device is idle
if( GPIFTRIG & 0x80 ) // GPIF is Idle
if(!(EP2468STAT & bmEP2EMPTY))
GPIFTRIG = GPIFTRIGWR | GPIF_EP2;
In Waveform, I repeated “Next FIFO Data on the subsequent interval” until EP2GPIFFLG empty.
GPIFWriteWaveform.bmp 710.2 K