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.

Wince OTG IsADeviceConnected

Other Parts Discussed in Thread: TPS65930

Hi all~

We are using wince BSP 6.14.01.01.

And I found the functions "IsADeviceConnected " and "IsBDeviceConnected" in "tps659xx_musb.cpp" is not working right.

when I have the ID pad of TPS65930 conneted to GND, in this case, the OTG should work as HOST, but the driver keep calling the "IsADeviceConnected " function, this is one of the problem, and the other is the  "IsADeviceConnected " function:

it checks if a A device is connected by reading the TWL_STS_HW_CONDITIONS(0x004B0045) register. if TWL_STS_VBUS bit is set, then it tells a "A" device is connected. the thing is when OTG act as HOST, it must have driver the bus to 5V, so TWL_STS_VBUS should be set too( I am not sure), am I right?

  • Hi,

    If I remember correctly to use OTG PHY from TPS659XX some HW modes have to be done on the board. Also as I know TI never tested OTG functionality with that PHY. Only the ISP1504 has been tested.

    Have you modify your board to use TPS659XX? If you didn't modify and are using ISP1504 you shoud compile in ISP1504 support, but not TPS659XX.  You may check you have BSP_OMAP_MUSBOTG_ISP1504=1 instead of BSP_OMAP_MUSBOTG_TPS659XX=1.

    Regards,

    Vitaly

     

     

     

     

     

  • we do have modify the board, actually it is our custom board.

    what do you mean by "some HW modes have to be done on the board", can you tell me in detail?

    I feel that I am not sure the behavior of HS USB OTG controller in 3530 and the USB PHY in 65930, the registers "FUNC_CTRL","OTG_CTRL", etc can be set/clr through I2C bus, but I also found they changed "automatically", dose setting some registers in 3530 will have these register changed too? through ULPI? If so, which registers are of this kind,  please kindly tell me, cause I can not find it in 65930's TRM.

  • Hi,

    i was successfully modified tps659xx_musb.cpp for my 65950. i add next:

    void HSUSBOTGTransceiverTps659xx::Configure()
    {
      ....
      WriteOmapTriton2(TWL_OTG_CTRL_SET, TWL_OTG_CTRL_IDPULLUP);
      ....
    }


    DWORD
    HSUSBOTGTransceiverTps659xx::StateChangeThread(
    void* pvData
    )
    {
    HSUSBOTGTransceiverTps659xx* me =(HSUSBOTGTransceiverTps659xx*)pvData;
    DWORD dwTimeout = INFINITE;
    static BOOL bFirstPass = TRUE;
    BOOL CurrentIdGround;
    BYTE bRegister = 0;

    DEBUGMSG(ZONE_OTG_FUNCTION, (TEXT("USB OTG StateChangeThread enter\r\n")));


    for (;;)
    {
    DWORD rc = WaitForSingleObject(me->m_hUsbPresenceEvent, dwTimeout);
    if (rc == WAIT_FAILED)
    {
    break;
    }

    DEBUGMSG(ZONE_OTG_FUNCTION, (L"m_hUsbPresenceEvent event!!!\r\n"));

    if (bFirstPass)
    {
    OTGUSBClock(TRUE);
    me->SetVBusSource(TRUE);
    me->Configure();
    bFirstPass = FALSE;
    OTGUSBClock(FALSE);
    }

    if (me->m_bConnectStatus)
    {
    // OTG status is connected, no need to poll for ID ground
    DEBUGMSG(ZONE_OTG_FUNCTION, (L"USB OTG ID ground polling disabled\r\n"));
    dwTimeout = INFINITE;
    continue;
    }
    else
    {
    // OTG status is disconnected, poll for ID ground
    DEBUGMSG(ZONE_OTG_FUNCTION, (L"USB OTG ID ground polling enabled\r\n"));
    dwTimeout = 1000;
    }

    OTGUSBClock(TRUE);

    // Note: The OMAP35xx musb block seems to clear the ID pullup enable bit in the TWL4030,
    // so here we re-enable it.

    // enable ID pullup and IDGND detection, enable D+/D- pull downs
    me->WriteOmapTriton2(TWL_OTG_CTRL_SET, TWL_OTG_CTRL_IDPULLUP);

    // wait for debounce time
    Sleep(60);

    //pSelf->DumpULPIRegs();

    // check for ID pin grounded
    me->ReadOmapTriton2(TWL_ID_STATUS, &bRegister);
    CurrentIdGround = bRegister & 0x1 ? TRUE : FALSE;

    OTGUSBClock(FALSE);

    if (CurrentIdGround)
    {
    // signal usb presence interrupt
    //
    DEBUGMSG(ZONE_OTG_FUNCTION, (L"########### USB OTG Presence interrupt ############\r\n"));
    SetEvent(me->m_hAconnEvent);
    }

    }

    DEBUGMSG(ZONE_OTG_FUNCTION, (L"USB OTG StateChangeThread exiting\r\n"));



    return 1;
    }

  • Thanks,

    I found that every time wake up from sleep, the OTG_CTRL register will be 0x07, this value should be for HOST configuration, why is that?

    and if 3530 acting as "B Device" conected to PC, the driver can not detect the disconnection.

  • Hi Jack,

    When I was talking about HW mods I meant mods on TI EVM where the TPS PHY has to be physicaly connected to the CPU.

    -Vitaly

     

  • I do an experiment today:

    If  the ID pad of 65930 connect to ground permanently, the STS_VBUS bit of STS_HW_CONDITIONS register is right, it is set to "1" when 5.0V is present on VBUS. but the STS_USB is always set to "1".

    If the ID pad is floating,  the STS_VBUS bit of STS_HW_CONDITIONS register is right too, but the STS_USB is always set to "0".

    It seems that STS_USB bit have some relationship with the ID pad, but the 65930 TRM doesn't say that. Can the TI engineers kindly confirm this? If so, what is the threshold for these bits to toggle?

    If the ID pad is not connected to the USB connector, it is connect to ground or just left floating, then the STS_USB bit will always be "1" or "0". so "IsADeviceConnected" or "IsBDeviceConnected" should work if the ID pad is connected to the USB connector.