This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C5509A DATA TOGGLE USBICNFn / USBOCNFn Problem

Other Parts Discussed in Thread: TMS320VC5507

Hello all,

We are using the TMS320C5509A in a kind of  sensor app with  USB interface. The communication between the sensor and a self developed software works normally fine. But if we exit the programm and start it again we get some trouble. We analysed the problem by using an USB analyser, so we found a data toggle error after the PC-USB driver send a CLEAR_FEATURE - ENDPOINT_HALT request. The host resets the data toggle bit to 0, but the device sends a data1 package, through this we lost the first data package on  the host side.

We use the csl ( older version [maybe 2004] ) :

USB_REQUEST_RET USB_reqClearFeature(USB_REQUEST_ARGS)
{
    USB_EpHandle hEPx=0;
    Uint16 Endpt;
    USB_REQUEST_RET ret_stat = USB_REQUEST_SEND_ACK;
    // decode the requested feature
    switch(USB_Setup->wValue)
    {
        case USB_FEATURE_ENDPOINT_HALT:
        {
            // retrieve the endpoint number
            Endpt = (USB_Setup->wIndex) & 0xFF;
            // retrieve the handle associated with the endpoint
            if (USB_Setup->wIndex==0 || USB_Setup->wIndex==6 || USB_Setup->wIndex==7)
            {
                ret_stat = USB_REQUEST_STALL;
            }
            else
            {
                hEPx = USB_epNumToHandle(USB0, Endpt);
                // un-stall the endpoint
                if (USB_getEndptStall(hEPx))
                {
                    USB_clearEndptStall(hEPx);
                }

            }

            break;
        }

So we had the idea to use the USBICNFn / USBOCNFn register to solve the problem.

( Doku.:  spru596.pdf ) page 91

Bits 5−0 in Non-Isochronous Mode (ISO = 0)      // we use BULK

Bit | Field | Value | Description
5   |           |            |   TOGGLE Endpoint data toggle.
     |           |      0    |   The next data packet is DATA0.
     |           |      1    |   The next data packet is DATA1.

BIT:
7                6             5               4             3                   2 - 0
UBME     ISO    TOGGLE   DBUF      STALL      Reserved†
R/W-x     R/W-x     R/W-x     R/W-x       R/W-x         R/W−x

So we use: *(Uint16 *) hEPx-> EDReg_SAddr  = 0xA0; for reset the Toggle Bit after the last " if ".

////   hEPx-> EDReg_SAddr = 0x6750 ( seen in debug)  ////

If we test the code, we see no effect !  Why not ??? What are we doing wrong???

In debug-mode we see what the address is 0x6750; it must be EP 2 IN base-address right ???

( Doku.:  spru596.pdf ) page 76

Base address + 0F50h   Endpoint IN2 definition register block

Is 0x6750 the USBICNF2 Register address ????


Could anyone give me an advice?

Thank you!

Sebastian


  • I´m sorry thats not : *(Uint16 *) hEPx-> EDReg_SAddr  = 0xA0;

    it was only an other test!

    i mean: *(Uint16 *) hEPx-> EDReg_SAddr  &=  ~0x20;

    sorry!!!

  • Yes. 0x6750 is Input Endpoint 2 Descriptor Register Block.

    The Toggle bit is to synchronize between the transmitter and receiver and the first packet is a DATA0 packet. So resetting to 0 after a restart seems correct.

    Can you PC-USB driver wait for the receiver acknowledge before sending the CLEAR_FEATURE?

    Regards.

  • Thx Steve for your fast answer!

    Yes I know about the function of the toggle bit! Maybe my description was bad! If I exit the software on pc and restart it, I need min. 3 sec.  If I read the stream by the usb-analyser i see  the traffic like:

    EP 2 OUT -> .....

    EP 2 IN -> ....  ack   // Data Toggle is at the last traffic 0

    EP 0 Clear Feature ....  ack 02 for EP2 OUT

    EP 0 Clear Feature ....  ack 82 for EP2 IN // (I know that every EP have a Data-Toggle for out and  in and that the host now will be wait for Data0 on all EP´s )

    //  I restart software, now.

    EP 2 OUT -> ......

    EP 2 OUT -> .....  // also send it 2 times but no error!

    EP 2 IN ->    .....  // (301 Byte datapackage size) the first 64Byte  data toggle error  and toggle begin with 1 ! so the software make an error

    I want set register if the isr has detect and interrupt  and "clear_feature", than i set the register to toggle data0 by reg &= ~0x20.

    mabey i make some mistake???

    In doku is written ( s. 76 ) that i can use USM instead of CNF-Reg., but i don´t know the way to set toggle bit there! any idea what it means?

    ps. i´m not at work so i have other acc.

    Regards

    Sebastian

  • Sebastian,

    Do you have the capability to confirm Toggle bit is 0 right after restart software?

    EP 2 end OUT 2 times without a device ACK. Can you do a step by step betweeen PC host and device?

    Which document you are referring to for using USM instead of CNF-Reg?

    Sorry I have more questions; am trying to understand.

    Regards.

  • Dear Steve,

    The EP2 OUT send 2 times ack, maybe the usb driver need it ?! I think that's not the problem.

    A step by step mode betweeen PC host and device is not direct possible,only via USB-Analyser i see the traffic.

    The document to which I refer is:  TMS320VC5507/5509 DSP Universal Serial Bus (USB) Module Reference Guide (Rev. A)

    Literature Number: SPRU596A
                                        June 2004

    On page 91:    Endpoint data toggle. This bit reflects the data toggle sequence (see
                              section 1.2 on page 17). Note: You do not need to write to this bit; it
                              is maintained by the UBM.

    Do you have the capability to confirm Toggle bit is 0 right after restart software?

    -> maybe i can send a dummy on EP2 to synchronize the data toggle, but it´s like cheating^^

    If i work in debug mode and write to the register 0x6750 i see that it works fine, but also it seems so that it has no effect!

    I´m right, when I think a 0x00 on register 0x6750 should have the effect that EP 2IN is non-active and data toggle is 0 ?

    -> If yeah, it must be a problem by write the register or there is another function (in csl) that store the data toggle and resets the endpoint by send data!?

    I hope you have now the information you need!

    By the way, here an outtake from the data traffic!


    Regards

    Sebastian




  • The problem still exists. I need TI help plz.

    If you need more information tell me, but this is really important!

  • I have found the mistake on Endpoint DMA register block.

    Form CSL (file : csl55xx.src)

     Last Modified: 6th May 2002
     Modified by  : Ruchika
     Modification : The TOGGLE bit in the EDB Configuration register is cleared to
                              indicate the next buffer to be the X buffer
                              The USBALT register set to indicate that DMA points to the DATA0
                              buffer.