user4192: I have just started playing with a low power arduino project, and have managed to get the power drain down to about 220uA using powerDown from LowPower.
What I would love to be able to do is start the USB controller and send some data every 8 seconds, but I cant seem to send anything...
Any idea would be greatly appreciated :)
Her is my code:
// **** INCLUDES *****
#include <LowPower.h>

#include <avr/interrupt.h>
#include <avr/power.h>
#include <avr/sleep.h>
#include <avr/io.h>

void setup()
{
  DDRD = B00100000;       // PORTD5 = TXLED
  DDRB = B00000001;        // PORTB0 = RXLed


  Serial.begin(9600);
  while (!Serial) ; // Needed for Leonardo only
  Serial.println("Starter...");
  delay(100);
  Serial.end();

  /*
  *  IKKE FJERN DENNE!!! Da greier vi ikke å omprogramere kortet...
  */
  delay(10000);
  Serial.begin(9600);
  while (!Serial) ; // Needed for Leonardo only
  Serial.println("low-power...");
  delay(100);
  Serial.end();
  flash();
}

void loop() 
{
  //LowPower.idle(SLEEP_8S, ADC_OFF, TIMER4_OFF, TIMER3_OFF, TIMER1_OFF, TIMER0_OFF, SPI_OFF, USART1_OFF, TWI_OFF, USB_OFF);//, USB_OFF);
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
  //USBCON &= B11011111; //Disable USB Freeze clock USBCON.FRZCLK
  //USBCON |= B10010001; //SET USB_MACRO_ENABLE_BIT USBCON.USBE

    PLLCSR |= B00000010;   //-Enable             PLL PLLCSR.PLLE = 1; 
    while (!(PLLCSR & 1)); //-Wait PLL LOCK      while (PLLCSR.PLOCK != 1);
    USBCON &= B11011111;   //-Unfreeze USB clock USBCON.FRZCLK = 0; (Clear to unfreeze)
    //-Clear Resume information ???

  flash();


  /*
  * Test USB kommunikasjon :)
  */
  Serial.begin(9600);
  while (!Serial);
  delay(5);
  Serial.println("Hello world!!!");
  delay(5);
  Serial.end();
   PORTD |= B00100000;
   PORTB |= B00000001;
}

void flash() {

   PORTD &= B11011111;
   PORTB &= B11111110;
   delay(100);
   PORTD |= B00100000;
   PORTB |= B00000001;
   delay(100);

   PORTD &= B11011111;
   PORTB &= B11111110;
   delay(100);
   PORTD |= B00100000;
   PORTB |= B00000001;
   delay(100);

   PORTD &= B11011111;
   PORTB &= B11111110;
   delay(100);
   PORTD |= B00100000;
   PORTB |= B00000001;
   delay(100);
}

Best regards, Richard
EDIT
The manual specifies this resume protocol:
Resuming the USB interface (21.13 USB Software Operating Modes)

Enable PLL 
Wait PLL lock
Unfreeze USB clock
Clear Resume Informtion

which I have translated into this:
PLLCSR |= B00000010;   //-Enable             PLL PLLCSR.PLLE = 1; 
while (!(PLLCSR & 1)); //-Wait PLL LOCK      while (PLLCSR.PLOCK != 1);
USBCON &= B11011111;   //-Unfreeze USB clock USBCON.FRZCLK = 0; (Clear to unfreeze)
//-Clear Resume information ???

It have no effect whatsoever, have no idea how to clear resume information though...
Also, for the record, the LEDs are flashing happily every 8 seconds.

user15846: I found an answer to a similar question here:
https://forum.sparkfun.com/viewtopic.php?f=32&t=39214&start=15#p175098
Note: it requires you to close and open the serial monitor at proper timings.
// disable the USB prior going to sleep
USBCON |= _BV(FRZCLK);  //freeze USB clock
PLLCSR &= ~_BV(PLLE);   // turn off USB PLL
USBCON &= ~_BV(USBE);   // disable USB

// and wake it up after
//routine to properly wake up
sleep_disable();
delay(100);
USBDevice.attach(); // keep this
delay(100);
Serial.begin(9600);
delay(100);


4192: <p>I have just started playing with a low power arduino project, and have managed to get the power drain down to about 220uA using <code>powerDown</code> from <code>LowPower</code>.</p>

<p>What I would love to be able to do is start the USB controller and send some data every 8 seconds, but I cant seem to send anything...</p>

<p>Any idea would be greatly appreciated :)</p>

<p>Her is my code:</p>

<pre><code>// **** INCLUDES *****
#include &lt;LowPower.h&gt;

#include &lt;avr/interrupt.h&gt;
#include &lt;avr/power.h&gt;
#include &lt;avr/sleep.h&gt;
#include &lt;avr/io.h&gt;

void setup()
{
  DDRD = B00100000;       // PORTD5 = TXLED
  DDRB = B00000001;        // PORTB0 = RXLed


  Serial.begin(9600);
  while (!Serial) ; // Needed for Leonardo only
  Serial.println("Starter...");
  delay(100);
  Serial.end();

  /*
  *  IKKE FJERN DENNE!!! Da greier vi ikke å omprogramere kortet...
  */
  delay(10000);
  Serial.begin(9600);
  while (!Serial) ; // Needed for Leonardo only
  Serial.println("low-power...");
  delay(100);
  Serial.end();
  flash();
}

void loop() 
{
  //LowPower.idle(SLEEP_8S, ADC_OFF, TIMER4_OFF, TIMER3_OFF, TIMER1_OFF, TIMER0_OFF, SPI_OFF, USART1_OFF, TWI_OFF, USB_OFF);//, USB_OFF);
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
  //USBCON &amp;= B11011111; //Disable USB Freeze clock USBCON.FRZCLK
  //USBCON |= B10010001; //SET USB_MACRO_ENABLE_BIT USBCON.USBE

    PLLCSR |= B00000010;   //-Enable             PLL PLLCSR.PLLE = 1; 
    while (!(PLLCSR &amp; 1)); //-Wait PLL LOCK      while (PLLCSR.PLOCK != 1);
    USBCON &amp;= B11011111;   //-Unfreeze USB clock USBCON.FRZCLK = 0; (Clear to unfreeze)
    //-Clear Resume information ???

  flash();


  /*
  * Test USB kommunikasjon :)
  */
  Serial.begin(9600);
  while (!Serial);
  delay(5);
  Serial.println("Hello world!!!");
  delay(5);
  Serial.end();
   PORTD |= B00100000;
   PORTB |= B00000001;
}

void flash() {

   PORTD &amp;= B11011111;
   PORTB &amp;= B11111110;
   delay(100);
   PORTD |= B00100000;
   PORTB |= B00000001;
   delay(100);

   PORTD &amp;= B11011111;
   PORTB &amp;= B11111110;
   delay(100);
   PORTD |= B00100000;
   PORTB |= B00000001;
   delay(100);

   PORTD &amp;= B11011111;
   PORTB &amp;= B11111110;
   delay(100);
   PORTD |= B00100000;
   PORTB |= B00000001;
   delay(100);
}
</code></pre>

<p>Best regards, Richard</p>

<h1>EDIT</h1>

<p>The manual specifies this resume protocol:
Resuming the USB interface (21.13 USB Software Operating Modes)</p>

<ul>
<li>Enable PLL </li>
<li>Wait PLL lock</li>
<li>Unfreeze USB clock</li>
<li>Clear Resume Informtion</li>
</ul>

<p>which I have translated into this:</p>

<pre><code>PLLCSR |= B00000010;   //-Enable             PLL PLLCSR.PLLE = 1; 
while (!(PLLCSR &amp; 1)); //-Wait PLL LOCK      while (PLLCSR.PLOCK != 1);
USBCON &amp;= B11011111;   //-Unfreeze USB clock USBCON.FRZCLK = 0; (Clear to unfreeze)
//-Clear Resume information ???
</code></pre>

<p>It have no effect whatsoever, have no idea how to <strong>clear resume information</strong> though...</p>

<p>Also, for the record, the LEDs are flashing happily every 8 seconds.</p>
 15846: <p>I found an answer to a similar question here:
<a href="https://forum.sparkfun.com/viewtopic.php?f=32&amp;t=39214&amp;start=15#p175098" rel="nofollow">https://forum.sparkfun.com/viewtopic.php?f=32&amp;t=39214&amp;start=15#p175098</a></p>

<p>Note: it requires you to close and open the serial monitor at proper timings.</p>

<pre class="lang-c prettyprint-override"><code>// disable the USB prior going to sleep
USBCON |= _BV(FRZCLK);  //freeze USB clock
PLLCSR &amp;= ~_BV(PLLE);   // turn off USB PLL
USBCON &amp;= ~_BV(USBE);   // disable USB

// and wake it up after
//routine to properly wake up
sleep_disable();
delay(100);
USBDevice.attach(); // keep this
delay(100);
Serial.begin(9600);
delay(100);
</code></pre>
