PiPower protocol
PiPower protocol
The premise is that in general the PiPower will turn the raspberry pi ON in certain conditions, and that the Raspberry Pi will tell the PiPower to turn it off when it's ready for that.
Besides that, there is the "watchdog" mode, where after a period of inactivity from the 'Pi the PiPower will powercycle the Raspberry Pi.
registers
watchdog functions
The watchdog registers are saved to eeprom, so they will function again after a powerloss.
- watchdog.
A write to this register resets the watchdog.
- Watchdog interval.
After this time without any writes to the watchdog the PiPower will initiate the watchdog cycle. You should attempt to write at least twice this rate to the watchdog register. As Linux is not real-time, you should take some margin and not set this value too short. Disable the watchdog function by writing this
- Watchdog leniency. // Find a better word.
This is the time after power on due to the watchdog that the watchdog function will not yet function. This allows the raspberry pi to boot.
- Watchdog offtime
When the watchdog activates, this is the time that the raspberry pi is turned off. We recommend setting this at 1 second. If you make it too short the power-on-reset might not activate, requiring multiple watchdog cycles before your 'pi will boot again.
turning the 'pi off
- timed_turn_off
Set this register to the time until a poweroff is required. Write zero for an immediate turn-off.
- More?
turning the 'pi on
- timed turn on
Turn on an output after a specified time delay. This can be used to turn the 'pi back on after a specified time, as you can issue a turn-off command after this one. Write zero for an immediate turn-on.
- Input configuration.
Writing a 1 bit will turn on the pi for that event. An event is defined as a change of the input values. The input values after the change form a binary word. The binary word indexes into this byte. So the lowest order bit specifies what to do when the inputs change to 00: a 0 means: do nothing, a 1 means: turn on the 'pi. The 'pi should determine how/when to turn itself off again.
event log
- event log.
A read of this register will return events from the event log. The first byte indicates the event type. A timestamp follows.
- Events to be logged.
each bit specifies one type of events that can be logged. 1 means: Add to log. 0 means do not add to log. events that can be logged are:
- pi turn on
- pi turn off
- input changed
- watchdog triggered
- more?
inputs
- input
a read of this register reads the inputs. This can be used to poll the inputs while the 'pi is on.