Hello,
I'm working our project with cybulk example which is located in
c:\Program Files\Cypress\Cypress Suite USB 3.4.2\CyAPI\examples\cybulk\ .
And MCU (CY68013A) code is refered on c:\Program Files\Cypress\GPIF Designer\fifo\ .
Structure is below.
host sends cmd by ep0 for uploading 32MB. -> mcu set GPIF and others in TD_Poll().
Now, WaitForXfer() has some bug. in previous bulletin, somenoe had same problem.
you can compare below 3 codes. it is extracted from BulkLoopDlg.cpp.
- WaitForXfer() has expired time every test.
- if TD_Poll() function is continuously uploading , WaitForXfer() will be success.
in oscilloscope , GPIF counter has 6 cycle completely, but WaitForXfer() has complete
receving then.
Maybe, BeginDataXfer() doesn't set event , when it has received by Length argument.
current correctly return of WaitForXfer() is returning by over received or other problem.
if you test this problem, don't operate example directly.
example code for MCU is wrong. it uploads infinitly by IN packet. Thus it fake bulkloop codes of WaitforXfer() as
correctly operation.
UINT XferLoop(){
.................................
#if 0//original code
UCHAR *outContext = dlg->OutEndpt->BeginDataXfer(data,outlen,&outOvLap);
UCHAR *inContext = dlg->InEndpt->BeginDataXfer(inData,inlen,&inOvLap);
dlg->OutEndpt->WaitForXfer(&outOvLap,2000);
dlg->InEndpt->WaitForXfer(&inOvLap,2000);
success = dlg->OutEndpt->FinishDataXfer(data, outlen, &outOvLap,outContext);
success = dlg->InEndpt->FinishDataXfer(inData,inlen, &inOvLap,inContext);
#elif 0//modified to use Bulkendpoint instead Endpoint class. it is still using WaitForXfer().
//UCHAR *inContext = dlg->InEndpt->BeginDataXfer(inData,inlen,&inOvLap);
UCHAR *inContext =dlg->USBDevice->BulkInEndPt->BeginDataXfer(inData,inlen,&inOvLap);
SendCmd(VX_B3);// send upload command by ep0. it release once if(in_enable) variable in
Fx2_to_extsyncFIFO.c file.
//dlg->InEndpt->WaitForXfer(&inOvLap,6000);
dlg->USBDevice->BulkInEndPt->WaitForXfer(&inOvLap,6000);
//success = dlg->InEndpt->FinishDataXfer(inData,inlen, &inOvLap,inContext);
success = dlg->USBDevice->BulkInEndPt->FinishDataXfer(inData,inlen, &inOvLap,inContext);
#else //this is good!!
//UCHAR *inContext = dlg->InEndpt->BeginDataXfer(inData,inlen,&inOvLap);
UCHAR *inContext =dlg->USBDevice->BulkInEndPt->BeginDataXfer(inData,inlen,&inOvLap);
Sleep(100);
SendCmd(VX_B3);
//dlg->InEndpt->WaitForXfer(&inOvLap,6000);
//dlg->USBDevice->BulkInEndPt->WaitForXfer(&inOvLap,6000);
Sleep(400);//32MB is consume about 349.5ms. 349.5ms/20.83ns=16M WORD. //it is correct.
//success = dlg->InEndpt->FinishDataXfer(inData,inlen, &inOvLap,inContext);
success = dlg->USBDevice->BulkInEndPt->FinishDataXfer(inData,inlen, &inOvLap,inContext);
#endif
|