(05-05-2016, 06:59 AM)caseih Wrote: 1. detect in software if running on battery so I can halt the system
2. completely power down the pine from software
3. turn on when power returns
I realize I could theoretically install a big battery, but I actually want the ability to shut it down by pulling the power for a long period of time (say 20 to 30 seconds).
Sure. There's the PMU, you can use the arisc mailbox interface to talk to it (might require that you write the appropriate driver before). Then you can read out all the values/states you're interested in. Rule of thumb: the older the SoC the better software support. See here for 4 year old combination of A20/AXP209. So maybe come back next year or in 2018.
Powering down by software is simply shutting down the OS when reaching critical battery voltage (you're most probably not able to readout now unless you write the driver). And powering up is done when re-insert 5V through Euler pins 4 and 6.
HTH!