Difference between revisions of "Npi-config"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[npi-config/zh|查看中文]]
 
[[npi-config/zh|查看中文]]
  
===Work with npi-config Utility===
+
==Introduction==
The npi-config is a system configuration utility for setting passwords, language, timezone, hostname, SSH and auto-login, and enabling/disabling i2c, spi, serial and PWM and I2S. You can start this utility by running the following command:
+
* npi-config is a commandline utility. It can be used to set system configurations such as: password, language, timezone, Hostname, SSH enable/disable, auto-login, hardware(Serial/I2C/SPI/PWM/I2S) enable/disable and etc. You can start it by running the following command as root:
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang="html4strict">
$ sudo npi-config
+
$ npi-config
 
</syntaxhighlight>
 
</syntaxhighlight>
Here is the npi-config's main window:<br />
+
* Here is what npi-config looks like:<br />
 
[[File:npi-config.jpg|frameless|500px|npi-config]]<br />
 
[[File:npi-config.jpg|frameless|500px|npi-config]]<br />
 +
* npi-config currently only works under Ubuntu distros such as FriendlyCore, Ubuntu-oled, Ubuntu-tft and doesn't work under Debian.
 +
* If you don't see the functions described here in your npi-configure's menu you can try updating it by clicking on the "Update" option on the menu.
 +
<syntaxhighlight lang="html4strict">
 +
$ npi-config
 +
7 Update|              Update this tool to the latest version
 +
</syntaxhighlight>
 +
 +
 +
==Boot Options==
 +
===B1 Autologin: System Login Options===
 +
There are three login options:<br>
 +
*<1> Console: you are required to type username and password to login;
 +
*<2> Console Autologin: you will automatically login as "pi";
 +
*<3> Qt/Embedded: you don't login but will see a Qt Demo GUI;
 +
===B2 Wait for Network at Boot: Wait Time for Connecting to Ethernet===
 +
In general this is set to "No" since you can login without connecting to Ethernet.
 +
===B3 Boot device: Select Boot Device===
 +
====Set Mini Shield for NanoPi NEO Core/Core2 to Boot from SSD====
 +
<syntaxhighlight lang="html4strict">
 +
$ npi-config
 +
</syntaxhighlight>
 +
[[File:Boot Options.jpg|frameless|600px|Boot Options]]<br />
 +
After you enter the Boot Options menu and select "Boot device" you will see two options:<br />
 +
1) D1 Hard drive<br />
 +
2) D2 TF card<br />
 +
[[File:Choose_Boot device.jpg|frameless|600px|Choose Boot device]]<br />
 +
Select "D1 Hard drive" and follow the prompts to proceed.<br />
 +
If you want to boot your board from a TF card select "D2 TF card".<br /><br />
 +
 +
==Advanced Options==
 +
===A0 Display: Select Display Device===
 +
This only applies to Allwinner SoC based platforms.<br>
 +
By default Linux only outputs to one display device. You can set your board's display device by running the following command:
 +
<syntaxhighlight lang="html4strict">
 +
$ npi-config
 +
6 Advanced Options|    Configure advanced setting
 +
A0 Display|        Select system default display device
 +
fb0| framebuffer0
 +
                        fb1| fb_st7789v(X)
 +
</syntaxhighlight>
 +
(X) indicates the checked device is enabled. The "fb" device is different in different systems. As for H3/H5 based boards fb0 is HDMI and fb1 is FriendlyElec's Matrix - 2'8 SPI Key TFT. After you make your change reboot your board to make it effective.
 +
 +
===A1 Audio: Select Audio Device===
 +
This only applies to Allwinner SoC based platforms.<br>
 +
By default Linux only outputs to one audio device. You can set your audio device by running the following command:
 +
<syntaxhighlight lang="html4strict">
 +
$ npi-config
 +
6 Advanced Options|    Configure advanced setting
 +
A1 Audio|          Select system default audio device
 +
card0| [Dummy], device 0: Dummy PCM                               
 +
                        card1| [Loopback], device 0: Loopback PCM                         
 +
                        card2| [H3 Audio Codec], device 0: CDC PCM Codec-0 (X)           
 +
                        card3| [allwinner,hdmi], device 0: 1c22800.i2s-i2s-hifi i2s-hifi-0
 +
</syntaxhighlight>
 +
(X) indicates the checked device is enabled. The "card" device is different in different systems. After you make your change reboot your board to make it effective.
 +
 +
===A2 Welcome message: Enable/Disable Welcome GUI===
 +
===A3 Serial: Enable/Disable Serial Output===
 +
This only applies to Allwinner SoC based platforms with Linux-4.14 kernel.<br>
 +
[[File:npi-config-serial.png|frameless|1000px|npi-config-serial]]<br>
 +
 +
===A4 I2C: Enable/Disable I2C===
 +
This only applies to Allwinner SoC based platforms with Linux-4.14 kernel.<br>
 +
[[File:npi-config-i2c.png|frameless|1000px|npi-config-i2c]]<br>
 +
 +
===A5 SPI: Enable/Disable SPI===
 +
This only applies to Allwinner SoC based platforms with Linux-4.14 kernel.<br>
 +
The supported SPI devices include FriendlyElec's 2.8" TFT LCD and SPI Flash.<br>
 +
[[File:npi-config-spi.png|frameless|1000px|npi-config-spi]]<br>
 +
 +
====Enable Matrix - 2'8 SPI Key TFT====
 +
The Matrix - 2'8 SPI Key TFT is a 2.8" TFT LCD module developed by FriendlyElec. For more details refer to :[[Matrix - 2'8 SPI TFT]]. You can run the following command to enable it.
 +
<syntaxhighlight lang="html4strict">
 +
$ npi-config
 +
6 Advanced Options|    Configure advanced settings
 +
A5 SPI|            Enable/Disable SPI
 +
spi0 Enable/Disable spi0[enabled]
 +
spidev0.0|  SPI0 char device
 +
spi-2.8'tft| Matrix-2'8_SPI_Key_TFT(X)
 +
spi-flash|  SPI0 flash
 +
</syntaxhighlight>
 +
(X) indicates the Matrix - 2'8 SPI Key TFT connected to SPI0 is enabled. After you make your change reboot your board and you will see a calibration GUI.
 +
 +
====Enable Mini Shield for NanoPi NEO Core/Core2's SPI Flash====
 +
<syntaxhighlight lang="html4strict">
 +
$ npi-config
 +
6 Advanced Options|    Configure advanced setting
 +
A5 SPI|            Enable/Disable SPI
 +
spi0 Enable/Disable spi0[enabled]
 +
spidev0.0|  SPI0 char device
 +
spi-2.8'tft| Matrix-2'8_SPI_Key_TFT
 +
spi-flash|  SPI0 flash(X)
 +
</syntaxhighlight>
 +
On NEO Core/Core2 an SPI flash is connected to its Mini Shield and is recognized as SPI0. (X) indicates an SPI flash is enabled. After you make your change reboot your board to make it effective.
 +
 +
===A6 PWM: Enable/Disable PWM===
 +
This only applies to Allwinner SoC based platforms with Linux-4.14 kernel.<br>
 +
[[File:npi-config-pwm.png|frameless|1000px|npi-config-pwm]]<br>
 +
 +
===A7 I2S: Enable/Disable I2S===
 +
This only applies to Allwinner SoC based platforms with Linux-4.14 kernel.<br>
 +
[[File:npi-config-i2s.png|frameless|1000px|npi-config-i2s]]<br>
 +
 +
====Enable NanoHat PCM5102A====
 +
[[File:npi-config-pcm5102a.png|frameless|1000px|npi-config-pcm5102a]]<br>
 +
 +
===A8 IR: Enable/Disable IR===
 +
This only applies to Allwinner SoC based platforms with Linux-4.14 kernel.<br>
 +
[[File:npi-config-ir.png|frameless|1000px|npi-config-ir]]<br>
 +
{{Linux-IR-Receiver}}

Latest revision as of 03:24, 15 January 2019

查看中文

1 Introduction

  • npi-config is a commandline utility. It can be used to set system configurations such as: password, language, timezone, Hostname, SSH enable/disable, auto-login, hardware(Serial/I2C/SPI/PWM/I2S) enable/disable and etc. You can start it by running the following command as root:
$ npi-config
  • Here is what npi-config looks like:

npi-config

  • npi-config currently only works under Ubuntu distros such as FriendlyCore, Ubuntu-oled, Ubuntu-tft and doesn't work under Debian.
  • If you don't see the functions described here in your npi-configure's menu you can try updating it by clicking on the "Update" option on the menu.
$ npi-config
	7 Update|               Update this tool to the latest version


2 Boot Options

2.1 B1 Autologin: System Login Options

There are three login options:

  • <1> Console: you are required to type username and password to login;
  • <2> Console Autologin: you will automatically login as "pi";
  • <3> Qt/Embedded: you don't login but will see a Qt Demo GUI;

2.2 B2 Wait for Network at Boot: Wait Time for Connecting to Ethernet

In general this is set to "No" since you can login without connecting to Ethernet.

2.3 B3 Boot device: Select Boot Device

2.3.1 Set Mini Shield for NanoPi NEO Core/Core2 to Boot from SSD

$ npi-config

Boot Options
After you enter the Boot Options menu and select "Boot device" you will see two options:
1) D1 Hard drive
2) D2 TF card
Choose Boot device
Select "D1 Hard drive" and follow the prompts to proceed.
If you want to boot your board from a TF card select "D2 TF card".

3 Advanced Options

3.1 A0 Display: Select Display Device

This only applies to Allwinner SoC based platforms.
By default Linux only outputs to one display device. You can set your board's display device by running the following command:

$ npi-config
	6 Advanced Options|     Configure advanced setting
		A0 Display|         Select system default display device
			fb0| framebuffer0
                        fb1| fb_st7789v(X)

(X) indicates the checked device is enabled. The "fb" device is different in different systems. As for H3/H5 based boards fb0 is HDMI and fb1 is FriendlyElec's Matrix - 2'8 SPI Key TFT. After you make your change reboot your board to make it effective.

3.2 A1 Audio: Select Audio Device

This only applies to Allwinner SoC based platforms.
By default Linux only outputs to one audio device. You can set your audio device by running the following command:

$ npi-config
	6 Advanced Options|     Configure advanced setting
		A1 Audio|           Select system default audio device
			card0| [Dummy], device 0: Dummy PCM                                
                        card1| [Loopback], device 0: Loopback PCM                          
                        card2| [H3 Audio Codec], device 0: CDC PCM Codec-0 (X)             
                        card3| [allwinner,hdmi], device 0: 1c22800.i2s-i2s-hifi i2s-hifi-0

(X) indicates the checked device is enabled. The "card" device is different in different systems. After you make your change reboot your board to make it effective.

3.3 A2 Welcome message: Enable/Disable Welcome GUI

3.4 A3 Serial: Enable/Disable Serial Output

This only applies to Allwinner SoC based platforms with Linux-4.14 kernel.
npi-config-serial

3.5 A4 I2C: Enable/Disable I2C

This only applies to Allwinner SoC based platforms with Linux-4.14 kernel.
npi-config-i2c

3.6 A5 SPI: Enable/Disable SPI

This only applies to Allwinner SoC based platforms with Linux-4.14 kernel.
The supported SPI devices include FriendlyElec's 2.8" TFT LCD and SPI Flash.
npi-config-spi

3.6.1 Enable Matrix - 2'8 SPI Key TFT

The Matrix - 2'8 SPI Key TFT is a 2.8" TFT LCD module developed by FriendlyElec. For more details refer to :Matrix - 2'8 SPI TFT. You can run the following command to enable it.

$ npi-config
	6 Advanced Options|     Configure advanced settings
		A5 SPI|             Enable/Disable SPI
			spi0 Enable/Disable spi0[enabled]
				spidev0.0|   SPI0 char device
				spi-2.8'tft| Matrix-2'8_SPI_Key_TFT(X)				
				spi-flash|   SPI0 flash

(X) indicates the Matrix - 2'8 SPI Key TFT connected to SPI0 is enabled. After you make your change reboot your board and you will see a calibration GUI.

3.6.2 Enable Mini Shield for NanoPi NEO Core/Core2's SPI Flash

$ npi-config
	6 Advanced Options|     Configure advanced setting
		A5 SPI|             Enable/Disable SPI
			spi0 Enable/Disable spi0[enabled]
				spidev0.0|   SPI0 char device
				spi-2.8'tft| Matrix-2'8_SPI_Key_TFT
				spi-flash|   SPI0 flash(X)

On NEO Core/Core2 an SPI flash is connected to its Mini Shield and is recognized as SPI0. (X) indicates an SPI flash is enabled. After you make your change reboot your board to make it effective.

3.7 A6 PWM: Enable/Disable PWM

This only applies to Allwinner SoC based platforms with Linux-4.14 kernel.
npi-config-pwm

3.8 A7 I2S: Enable/Disable I2S

This only applies to Allwinner SoC based platforms with Linux-4.14 kernel.
npi-config-i2s

3.8.1 Enable NanoHat PCM5102A

npi-config-pcm5102a

3.9 A8 IR: Enable/Disable IR

This only applies to Allwinner SoC based platforms with Linux-4.14 kernel.
npi-config-ir
Note: Please Check your board if IR receiver exist.
By default the infrared function is disabled you can enable it by using the npi-config utility:

$ npi-config
    6 Advanced Options     Configure advanced settings
        A8 IR              Enable/Disable IR
            ir Enable/Disable ir[enabled]

Reboot your system and test its infrared function by running the following commands:

$ apt-get install ir-keytable
$ echo "+rc-5 +nec +rc-6 +jvc +sony +rc-5-sz +sanyo +sharp +mce_kbd +xmp" > /sys/class/rc/rc0/protocols   # Enable infrared
$ ir-keytable -t
Testing events. Please, press CTRL-C to abort.

"ir-keytable -t" is used to check whether the receiver receives infrared signals. You can use a remote control to send infrared signals to the receiver. If it works you will see similar messages as follows:

1522404275.767215: event type EV_MSC(0x04): scancode = 0xe0e43
1522404275.767215: event type EV_SYN(0x00).
1522404278.911267: event type EV_MSC(0x04): scancode = 0xe0e42
1522404278.911267: event type EV_SYN(0x00).