Skip to main content
Explorer
April 1, 2025
Question

STM32U575 OTG_FS host suspend and remote wakeup failure

  • April 1, 2025
  • 2 replies
  • 685 views

I am trying to implement an application with USB CDC-ECM host capabilities.

 

As a bring up setup, I configured two STM32 boards:

1) STM32U5G9J-DK2 board, configured as a CDC-ECM device, using USBX.

2) STM32U575I-EV, configured as a CDC-ECM host, using USBX.

 

I am able to connect both boards, and get some basic networking functionality, including ping and  

UDP traffic.

 

Now I am trying to implement host suspend/resume and remote wakeup by device.

When performing suspend and resume by host only (without remote wakeup), everything works fine, and

I can see both suspend and resume signaling on device.

 

However, when using remote wakeup by device, I see the following flow of events:

1) Host sending suspend to device.

2) Device is getting the suspend signaling and enters suspend mode.

3) Device is activating remote wakeup signaling

4) Remote wake signal is detected on host (OTG_GINTSTS_WKUPINT is fired).

5) Host waits ~10 msec and desserts the resume signal (OTG_HPRT_PRES)

6) I see no resume signaling on device side, and no more SOF interrupts on host side.

 

The code I'm using for host suspend Signalling:

 

HAL_StatusTypeDef HOST_Suspend(HCD_HandleTypeDef *hhcd)

{

    USB_OTG_GlobalTypeDef *USBx = hhcd->Instance;

    uint32_t USBx_BASE = (uint32_t)USBx;

    uint32_t hprt = USBx_HPRT0;

    hprt &= ~USB_OTG_HPRT_PENA;

    hprt |= USB_OTG_HPRT_PSUSP;

 

    /* Set Suspend Mode */

    USBx_HPRT0 = hprt;

 

    return HAL_OK;

}

 

The code I'm using for host resume Signalling, after receiving WKUPINT interrupt:

 

void HAL_HCD_ResumeCallback(HCD_HandleTypeDef *hhcd)

{

    USB_OTG_GlobalTypeDef *USBx = hhcd->Instance;

    uint32_t USBx_BASE = (uint32_t)USBx;

    uint32_t hprt;

 

    tx_thread_sleep(1);

 

    hprt = USBx_HPRT0;

 

    hprt &= ~USB_OTG_HPRT_PENA;

    hprt &= ~USB_OTG_HPRT_PRES;

 

    /* Clear Resume bit */

    USBx_HPRT0 = hprt;

}

 

 The code for device remote wakeup signaling:

 

__HAL_PCD_UNGATE_PHYCLOCK((&hpcd_USB_OTG_HS));

USB_ActivateRemoteWakeup( USB_OTG_HS );

tx_thread_sleep(1);

USB_DeActivateRemoteWakeup( USB_OTG_HS );

 

Any idea why my remote wakeup flow is broken?

Thanks in advance.

 

    This topic has been closed for replies.

    2 replies

    ST Employee
    April 3, 2025

    Hi talk

     

    This post has been escalated to the ST Online Support Team for additional assistance.  We'll contact you directly.

     

    Regards

    Joe

    STMicro Support

    Graduate
    July 16, 2025

    Hello @talk,

    Where did you find an example for USB CDC ECM Host?

    G.

    talkAuthor
    Explorer
    July 16, 2025

    Hello @Gwen1 

     

    Most of my code is based on the following link:

     

    https://learn.microsoft.com/en-us/answers/questions/1101457/azure-rtos-cdc-ecm-example

     

    I also used existing ST USB host examples (e.g. CDC_ACM host).

     

    Regards,

    Tal

    Graduate
    July 16, 2025

    Thanks !