2011-12-21 09:12 AM
When I try to enter in suspend mode, as soon as I set it, always receive a wake up interrupt request, and can't do it. I'm not sure if I do the correct process, just set FSUSP and then LP_MODE bit, in USB_CNTR register.
Is there any consideration to take into account? I'm looking for an USB example to enter suspend mode or forum discussions, but can't find any solved... Thank you in advance.2011-12-21 09:36 PM
Following is an example:
----------------------------/*******************************************************************************
* Function Name : Suspend * Description : sets suspend mode operating conditions * Input : None. * Output : None. * Return : USB_SUCCESS. *******************************************************************************/ void Suspend(void) {/* suspend preparation */
/* ... */ #ifndef STM32F10X_CL uint16_t wCNTR;/* macrocell enters suspend mode */
wCNTR = _GetCNTR(); wCNTR |= CNTR_FSUSP; _SetCNTR(wCNTR); #endif /* STM32F10X_CL */ /* ------------------ ONLY WITH BUS-POWERED DEVICES ---------------------- */ /* power reduction */ /* ... on connected devices */#ifndef STM32F10X_CL
/* force low-power mode in the macrocell */ wCNTR = _GetCNTR(); wCNTR |= CNTR_LPMODE; _SetCNTR(wCNTR); #endif /* STM32F10X_CL *//* switch-off the clocks */
/* ... */ Enter_LowPowerMode(); } //------------------------------------------------------- /******************************************************************************* * Function Name : Enter_LowPowerMode * Description : Power-off system clocks and power while entering suspend mode * Input : None. * Return : None. *******************************************************************************/ void Enter_LowPowerMode(void) { /* Set the device state to suspend */ bDeviceState = SUSPENDED; } //---------------------------------------------------------------2011-12-21 09:41 PM
also if you want to leave low power mode you can use the followinf example.:
------------------------------------------------------/*******************************************************************************
* Function Name : Leave_LowPowerMode * Description : Restores system clocks and power while exiting suspend mode * Input : None. * Return : None. *******************************************************************************/ void Leave_LowPowerMode(void) { DEVICE_INFO *pInfo = &Device_Info;/* Set the device state to the correct state */
if (pInfo->Current_Configuration != 0) { /* Device configured */ bDeviceState = CONFIGURED; } else { bDeviceState = ATTACHED; }}
2011-12-21 09:47 PM
for details you can refer to
Mass storage demo: Bulk transfer
in um0424 @2011-12-22 12:41 AM
Thank you for your response Pila. That's what I'm trying to do, but the Host (PC), as soon as suspend mode is set, a wake up interrupt is received in device.
2011-12-22 02:26 AM
do you have any USB trace to cite your problem???
2012-01-02 03:39 AM
Thank you for your response, I was out of the office. What do you mean with USB trace? An image of all sent and recieved frames?
I use USB analyzer to see all data transit. I can't see anything strange, but if you think, it will be useful for you, I can try to get a capture.2012-01-03 12:05 AM
Yes it will be more clear from a trace (CATC / Lecroy or any other USB analyser).
2012-10-19 01:58 PM
Ruben,
I know it has been a while, but did you resolve this issue? How? We are experiencing a similar issue. Thanks, Dan Ash Synaptics Inc.2012-10-19 10:03 PM
I have an impression that you are forcing entire device in suspend just by the device side reason. It isn't right way for the USB engine. The USB device engine accepts Suspend setting, just when the bus goes to idle by the host more than 3ms. While the host puts SOF signaling at every 1ms, the device immediately get resumed, even if the firmware would set Suspend bit of the engine. You can make the USB engine Suspend, just when bus suspend (idle) is reported by the engine.
You may keep core and other peripherals in suspend, even while the USB engine does not suspend. When the USB engine requires firmware intervention, it raises USB interrupt. You may keep the core in suspend until this event occurs. Tsuneo