cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F756 USB and WFI

peterdonchev
Associate III
Posted on July 27, 2017 at 09:55

I have a problem with STM32F756 USB CDC (HS with FS PHY) device and core sleeping. I isolated all other code and left only the USB driver and main loop calling WFI instruction. If there is no call to WFI, USB is working properly, but if I call WFI in the main loop, USB stops responding. USB clock is not stopped on entering in sleep. Any advise?

#__wfi #stm32f7 #sleep #usb
1 ACCEPTED SOLUTION

Accepted Solutions
STOne-32
ST Employee
Posted on August 01, 2017 at 00:14

Hi , 

Please check my reply 5 year ago ( Dec 2012) on first STM32F2 having similar behavior 

 

If the same, we will ensure that the new code/ example is fixig it in definitive way.

Let us know if it helps.

Cheers 

STOne-32.

View solution in original post

4 REPLIES 4
Adam Pearce
Associate
Posted on July 31, 2017 at 20:24

I am seeing the same thing with STM32F446. __WFI() in my idle task worked fine on my old board that used the OTG_FS IP. But I switched to a new board with the OTG_HS with internal FS phy connected and now USB device won't work if I have the __WFI() in my idle task. Is there an errata for this?

STOne-32
ST Employee
Posted on August 01, 2017 at 00:14

Hi , 

Please check my reply 5 year ago ( Dec 2012) on first STM32F2 having similar behavior 

 

If the same, we will ensure that the new code/ example is fixig it in definitive way.

Let us know if it helps.

Cheers 

STOne-32.

Posted on August 01, 2017 at 14:26

 ,

 ,

to_deletelullaby techie

‌ that worked perfectly.

Here is my new code for sleeping. I could probably just set the registers one and done someplace I suppose.

/* Disable OTGHSULPILPEN and enable OTGHSLPEN per https://community.st.com/0D50X00009XkaYoSAJ

 ,

__HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE(),

 ,

__HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE(),

 ,

/* Prepare to sleep until interrupt */

 ,

SCB->,SCR &,= (uint32_t) (~((uint32_t) (SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk))),

 ,

__WFI(),
Posted on August 01, 2017 at 18:04

Thank you!

Everything works now.