LPC11U35 wake up from power-down on USB activity

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC11U35 wake up from power-down on USB activity

1,144 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by giedrius on Thu Oct 24 03:09:08 MST 2013
Hi,

First I would like to ask for more details (comments, links, examples, references, your experience) regarding the topic in general, that is waking up from power saving mode (e.g. power down) on USB activity.

And now to get to the point:
I am developing power sensitive device (meaning it will run on batteries). This device has USB CDC interface for configuration and communication. Most of the time it will spend in power down mode and wait for interrupts such as GPIO or watchdog interrupts, then wake up, do some processing and then go to power down again. But it also needs to wake up when it is connected to the USB port.
Users manual mentions USBWakeup_IRQ interrupt which triggers on USB activity, however I was not able to trigger it (it actually triggers once, just after I call NVIC_EnableIRQ(USBWakeup_IRQn), but never again). So I was wondering what is included in the definition of USB activity? Can (and should) this interrupt trigger when I physically attach my device to the USB port? Or is it only triggered by the USB messages? I am assuming it should trigger on physical activity rather than messages, because during the power down mode the USB peripheral is off. So all in all what are the proper steps (and registers) that should be taken to go from active to power-down mode and then resuming from power-down to active mode after the device is attached to the USB port.

Thank you for any input or advice,
Giedrius
Labels (1)
0 Kudos
1 Reply

889 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Tsuneo on Thu Oct 24 22:44:28 MST 2013
USBWakeup_IRQ supposes to respond to Suspend/Resume bus event.
You'll find the supposed way to apply this IRQ in this chapter of the User Manual
http://www.nxp.com/download/pip/LPC1347FBD64/user_manual

Quote:

11.7.6.1 Waking up from Deep-sleep and Power-down modes on USB activity

To allow the LPC11Uxx to wake up from Deep-sleep or Power-down mode on USB
activity, complete the following steps:
1. Set bit AP_CLK in the USBCLKCTRL register (Table 40) to 0 (default) to enable
automatic control of the USB need_clock signal.

2. Wait until USB activity is suspended by polling the DSUS bit in the DSVCMD_STAT
register (DSUS = 1).

3. The USB need_clock signal will be deasserted after another 2 ms. Poll the
USBCLKST register until the USB need_clock status bit is 0 (Table 41).

4. Once the USBCLKST register returns 0, enable the USB activity wake-up interrupt in
the NVIC (# 30) and clear it.

5. Set bit 1 in the USBCLKCTRL register to 1 to trigger the USB activity wake-up
interrupt on the rising edge of the USB need_clock signal.

6. Enable the wake-up from Deep-sleep or Power-down modes on this interrupt by
enabling the USB need_clock signal in the STARTERP1 register (Table 43, bit 19).

7. Enter Deep-sleep or Power-down modes by writing to the PCON register.

8. Execute a WFI instruction.



I believe you may also apply this interrupt to detect USB connection in sleeping device. But, as above procedure shows, the USB peripheral should be powered while in sleep. Even though the USB PLL stops in low-power, the USB peripheral may consume extra current.

Instead, I recommend you PIO0_3 pin interrupt to wake up the device by USB plug-in.
Usually, PIO0_3/VBUS pin connects to the VBUS(5V) pin of the USB connector for self-powered USB devices. While in sleep of USB plug-off, the USB peripheral is in power down, and PIO0_3 is configured as an GPIO-input. When PIO0_3 pin interrupt occurs at USB plug-in, the device wakes up, it configures PIO0_3 to VBUS, and it powers the USB peripheral.
In this way, you may reduce sleeping current in minimum.

Tsuneo
0 Kudos