Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Difference between revisions of "Zero/Ubuntu"

(Common Hardware Interfaces, I2C, PWM, SPI, UART, etc)
 
(15 intermediate revisions by 3 users not shown)
Line 11: Line 11:
 
=== Introduction to Radxa Zero Ubuntu ===
 
=== Introduction to Radxa Zero Ubuntu ===
  
Radxa Zero Ubuntu is an easy to use system. While working with Radxa Zero Debian, you will find it do well on playing music, Internet, Bluetooth and so on.
+
Radxa Zero Ubuntu is an easy to use system. Our Ubuntu image contains no desktop environment, makes it suitable to hosting simple home services such as PiHole, WireGuard, and SMB file share.
  
 
Radxa Zero Ubuntu uses '''systemd''' to manage system.
 
Radxa Zero Ubuntu uses '''systemd''' to manage system.
Line 19: Line 19:
 
=== Access from the Host PC/Laptop ===
 
=== Access from the Host PC/Laptop ===
  
==== Option 1: Serial console ====
+
==== Option 1: USB access(adb) ====
 +
By default, the Radxa Zero Linux image enables adbd services, which is a debug bridge from Android now ported on Linux. With one USB A to C cable you can power and access the board, very handy.
  
Check [[zero/dev/serial-console | Serial Console]]
+
To use adb, you need to install adb tool on the PC/Laptop. Check instructions for [[Rock/windows_adb | Windows]] and [[Rock/linux_adb | Linux]].
  
==== Option 2: SSH ====
+
See [[zero/dev/adb | Using ADB]].
 +
 
 +
==== Option 2: Serial console ====
 +
See [[zero/dev/serial-console | Serial Console]]
 +
 
 +
==== Option 3: SSH ====
 
SSH server  is enabled on port 22 of Radxa Zero image.  
 
SSH server  is enabled on port 22 of Radxa Zero image.  
  
Line 32: Line 38:
  
 
=== Ubuntu Default User Account ===
 
=== Ubuntu Default User Account ===
 +
 +
System image name starting with radxa:
  
 
Non-root User:
 
Non-root User:
Line 38: Line 46:
 
   Password  : rock
 
   Password  : rock
  
=== Install and update necessary packages ===
+
System image name starting with Armbian:
 +
 
 +
  User Name : root
 +
  Password  : 1234
 +
 
 +
=== Server ===
 +
 
 +
Our Ubuntu image contains no desktop environment, suitable for hosting services and running headlessly.
 +
 
 +
=== Install and update necessary packages ===
  
 
Add Radxa APT, see [[zero/radxa-apt | Radxa APT]].
 
Add Radxa APT, see [[zero/radxa-apt | Radxa APT]].
Line 76: Line 93:
 
'''Warning: Remember there is only one line including item "overlays=" in file /boot/uEnv.txt.'''
 
'''Warning: Remember there is only one line including item "overlays=" in file /boot/uEnv.txt.'''
  
Make sure that kernel is newer than 5.10.69-2-amlogic. If not, then try
+
Make sure that kernel is at least version 5.10.69-4-amlogic. If not, then try
  
 
   $ sudo apt update
 
   $ sudo apt update
   $ sudo apt install -y linux-headers-5.10.69-3-amlogic-gacf75c74f9
+
   $ sudo apt install -y linux-headers-5.10.69-4-amlogic-g37ae4051315a
   $ sudo apt install -y linux-image-5.10.69-3-amlogic-gacf75c74f9
+
   $ sudo apt install -y linux-image-5.10.69-4-amlogic-g37ae4051315a
  
 
==== I2C ====
 
==== I2C ====
Line 100: Line 117:
 
   overlays=meson-g12a-i2c-ao-m0-gpioao-2-gpioao-3
 
   overlays=meson-g12a-i2c-ao-m0-gpioao-2-gpioao-3
  
Please note that you cannot add overlays meson-g12a-i2c-ee-m1-gpioh-6-gpioh-7 and meson-g12a-i2c-ee-m1-gpiox-10-gpiox-11 at the same time.
+
Please note that do not add overlays meson-g12a-i2c-ee-m1-gpioh-6-gpioh-7 and meson-g12a-i2c-ee-m1-gpiox-10-gpiox-11 at the same time.
  
 
==== PWM ====
 
==== PWM ====
 +
 +
===== PWM_C channel =====
  
 
To enable PWM_C, add item "eson-g12a-pwm-c-on-gpiox-8" to the "overlays=" line.
 
To enable PWM_C, add item "eson-g12a-pwm-c-on-gpiox-8" to the "overlays=" line.
  
   overlays=eson-g12a-pwm-c-on-gpiox-8
+
   overlays=meson-g12a-pwm-c-on-gpiox-8
 +
 
 +
You would see directory /sys/devices/platform/soc/ffd00000.bus/ffd1a000.pwm is generated.
 +
 
 +
Then you can set up PWM-C channel with directory /sys/devices/platform/soc/ffd00000.bus/ffd1a000.pwm/pwm/pwmchipY.
 +
 
 +
===== PWMAO_A channel =====
  
 
To enable PWMAO_A, add item "meson-g12a-pwmao-a-on-gpioao-11" to the "overlays=" line.
 
To enable PWMAO_A, add item "meson-g12a-pwmao-a-on-gpioao-11" to the "overlays=" line.
  
 
   overlays=meson-g12a-pwmao-a-on-gpioao-11
 
   overlays=meson-g12a-pwmao-a-on-gpioao-11
 +
 +
You would see directory /sys/devices/platform/soc/ff800000.bus/ff807000.pwm is generated.
 +
 +
Then you can set up PWMAO_A channel with directory /sys/devices/platform/soc/ff800000.bus/ff807000.pwm/pwm/pwmchipY.
  
 
==== SPI ====
 
==== SPI ====
  
To enable SPI1, add item "meson-g12a-spi-spidev" to the "overlays=" line.
+
To enable SPI_A (/dev/spidev0.0), add item "meson-g12a-spi-spidev" to the "overlays=" line.
  
 
   overlays=meson-g12a-spi-spidev
 
   overlays=meson-g12a-spi-spidev
 
   param_spidev_spi_bus=0
 
   param_spidev_spi_bus=0
   param_spidev_spi_cs=0
+
   param_spidev_max_freq=10000000
 +
 
 +
To enable SPI_B (/dev/spidev1.0), add item "meson-g12a-spi-spidev" to the "overlays=" line.
 +
 
 +
  overlays=meson-g12a-spi-spidev
 +
  param_spidev_spi_bus=1
 
   param_spidev_max_freq=10000000
 
   param_spidev_max_freq=10000000
  
 
==== UART ====
 
==== UART ====
  
To set UART_EE_C as common serial communication devices, add these items "meson-g12a-uart-ee-c" to the "overlays=" line. The device /dev/ttyAML4 is available.
+
One uart port cannot be used as common serial communication and serial console at the same time.
 +
 
 +
===== Common serial communication =====
 +
 
 +
To set UART_AO_A as common serial communication devices, add this item "meson-g12a-uart-ao-a-on-gpioao-0-gpioao-1" to the "overlays=" line. The device /dev/ttyAML0 is available.
 +
 
 +
  overlays=meson-g12a-uart-ao-a-on-gpioao-0-gpioao-1
 +
 
 +
To set UART_AO_B as common serial communication devices, add this item "meson-g12a-uart-ao-b-on-gpioao-2-gpioao-3" to the "overlays=" line. The device /dev/ttyAML1 is available.
 +
 
 +
  overlays=meson-g12a-uart-ao-b-on-gpioao-2-gpioao-3
 +
 
 +
To set UART_AO_B as common serial communication devices, add this item "meson-g12a-uart-ao-b-on-gpioao-8-gpioao-9" to the "overlays=" line. The device /dev/ttyAML1 is available.
 +
 
 +
  overlays=meson-g12a-uart-ao-b-on-gpioao-8-gpioao-9
 +
 
 +
To set UART_EE_C as common serial communication devices, add this item "meson-g12a-uart-ee-c" to the "overlays=" line. The device /dev/ttyAML4 is available.
  
 
   overlays=meson-g12a-uart-ee-c
 
   overlays=meson-g12a-uart-ee-c
 +
 +
Please note that do not add overlays meson-g12a-uart-ao-b-on-gpioao-2-gpioao-3 and meson-g12a-uart-ao-b-on-gpioao-8-gpioao-9 at the same time.
 +
 +
===== Serial console =====
 +
 +
To set UART_AO_A as serial console, add the following two lines to /boot/uEnv.txt
 +
 +
  console=ttyAML0,115200
 +
  overlays=meson-g12a-uart-ao-a-on-gpioao-0-gpioao-1
 +
 +
=== USB Audio ===
 +
 +
See [[zero/hardware/audio | Audio]].
 +
 +
=== USB Camera ===
 +
 +
See [[zero/hardware/camera/ | Camera module]].
  
 
=== Changelogs ===
 
=== Changelogs ===

Latest revision as of 08:01, 2 December 2021

    Radxa Zero >  Ubuntu

Work with Radxa Zero Ubuntu

Introduction to Radxa Zero Ubuntu

Radxa Zero Ubuntu is an easy to use system. Our Ubuntu image contains no desktop environment, makes it suitable to hosting simple home services such as PiHole, WireGuard, and SMB file share.

Radxa Zero Ubuntu uses systemd to manage system.

Command prepended by $ means the command may be executed by an unprivileged user. And command prepended by # means the command may be executed by an privileged user. But the symbol, $ or #, is not part of the command.

Access from the Host PC/Laptop

Option 1: USB access(adb)

By default, the Radxa Zero Linux image enables adbd services, which is a debug bridge from Android now ported on Linux. With one USB A to C cable you can power and access the board, very handy.

To use adb, you need to install adb tool on the PC/Laptop. Check instructions for Windows and Linux.

See Using ADB.

Option 2: Serial console

See Serial Console

Option 3: SSH

SSH server is enabled on port 22 of Radxa Zero image.

Please use angryip to find your board IP address.

 $ ping ip-of-device
 $ ssh rock@ip-of-device

Ubuntu Default User Account

System image name starting with radxa:

Non-root User:

 User Name : rock
 Password  : rock

System image name starting with Armbian:

 User Name : root
 Password  : 1234

Server

Our Ubuntu image contains no desktop environment, suitable for hosting services and running headlessly.

Install and update necessary packages

Add Radxa APT, see Radxa APT.

Install packages;

 $ sudo apt-get update

Network Connection

There is one method for network connection, WIFI.

WIFI Connection

Radxa Zero supports 2.4G/5G WIFI wireless network.

To test the WIFI performance, we need to follow the steps:
  • Switch to super user mode
 $ sudo su
  • Open the WIFI
 $ nmcli r wifi on
  • Scan WIFI
 $ nmcli dev wifi
  • Connect to WIFI network
 $ nmcli dev wifi connect "wifi_name" password "wifi_password"
  • Test WIFI perpormance by tool iperf.

Common Hardware Interfaces, I2C, PWM, SPI, UART, etc

The Radxa Zero system images use configuration file /boot/uEnv.txt.

Warning: Remember there is only one line including item "overlays=" in file /boot/uEnv.txt.

Make sure that kernel is at least version 5.10.69-4-amlogic. If not, then try

 $ sudo apt update
 $ sudo apt install -y linux-headers-5.10.69-4-amlogic-g37ae4051315a
 $ sudo apt install -y linux-image-5.10.69-4-amlogic-g37ae4051315a

I2C

To enable I2C_EE_M1 on GPIOH_6 and GPIOH_7 (/dev/i2c-1), add item "meson-g12a-i2c-ee-m1-gpioh-6-gpioh-7" to the "overlays=" line.

 overlays=meson-g12a-i2c-ee-m1-gpioh-6-gpioh-7

To enable I2C_EE_M1 on GPIOX_10 and GPIOX_11 (/dev/i2c-1), add item "meson-g12a-i2c-ee-m1-gpiox-10-gpiox-11" to the "overlays=" line.

 overlays=meson-g12a-i2c-ee-m1-gpiox-10-gpiox-11

To enable I2C_EE_M3 (/dev/i2c-3), add item "meson-g12a-i2c-ee-m3-gpioa-14-gpioa-15" to the "overlays=" line.

 overlays=meson-g12a-i2c-ee-m3-gpioa-14-gpioa-15

To enable I2C_AO_M0 (/dev/i2c-4), add item "meson-g12a-i2c-ao-m0-gpioao-2-gpioao-3" to the "overlays=" line.

 overlays=meson-g12a-i2c-ao-m0-gpioao-2-gpioao-3

Please note that do not add overlays meson-g12a-i2c-ee-m1-gpioh-6-gpioh-7 and meson-g12a-i2c-ee-m1-gpiox-10-gpiox-11 at the same time.

PWM

PWM_C channel

To enable PWM_C, add item "eson-g12a-pwm-c-on-gpiox-8" to the "overlays=" line.

 overlays=meson-g12a-pwm-c-on-gpiox-8

You would see directory /sys/devices/platform/soc/ffd00000.bus/ffd1a000.pwm is generated.

Then you can set up PWM-C channel with directory /sys/devices/platform/soc/ffd00000.bus/ffd1a000.pwm/pwm/pwmchipY.

PWMAO_A channel

To enable PWMAO_A, add item "meson-g12a-pwmao-a-on-gpioao-11" to the "overlays=" line.

 overlays=meson-g12a-pwmao-a-on-gpioao-11

You would see directory /sys/devices/platform/soc/ff800000.bus/ff807000.pwm is generated.

Then you can set up PWMAO_A channel with directory /sys/devices/platform/soc/ff800000.bus/ff807000.pwm/pwm/pwmchipY.

SPI

To enable SPI_A (/dev/spidev0.0), add item "meson-g12a-spi-spidev" to the "overlays=" line.

 overlays=meson-g12a-spi-spidev
 param_spidev_spi_bus=0
 param_spidev_max_freq=10000000

To enable SPI_B (/dev/spidev1.0), add item "meson-g12a-spi-spidev" to the "overlays=" line.

 overlays=meson-g12a-spi-spidev
 param_spidev_spi_bus=1
 param_spidev_max_freq=10000000

UART

One uart port cannot be used as common serial communication and serial console at the same time.

Common serial communication

To set UART_AO_A as common serial communication devices, add this item "meson-g12a-uart-ao-a-on-gpioao-0-gpioao-1" to the "overlays=" line. The device /dev/ttyAML0 is available.

 overlays=meson-g12a-uart-ao-a-on-gpioao-0-gpioao-1

To set UART_AO_B as common serial communication devices, add this item "meson-g12a-uart-ao-b-on-gpioao-2-gpioao-3" to the "overlays=" line. The device /dev/ttyAML1 is available.

 overlays=meson-g12a-uart-ao-b-on-gpioao-2-gpioao-3

To set UART_AO_B as common serial communication devices, add this item "meson-g12a-uart-ao-b-on-gpioao-8-gpioao-9" to the "overlays=" line. The device /dev/ttyAML1 is available.

 overlays=meson-g12a-uart-ao-b-on-gpioao-8-gpioao-9

To set UART_EE_C as common serial communication devices, add this item "meson-g12a-uart-ee-c" to the "overlays=" line. The device /dev/ttyAML4 is available.

 overlays=meson-g12a-uart-ee-c

Please note that do not add overlays meson-g12a-uart-ao-b-on-gpioao-2-gpioao-3 and meson-g12a-uart-ao-b-on-gpioao-8-gpioao-9 at the same time.

Serial console

To set UART_AO_A as serial console, add the following two lines to /boot/uEnv.txt

 console=ttyAML0,115200
 overlays=meson-g12a-uart-ao-a-on-gpioao-0-gpioao-1

USB Audio

See Audio.

USB Camera

See Camera module.

Changelogs