Open joshgoebel opened 9 years ago
Perhaps we can create a development branch and include this for some testing. What do you think?
My core lib repository already has code for most of this.
Can you link to the relevant code? Thanks.
Actually all the work I've done so far is in the main repository now.
So far, this issue itself is still open though. USB sucks power from the battery constantly, and that's what this issue was meant to address.
For anyone else who wants to tackle this is what needs to happens:
Then test to see if this actually works and lets you reflash the device. Or we could just turn off USB by default when on battery power and to reflash you have to plug your Arduboy in then turn it on.
The power savings he reports for turning off USB are almost 50% (for the CPU):
delay(8000); // 11.35mA
power_usb_disable();
delay(8000); //9.97mA
USBCON |= (1 << FRZCLK); // Freeze the USB Clock
PLLCSR &= ~(1 << PLLE); // Disable the USB Clock (PPL)
USBCON &= ~(1 << USBE ); // Disable the USB
delay(8000); // 5.3mA
Ref: http://harizanov.com/2013/02/power-saving-techniques-on-the-atmega32u4/
Not only do you power USB down you also have to freeze the clock.