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.

OTG Driver w/ TPS65950 state machine

Other Parts Discussed in Thread: TPS65950, DM3730

We have a DM3730 platform that uses USB OTG via the TPS65950, using the TI Windows CE 6.0R3 BSP posted in May 2011.

We are getting random behavior when trying to go into OFF mode (SYS_OFF_MODE bit toggles). Sometimes, the system doesn't go into a full OFF mode. Other times, we go into off mode, and on resume, sometimes the device or host (depending on whether an A-device or B-device is connected) reconnects properly, other times it doesn't.

I've found at least one rather substantial mistake in the code, which makes me question to what extent this code was used or tested in suspend/resume.

Specifically, in the file otg.cpp, there is the following code segment in the function OMAPMHSUSBOTG::SetPowerState():

 if(m_disconnected)

    {
      if(a_device_present)
      {
          ...
      }
      else if(b_device_present)
      {
          ...
      }
      else
      {
          StopUSBClock();
          ...
      }

      StopUSBClock();
      ...

    }  

Based on the contents of the then and else parts, this should read "if connected" ... not "if disconnected". That is the source of the problem we are having, in that when we reconnect, the flag m_disconnected is sometimes set right, sometimes not ... and only when it is set wrong do we detect the device. Changing this to "if (connected)" however, breaks other things.

My two questions:

1) Does anyone have a diagram of the state machine or flow-chart used for reference, when this code was written?  The code doesn't match any of the flow charts or state machines in the DM3730 documents that I have looked at.

2) Has anyone else encountered problems with OTG during suspend/resume, that can point me to the fixes, or to an updated OTG driver that does suspend/resume correctly.

While the EVM's OTG suspends and resumes correctly, it does not use the PMIC. Simply changing SupportsTransceiverWakeWithoutClock() in tps659xx_musb.hpp to return FALSE instead of TRUE, to use the same code that EVM uses within otg.cpp, changes the problem (i.e. connection/disconnection behavior is different), but it still fails, just in different ways.

Any pointers or help would be greatly appreciated.

Thanks,

Dave