PiPower protocol

From BitWizard Wiki
Revision as of 11:54, 17 July 2012 by Rew (talk | contribs) (Created page with "= 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 i...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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.