cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U575 OTG_FS host suspend and remote wakeup failure

talk
Associate II

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.

 

6 REPLIES 6
Joe WILLIAMS
ST Employee

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

Gwen1
Associate III

Hello @talk,

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

G.

talk
Associate II

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

Gwen1
Associate III

Thanks !

Gwen1
Associate III

Hi @talk ,

I can't find ST USB host examples (CDC_ACM host) for my STMH563ZI. Do you think the example of another STM is compatible?
Regards,

G

 

talk
Associate II

There is an example for STM32H573I-DK : Ux_Host_CDC_ACM

(I am using STM32CUBEIDE version 1.17.0 right now).

 

Regards,

Tal