cancel
Showing results for 
Search instead for 
Did you mean: 

Double Buffered Bulk In Transfer, problem.

fa
Associate II
Posted on December 22, 2005 at 05:36

Double Buffered Bulk In Transfer, problem.

3 REPLIES 3
fa
Associate II
Posted on December 13, 2005 at 04:57

Hi,

I am trying to write an application, that is capeable of transfering bulk packets of different sizes.

The problem is that if I transfers an uneven number of packets (64 bytes) f.i. 7 packets, then the first transfer is ok, the next seems to be ok, but actualy 8 packets is transferred, and the 3rd packet isn't succesfull because the header is copied to the wrong buffer.

Has anyone made anything for Bulk In transfer, that is working with different transfer sizes?

Best regards, Frank Andersen

PS. I have attached my usb_endp.c file

________________

Attachments :

usb_endp.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtDa&d=%2Fa%2F0X0000000aKP%2FwPuLGE8c_uvLGyeswW.hxJSyIogjX3ghcc9DzzrxlFc&asPdf=false
fa
Associate II
Posted on December 21, 2005 at 09:43

Is there any one out there, working on this topic?

Best regards

Frank Andersen

robertmarsche9
Associate II
Posted on December 22, 2005 at 05:36

Maybe its not the amount of pakets, but the paket size. In the last line of this function ther should be an <= instead of ==.

if(wNTrasf <= 0) return;

Hope this helps.

void UserToPMABufferCopy(BYTE *pbUsrBuf,WORD wPMABufAddr, WORD wNBytes)

{

BYTE *pbVal;

WORD wVal;

DWORD *pdwVal;

int wNTrasf=wNBytes;

if((wNBytes) == 0) return;

pdwVal = (DWORD *)(wPMABufAddr*2 + PMAAddr);

while(USB_TRUE)

{

wVal = 0;

pbVal = (BYTE *)&wVal;

if((wNTrasf--) > 0)

{

*pbVal++ = *pbUsrBuf++;

if((wNTrasf--) > 0)

{

*pbVal++ = *pbUsrBuf++;

}

}

*pdwVal++ = (DWORD)wVal;

if(wNTrasf <= 0) return;

}/* while *null