Skip to main content
sivakumar4312
Associate II
September 6, 2010
Question

Sending Junk 128 bytes during Double Buffering

  • September 6, 2010
  • 2 replies
  • 631 views
Posted on September 06, 2010 at 13:35

Sending Junk 128 bytes during Double Buffering

    This topic has been closed for replies.

    2 replies

    ashley23
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 14:05

    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);

            

    sivakumar4312
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 14:05

    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