Fixes and typo

This commit is contained in:
Gauthier Provost 2020-10-29 19:05:19 +08:00
parent 4b9470436b
commit 3c2fa311eb
10 changed files with 81 additions and 85 deletions

View File

@ -1,15 +1,15 @@
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.
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 returns.
![!Auto power on State](/helios64/img/auto-poweron/flowchart.png)
![!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.
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.
By default the system needs the user to press power button to power up. This behavior 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 relies on RTC battery or UPS battery to keep the state.
![!Auto Power On Schematic](/helios64/img/auto-poweron/schematic_flip_flop.png)
![!Auto Power-On Schematic](/helios64/img/auto-poweron/schematic_flip_flop.png)
| State | D | Clock |
|---------|-------|-------------|
@ -17,12 +17,12 @@ The circuitry uses [D Flip Flop](https://en.wikipedia.org/wiki/Flip-flop_(electr
| Disable | 0 | Rising edge |
## Auto Power On Control under Linux
## Auto Power-On Control
*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
To enable the Auto Power-On
```
echo 1 > /sys/class/gpio/gpio153/value
@ -33,7 +33,7 @@ sleep 0.1
echo 0 > /sys/class/gpio/gpio154/value
```
To disable the Auto Power On
To disable the Auto Power-On
```
echo 0 > /sys/class/gpio/gpio153/value
@ -46,9 +46,9 @@ echo 0 > /sys/class/gpio/gpio154/value
## Systemd-shutdown Script
We put a script to disable Auto Power On during shutdown, located on
We put a script to disable Auto Power-On during shutdown, located on :
`/lib/systemd/system-shutdown/disable_auto_poweron`.
`/lib/systemd/system-shutdown/disable_auto_poweron`
The script content:
@ -75,5 +75,3 @@ echo 0 > /sys/class/gpio/gpio154/value
!!! Info
Current implementation does not check whether there is loss of power event.

View File

@ -84,12 +84,16 @@ Therefore the mapping between header P5 Pins and Sysfs GPIO numbers will be as d
echo N | sudo tee -a /sys/class/gpio/export
```
( *N* is the GPIO number you want to export )
**2.** Set the direction, "out" for Output or "in" for Input
```
echo DIRECTION | sudo tee -a /sys/class/gpio/gpioN/direction
```
(*DIRECTION* value is "out" or "in")
**3.** Now you can read or change the GPIO value
To read GPIO value
@ -106,5 +110,3 @@ echo VALUE | sudo tee -a /sys/class/gpio/gpioN/value
!!! notes
Pay attention to the path, /sys/class/gpio/gpio**N**/ where **N** is the GPIO number.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 116 KiB

View File

@ -51,14 +51,14 @@ Connector Pinout
![!Type-C Fan](/helios64/img/pwm/fan_stock_photo.jpg)
Fan Specification
### Fan Specifications
| Parameter | Value | Unit | Remarks |
|---------------|----------|------|---------|
| Maximum Speed | 3600 | RPM | @ duty cycle 98% |
| Minimum Speed | 350 | RPM | @ duty cycle 10% |
| Shut off | Yes | | duty cycle < 6.5% and restart @ duty cycle > 9.5% |
| Implementation Type | C | | |
| Implementation | Type-C | | |
![!Type-C Speed Graph](/helios64/img/pwm/fan_speed_graph_stock_fan.png)
@ -79,18 +79,17 @@ Helios64 has a **Digital Temperature Sensor with 2wire Interface** ([NCT75 Da
## PWM Fan Control under Linux
Linux use 8-bit integer to represent duty cycle. PWM value 0 represent 0% duty cycle and PWM value 255 represent 100% duty cycle.
Linux uses 8-bit integer to represent duty cycle. PWM value 0 represent 0% duty cycle and PWM value 255 represent 100% duty cycle.
![Duty Cycle Formula](/helios64/img/pwm/fan_duty_cycle_formula.png)
Below graphs are stock fan speed vs pwm value instead of duty cycle.
Below graphs is stock fan speed vs pwm value instead of duty cycle.
![!Stock Fan Speed Graph](/helios64/img/pwm/fan_speed_graph_stock_fan_linux.png)
### Using SYSFS interface
Linux export the fan control mechanism to SYSFS under hwmon class.
List of devices can be checked under /sys/class/hwmon
Linux exports the fan control mechanism to SYSFS under hwmon class. List of devices can be checked under _/sys/class/hwmon*
```
ls -l /sys/class/hwmon/
@ -105,7 +104,7 @@ lrwxrwxrwx 1 root root 0 Oct 16 09:29 hwmon6 -> ../../devices/platform/ff3d0000.
```
!!! info
The numbering may different from above example output. It depends on whether the driver built as kernel module or built-in, device initialization order. Take this as consideration when using [fancontrol](#fancontrol-automated-software-based-fan-speed-control)
The numbering may differ from above example output. It depends on whether the driver built as kernel module or built-in and device initialization order. Take this as consideration when using [fancontrol](#fancontrol-automated-software-based-fan-speed-control)
To identify which hwmon belong to fan, look for *p6-fan* and *p7-fan*. On above example
@ -126,19 +125,21 @@ echo NEW_PWM_VALUE > /sys/class/hwmon4/pwm1
echo NEW_PWM_VALUE > /sys/class/hwmon5/pwm1
```
### Fancontrol - automated software based fan speed control
( *NEW_PWM_VALUE* takes value between 0 and 255 )
fancontrol is a shell script for use with lm_sensors. It reads its configuration from a file, then calculates fan speeds from temperatures and sets the corresponding PWM outputs to the computed values.
### Fancontrol Utility
**fancontrol** software provides automated fan speed control. It is a shell script for use with lm_sensors. It reads its configuration from a file, then calculates fan speeds from temperatures and sets the corresponding PWM outputs to the computed values.
```
sudo apt-get install fancontrol
```
fancontrol includes *pwmconfig* script to create automatically a configuration file but it can not be used for Helios64.
fancontrol includes *pwmconfig* script to create automatically a configuration file but it cannot be used for Helios64.
#### UDEV rules
Since hwmon order can be changed between kernel version or even between reboot, on Armbian we use udev rules as workaround. The rules can be found from [here](https://raw.githubusercontent.com/armbian/build/master/packages/bsp/helios64/90-helios64-hwmon.rules) (mainline) or [here](https://raw.githubusercontent.com/armbian/build/master/packages/bsp/helios64/90-helios64-hwmon-legacy.rules) (legacy kernel 4.4) and to be copied to **/etc/udev/rules.d/**
Since hwmon order can change between kernel version or even between reboot, on Armbian we use udev rules as workaround. The rules can be found [here](https://raw.githubusercontent.com/armbian/build/master/packages/bsp/helios64/90-helios64-hwmon.rules) (mainline) or [here](https://raw.githubusercontent.com/armbian/build/master/packages/bsp/helios64/90-helios64-hwmon-legacy.rules) (legacy kernel 4.4) and need to be copied to **/etc/udev/rules.d/**
*/dev/fan-p6, /dev/fan-p7, /dev/thermal-cpu* and */dev/thermal-board* are symlinks generated by the udev rules.
@ -202,5 +203,3 @@ The PWM value to use when the temperature is below MINTEMP. Typically, this will
!!! note
The Helios64 fancontrol configuration file can be found [here](https://github.com/armbian/build/blob/master/packages/bsp/helios64/fancontrol.conf).

View File

@ -10,11 +10,12 @@ The SoC receive clock signal from the PMIC RTC and in the meantime access the PM
To save time information and allow the RTC to keep running while system is powered off, the PMIC RTC relies on a dedicated coin battery located at BAT1. The battery holder (BAT1) accepts CR1225 battery model.
![RTC Battery](/helios64/img/rtc/rtc_battery.jpg)
!!! Note
The polarity of the battery holder is indicated on the PCB with **'+'** signs.
![RTC Battery](/helios64/img/rtc/rtc_battery.jpg)
However if your setup has the [UPS](/helios64/ups/) battery connected, then RTC battery is not required since the RTC clock can also be kept powered by the UPS battery.
## Scheduled Power On using RTC
@ -28,20 +29,21 @@ Run following command to check whether there is any alarm set,
cat /sys/class/rtc/rtc0/wakealarm
```
If nothing return, it means no alarm set.
To reset/disable the alarm, run
To reset/disable the alarm, run:
```bash
echo 0 | sudo tee /sys/class/rtc/rtc0/wakealarm
```
The alarm only accept Unix epoch time. We can use *[date](https://linux.die.net/man/1/date)* utility as helper to get epoch time of our calendar.
The alarm only accepts Unix epoch time. We can use *[date](https://linux.die.net/man/1/date)* utility as helper to get epoch time of our calendar.
To set alarm from absolute calendar time, run
To set alarm from absolute calendar time, run:
```bash
echo `date '+%s' -d '20 December 2020 02:14:10 PM'` | sudo tee /sys/class/rtc/rtc0/wakealarm
```
You can also set alarm from relative time using this command,
You can also set alarm from relative time using this command:
```bash
echo `date '+%s' -d '+ 1 hour 2 minutes 10 seconds'` | sudo tee /sys/class/rtc/rtc0/wakealarm
@ -51,25 +53,25 @@ After alarm set, you can power off the system and keep the power plugged in. Hel
### Use rtcwake
Run following command to check whether there is any alarm set,
Run following command to check whether there is any alarm set:
```bash
sudo rtcwake -m show
```
To reset/disable the alarm, run
To reset/disable the alarm, run:
```bash
sudo rtcwake -m disable
```
To set alarm from absolute calendar time, run
To set alarm from absolute calendar time, run:
```bash
sudo rtcwake -m off --date '2020-12-20 14:14:10'
```
You can also set alarm from relative time using this command,
You can also set alarm from relative time using this command:
```bash
sudo rtcwake -m off --date '+ 1 hour 2 minutes 10 seconds'
@ -82,4 +84,3 @@ After the command successfully executed, system will shutdown. Keep the power pl
[date- Linux manual page](https://linux.die.net/man/1/date)
[rtcwake - Linux manual page](https://linux.die.net/man/8/rtcwake)

View File

@ -37,7 +37,8 @@ The power delivery of the HDDs is devided into two group:
Helios64 implements a power staggering approach where *HDD Rail A* will be powered up first, then few seconds later *HDD Rail B* will be powered up. This power control scenario is performed to reduce the inrush current during disk spin-up.
The power staggering mechanism is not user configurable. It is done by bootloader.
!!! note
The power staggering mechanism is not user configurable. It is done by the bootloader.
### J8 Pinout

View File

@ -48,7 +48,7 @@ Battery charge is fully managed by hardware ([Texas Instrument BQ24133](https://
## UPS Status Under Linux
In Linux, the UPS declared as gpio-charger located at
In Linux, the UPS is declared as gpio-charger located at
`/sys/class/power_supply/gpio-charger`
@ -79,7 +79,7 @@ It will return **Charging** or **Not Charging**
!!! Info
The status is only **valid** when main power is available.
*Fault / Battery Absent* status is unavailable but it can be concluded if the status keep changing.
### Battery Level
@ -90,7 +90,7 @@ Battery voltage can be measured on internal ADC channel 2. The internal ADC is l
![!Battery level](/helios64/img/ups/battery_level_schematic.png)
Following table show scalling between ADC reading and actual battery voltage
Following table shows scaling between ADC reading and actual battery voltage
| Battery Voltage (V) | ADC reading (mV) | Remarks |
|---------------------|------------------|---------|
@ -98,7 +98,7 @@ Following table show scalling between ADC reading and actual battery voltage
| 7.0 | 916 | Recommended threshold to force shutdown system |
| 8.4 | 1099 | Fully Charge |
[IIO subsystem](https://www.kernel.org/doc/html/latest/driver-api/iio/index.html) provide hardware raw value. To convert the raw value to standard units, use following formula
[IIO subsystem](https://www.kernel.org/doc/html/latest/driver-api/iio/index.html) provides hardware raw value. To convert the raw value to standard units, use following formula
`adc = in_voltage2_raw * in_voltage_scale`
@ -107,4 +107,3 @@ To get the actual ADC reading in shell run following command
```bash
echo "`cat /sys/bus/iio/devices/iio:device0/in_voltage2_raw` * `cat /sys/bus/iio/devices/iio:device0/in_voltage_scale`" | bc
```

View File

@ -115,43 +115,39 @@ Helios64 can be used as Direct Attached Storage (DAS) with the required software
### USB Host Port
USB Host support in U-Boot is quite minimal, it only support USB storage.
USB Host support in U-Boot is quite minimal, it only supports USB storage.
### USB OTG Port (USB Type-C)
USB Type C port is configured as USB device mode as USB Mass Storage connected to eMMC.
This function can be activated by pressing [Recovery Button](/helios64/button/#recovery-button).
This is to serve as a way to (re)install OS to eMMC.
USB Type C port is configured as USB Mass Storage connected to eMMC. This function, called UMS mode, can be activated by pressing [Recovery Button](/helios64/button/#ums-mode). This is to serve as a way to (re)install OS to eMMC.
## USB under Linux
!!! Info
Currently only applicable under Linux Kernel 4.4.
Mainline kernel support is still under development.
Currently only applicable to Linux Kernel 4.4. Mainline kernel support is still under development.
### Helios64 as Direct Attached Storage (DAS) device
Helios64 can be used as Direct Attached Storage (DAS) device with help of Linux USB Gadget kernel module.
The kernel moodule only export the underlying block device NOT the filesystem layer. Therefore if the block device is formatted with filesystem unique to Linux,
the exported disk may not readable by computer that has Helios64 connected to.
The kernel module only exports the underlying block device NOT the filesystem layer. Therefore if the block device is formatted with filesystem unique to Linux, the exported disk may not be readable by the computer connected to Helios64 connected.
For example, the block device is formatted with EXT4 filesystem and Helios64 connected to Windows PC as DAS,
the Windows PC will not be able to read the disk content unless 3rd party software/driver installed.
For example, if the block device is formatted with EXT4 filesystem and Helios64 connected to Windows PC as DAS, the Windows PC will not be able to read the disk content unless 3rd party software/driver installed.
!!! warning
Do NOT access Helios64 simultanouesly as DAS and NAS, as the filesystem is not managed by system and can lead to data corruption.
Do NOT export block device(s) that you are also accessing via network (unless in read-only mode), as the filesystem of the exported block device cannot be managed concurrently and can lead to data corruption. Refer to kernel Mass Storage Gadget (MSG) [page](https://www.kernel.org/doc/html/latest/usb/mass-storage.html) to understand better the limitation.
#### Individual Disk Exported as Separate Disk
#### Export Individual Disk
To export all SATA disks that has been identified as /dev/sda ... /dev/sde, run the following command on Helios64.
To export all SATA disks that have been identified as /dev/sda ... /dev/sde, run the following command on Helios64:
```
sudo modprobe g_mass_storage file=/dev/sda,/dev/sdb,/dev/sdc,/dev/sdd,/dev/sde iSerialNumber=1234567890 iManufacturer="Kobol Innovations" iProduct=Helios64
```
The following screenshot, Helios64 connected with 5x 120GB SATA drive.
The following screenshots show Helios64 connected with 5x 120GB SATA disks.
***Helios64 connected to PC running Windows***
@ -181,8 +177,8 @@ Device Descriptor:
bDescriptorType 1
bcdUSB 3.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 9
idVendor 0x0525 Netchip Technology, Inc.
idProduct 0xa4a5 Pocketbook Pro 903
@ -203,7 +199,7 @@ OTG Descriptor:
wTotalLength 47
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
@ -277,16 +273,16 @@ lsblk output:
```
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdc 8:32 0 111,8G 0 disk
└─sdc1 8:33 0 111,8G 0 part
sdd 8:48 0 111,8G 0 disk
└─sdd1 8:49 0 111,8G 0 part
sde 8:64 0 111,8G 0 disk
└─sde1 8:65 0 111,8G 0 part
sdf 8:80 0 111,8G 0 disk
└─sdf1 8:81 0 111,8G 0 part
sdg 8:96 0 111,8G 0 disk
└─sdg1 8:97 0 111,8G 0 part
sdc 8:32 0 111,8G 0 disk
└─sdc1 8:33 0 111,8G 0 part
sdd 8:48 0 111,8G 0 disk
└─sdd1 8:49 0 111,8G 0 part
sde 8:64 0 111,8G 0 disk
└─sde1 8:65 0 111,8G 0 part
sdf 8:80 0 111,8G 0 disk
└─sdf1 8:81 0 111,8G 0 part
sdg 8:96 0 111,8G 0 disk
└─sdg1 8:97 0 111,8G 0 part
$ lsblk -S
NAME HCTL TYPE VENDOR MODEL REV TRAN
@ -299,15 +295,15 @@ sdf 2:0:0:3 disk Linux File-Stor Gadget 0404 usb
sdg 2:0:0:4 disk Linux File-Stor Gadget 0404 usb
```
#### RAID device exported as One Disk
#### Export RAID Array
Assuming the RAID already created and identified as /dev/md/md-raid6, run the following command on Helios64 to export the RAID block device as USB Mass Storage
Assuming the RAID array is already created and identified as /dev/md0, run the following command on Helios64 to export the RAID block device as USB Mass Storage
```
sudo modprobe g_mass_storage file=/dev/md/md-raid6 iManufacturer="Kobol Innovations" iProduct="Helios64" iSerialNumber="1234567890"
sudo modprobe g_mass_storage file=/dev/md0 iManufacturer="Kobol Innovations" iProduct="Helios64" iSerialNumber="1234567890"
```
The following screenshot, Helios64 connected with 5x 120GB SATA drive and configured as RAID 6 so total space of the block device is ~360GB (3x 120GB). The block device then formatted with NTFS.
The following screenshots show Helios64 connected with 5x 120GB SATA disks and configured as RAID 6 so total space of the block device is ~360GB (3x 120GB). The block device is then formatted with NTFS.
***Helios64 connected to PC running Windows***
@ -338,8 +334,8 @@ Device Descriptor:
bDescriptorType 1
bcdUSB 3.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 9
idVendor 0x0525 Netchip Technology, Inc.
idProduct 0xa4a5 Pocketbook Pro 903
@ -360,7 +356,7 @@ OTG Descriptor:
wTotalLength 47
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
@ -433,8 +429,8 @@ lsblk output
```
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdc 8:32 0 335,2G 0 disk
└─sdc1 8:33 0 335,2G 0 part
sdc 8:32 0 335,2G 0 disk
└─sdc1 8:33 0 335,2G 0 part
$ lsblk -S
NAME HCTL TYPE VENDOR MODEL REV TRAN
@ -442,4 +438,3 @@ sda 0:0:0:0 disk ATA WDC WDS240G2G0B 0000 sata
sdb 1:0:0:0 disk ATA TOSHIBA MQ04 0J sata
sdc 2:0:0:0 disk Linux File-Stor Gadget 0404 usb
```

View File

@ -13,6 +13,7 @@ Beside consolidating technical data, the purpose of this Wiki is also to provide
| Date | Description |
|------|-------------|
| 29/10/2020 | Helios64 pages update:<br>[PWM Fan](/helios64/pwm/)<br>[Auto Power-On](/helios64/auto_poweron/)<br>[UPS Battery](/helios64/ups)<br>[RTC Clock](/helios64/rtc)<br>[GPIO Header](/helios64/gpio)<br>[USB OTG](/helios64/usb/#usb-otg-port-usb-type-c)|
| 27/10/2020 | [Helios64 Maskrom mode](/helios64/maskrom/) |
| 14/10/2020 | [Helios64 eMMC install](/helios64/install/emmc/) |
| 27/08/2020 | [Helios64 Setup Instructions](/helios64/install/preliminary/) |

View File

@ -93,9 +93,9 @@ nav:
- Jumper: 'helios64/jumper.md'
- LED: 'helios64/led.md'
- M.2: 'helios64/m2.md'
- Power:
- Auto Power On: 'helios64/auto_poweron.md'
- Power Management:
- PMIC: 'helios64/pmic.md'
- Auto Power-On: 'helios64/auto_poweron.md'
- UPS Battery: 'helios64/ups.md'
- PWM Fan: 'helios64/pwm.md'
- RTC: 'helios64/rtc.md'