This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

USB Suspend state

Hi All,

I develop the USB CDC firmware(Modify the sample code from ST) using STR912FAW44 and keil MDK.
The Adum 4160 is added to implement the USB isolation. The pull up 1.5K resistor is tied to 3.3V. The firmware works proberly if the USB cable is attached. However, the firmware will hang if the USB cable is detached and power up the device. I use the debug mode and find it always jumps to the suspend state. My schematic for adum4160 is similar to the Figure 7 in the link paper electronix.ru/.../index.php

Can someone have experience with it and how I can get rid of suspend state?

Thank you for your any suggestions.

Best Regards,

Lillian

  • > However, the firmware will hang if the USB cable is detached and power up the device.

    It is an expected response of the USB engine. When the bus is kept in idle for more than 3ms, the engine goes to Suspend. It is defined on the USB spec.

    > Can someone have experience with it and how I can get rid of suspend state?

    a) Ignore Suspend - easy solution, but just workaround.
    As it is a self-powered device, you don't need to power down the entire MCU. Delete the code which makes the MCU power down in Suspend state. While in Suspend, USB communication is not available, naturally.

    OR

    b) Detect VBUS (5V supply on the USB connector) voltage of the host side over an isolator - decent solution. Unfortunately, ADUM4160 lacks this feature. You'll need another isolator for this circuit. This isolated VBUS signaling is connected to a spare port pin of the MCU.
    While VBUS drops, disable the USB engine. When VBUS up, enable the engine.

    Tsuneo

  • Hi Tsuneo,

    Thank you very much for your help. I will try the way you suggest.

    Best Regards,

    Lillian

  • Hi Tsuneo,

    I try the first method you mentioned last post. I comment out the source code when in suspend mode.

    
    void Suspend(void)
    {
     u16 wCNTR;
        fCellSuspended= TRUE;
            /* suspend preparation */
            /* ... */
    #if 0
            /* macrocell enters suspend mode */
        wCNTR = _GetCNTR();
        wCNTR |= CNTR_FSUSP;
        _SetCNTR(wCNTR);
    
    /* ------------------ ONLY WITH BUS-POWERED DEVICES ---------------------- */
            /* power reduction */
            /* ... on connected devices */
    
        /* force low-power mode in the macrocell */
        wCNTR = _GetCNTR();
        wCNTR |= CNTR_LPMODE;
        _SetCNTR(wCNTR);
    
        /* switch-off the clocks */
        /* ... */
    #endif
    
    }
    

    When the USB cable is disconnected to PC. The firmware doesn't hang anymore. However, when I attach the USB cable back, the firmware goes to resume with RESUME_ESOF state, and PC shows "USB Device Not Recognized".

    Could you please help me what else I need to do and fix this issue?

    Thanks

    Lillian

  • Hi Lillian,

    I am also facing same problem while dettaching the USB cable. Are you able to solve this issue?
    If so please explain me about it.

    Thank you,
    P. Nageswara Rao

  • Hi,

    I try the second way which Tsuneo suggests and add the circuit to fix the issue.

    Regards,

    Lillian