diff --git a/docs/helios64/auto_poweron.md b/docs/helios64/auto_poweron.md new file mode 100644 index 0000000..a92dfaf --- /dev/null +++ b/docs/helios64/auto_poweron.md @@ -0,0 +1,79 @@ +Helios64 automatic power on circuitry when main power applied to the system so user does not need to press power button. +This is useful in case of loss of main power longer than UPS back up time. The system will automatically power on when main power return. + +![!Auto power on State](/helios64/img/auto-poweron/flowchart.png) + +U-Boot will enable Auto Power On and a [systemd-shutdown](https://www.freedesktop.org/software/systemd/man/systemd-shutdown.html) hook script to disable the Auto Power On during graceful shutdown. + + +By default the system need the user to press power button to power up. This behaviour can be changed by manipulating a set of GPIOs. +The circuitry uses [D Flip Flop](https://en.wikipedia.org/wiki/Flip-flop_(electronics)#D_flip-flop) and rely on RTC battery or UPS battery to keep the state. + +![!Auto Power On Schematic](/helios64/img/auto-poweron/schematic_flip_flop.png) + +| State | D | Clock | +|---------|-------|-------------| +| Enable | 1 | Rising edge | +| Disable | 0 | Rising edge | + + +## Auto Power On Control under Linux + +*AUTO_ON_EN_D* pin and *AUTO_ON_EN_CLK* pin is assigned to gpio **153** and gpio **154** respectively. +After exporting and configure the GPIOs as output (refer to [GPIO Control](/helios64/gpio/#gpio-control)), we will do bit-banging to configure the D Flip Flop. + +To enable the Auto Power On + +``` +echo 1 > /sys/class/gpio/gpio153/value +echo 0 > /sys/class/gpio/gpio154/value +sleep 0.1 +echo 1 > /sys/class/gpio/gpio154/value +sleep 0.1 +echo 0 > /sys/class/gpio/gpio154/value +``` + +To disable the Auto Power On + +``` +echo 0 > /sys/class/gpio/gpio153/value +echo 0 > /sys/class/gpio/gpio154/value +sleep 0.1 +echo 1 > /sys/class/gpio/gpio154/value +sleep 0.1 +echo 0 > /sys/class/gpio/gpio154/value +``` + +## Systemd-shutdown Script + +We put a script to disable Auto Power On during shutdown, located on + +`/lib/systemd/system-shutdown/disable_auto_poweron`. + +The script content: + +```bash +#!/bin/bash + +# Export GPIO +# AUTO_ON_D +echo 153 > /sys/class/gpio/export +# AUTO_EN_CLK +echo 154 > /sys/class/gpio/export + +echo out > /sys/class/gpio/gpio153/direction +echo out > /sys/class/gpio/gpio154/direction + +# Toggling the D Flip-Flop +echo 0 > /sys/class/gpio/gpio153/value +echo 0 > /sys/class/gpio/gpio154/value +sleep 0.1 +echo 1 > /sys/class/gpio/gpio154/value +sleep 0.1 +echo 0 > /sys/class/gpio/gpio154/value +``` + +!!! Info + Current implementation does not check whether there is loss of power event. + + diff --git a/docs/helios64/img/auto-poweron/flowchart.png b/docs/helios64/img/auto-poweron/flowchart.png new file mode 100644 index 0000000..ce84be3 Binary files /dev/null and b/docs/helios64/img/auto-poweron/flowchart.png differ diff --git a/docs/helios64/img/auto-poweron/schematic_flip_flop.png b/docs/helios64/img/auto-poweron/schematic_flip_flop.png new file mode 100644 index 0000000..d8b94c3 Binary files /dev/null and b/docs/helios64/img/auto-poweron/schematic_flip_flop.png differ diff --git a/mkdocs.yml b/mkdocs.yml index acadb43..2ff260e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -82,6 +82,7 @@ nav: - First Start : 'helios64/install/first-start.md' - Hardware: - Overview: 'helios64/hardware.md' + - Auto Power On: 'helios64/auto_poweron.md' - Button: 'helios64/button.md' - Ethernet: 'helios64/ethernet.md' - Front Panel: 'helios64/front-panel.md'