cancel
Showing results for 
Search instead for 
Did you mean: 

Double Buffering on Interrupt Endpoint Issue

sivakumar431
Associate II
Posted on October 07, 2009 at 10:30

Double Buffering on Interrupt Endpoint Issue

2 REPLIES 2
sivakumar431
Associate II
Posted on May 17, 2011 at 13:25

Hi,

I am trying to implement Double Buffering on Interrupt Endpoint.

For initializing i am using the following code

/* Initialize Endpoint 1 */

SetEPType(ENDP1, EP_INTERRUPT);

SetEPDblBuffAddr(ENDP1,ENDP1_BUF0Addr,ENDP1_BUF1Addr);

ClearDTOG_RX(ENDP1);

ClearDTOG_TX(ENDP1);

SetEPTxStatus(ENDP1, EP_TX_VALID);

SetEPRxStatus(ENDP1, EP_RX_DIS);

SetEPTxStatus(ENDP1, EP_TX_NAK);

For sending i am using the following code

void HID_SendData(uint8_t *buffer, uint32_t length)

{

uint32_t Endpoint_DTOG_Status = _GetENDPOINT(ENDP1) & EP_DTOG_TX;

//Double buffered send.

if(length) {

SetEPDblBuffCount(ENDP1, EP_DBUF_IN, length);

if (!Endpoint_DTOG_Status)

{

UserToPMABufferCopy(buffer,ENDP1_BUF0Addr, length);

}

else

{

UserToPMABufferCopy(buffer,ENDP1_BUF1Addr, length);

}

FreeUserBuffer(ENDP1, EP_DBUF_IN);

SetEPTxCount(ENDP1,length);

SetEPTxValid(ENDP1);

}

}

The issue is always the data in the first buffer is sent to the Host, even though the filling of the second buffer is happening with the above send routine.

The two buffer addresses were give as follows

#define ENDP1_BUF0Addr (0x100)

#define ENDP1_BUF1Addr (0x140)

Please let me know if i am doing anything wrong in the intialization or sending.

Thanks

Siva

sivakumar431
Associate II
Posted on May 17, 2011 at 13:25

Got a reply from the Index>>USB Forum.

Here is the reply

http://www.st.com/mcu/forums-cat-8985-12.html

Thanks

Siva