2010-09-06 04:35 AM
Sending Junk 128 bytes during Double Buffering
2011-05-17 05:05 AM
Double buffering is a nightmare due to the basic documentation and examples provided. I use the code below and get no junk through...
// Initialize Endpoint 1 double buffered bulk IN (device tx)
SetEPType(ENDP1, EP_BULK);
SetEPDoubleBuff(ENDP1);
SetEPDblBuffAddr(ENDP1, ENDP1_TXADDR0, ENDP1_TXADDR1);
SetEPDblBuffCount(ENDP1, EP_DBUF_IN, Device_Property.MaxPacketSize);
ClearDTOG_TX(ENDP1); // Clear DTOG
ClearDTOG_RX(ENDP1); // Clear SW_BUF - Sets buf 0 as software buffer and no buffer for USB peripheral
SetEPTxStatus(ENDP1, EP_TX_NAK);
SetEPRxStatus(ENDP1, EP_RX_DIS);
// Initialize Endpoint 2 double buffered bulk OUT (device rx)
SetEPType(ENDP2, EP_BULK);
SetEPDoubleBuff(ENDP2);
SetEPDblBuffAddr(ENDP2, ENDP2_RXADDR0, ENDP2_RXADDR1);
SetEPDblBuffCount(ENDP2, EP_DBUF_OUT, Device_Property.MaxPacketSize);
ClearDTOG_RX(ENDP2); // Clear DTOG
ClearDTOG_TX(ENDP2); // Clear SW_BUF
ToggleDTOG_TX(ENDP2); // Toggle SW_BUF - Sets buf 1 as software buffer (buf 0 for first rx)
SetEPRxStatus(ENDP2, EP_RX_VALID);
SetEPTxStatus(ENDP2, EP_TX_DIS);
2011-05-17 05:05 AM
Thanks Duncan,
I have already tried the code which u have sent , then the problem which i am facing is...
In the reset i used the code which u have sent, and in my send function after toggling(DTOG_RX) i used the SetEPTxStatus(ENDP3, EP_TX_VALID); to send the data to the host, but even at that time for the first time i am getting junk data.
Thats why i moved the SetEPTxStatus(ENDP3, EP_TX_VALID); to the USB_reset function and trying.
Please send me the code snippet that your are using for sending, i will cross check.
Thanks
Siva