Setting the Link Power State

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

   

I'm a little bit new to link states in USB, so please forgive my ignorance on this topic.  I'd like to set the link state to U2.  I have the following code:

   
 if (glForceLinkU2)         {             stat = CyU3PUsbGetLinkPowerState (&curState);             while ((glForceLinkU2) && (stat == CY_U3P_SUCCESS) && (curState == CyU3PUsbLPM_U0))             {                 /* Repeatedly try to go into U2 state.*/                 CyU3PUsbSetLinkPowerState (CyU3PUsbLPM_U2);                 CyU3PThreadSleep (5);                 stat = CyU3PUsbGetLinkPowerState (&curState);             }             CyU3PGpioSetValue(LED0,LED_ON);         }
   

...which is essentially the same code given in the bulkauto DMA example, except that I've added code to turn on a debug LED once the loop has finished.  Unfortunately, the loop never finishes because the link power state is never U2/is always U0.  My assumption is that I'm not doing something on the host side to allow this transition, i.e. I can't just ask the device to change to U2 if the host doesn't change something as well.  Am I correct in this assumption?  What do I have to do on both sides of the interface to get this to work?

   

Thanks!

3 Replies