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

Difference between revisions of "Rock4/Debian"

(Created page with "{{rock4_header}} {{Languages|rockpi4/Debian}} ROCK 4 > Debian __TOC__ == Work with ROCK 4 Debian == === Introduction to ROCK 4 Debian =...")
 
Line 13: Line 13:
 
[[File:ROCKPI4-Debian-desktop.png | 800px ]]
 
[[File:ROCKPI4-Debian-desktop.png | 800px ]]
  
ROCK 4 Debian is an easy to use desktop system. There are two workspaces inside, desktop1 and desktop2. Click on the desktop-switch button in the bottom of the main window to switch the desktop. While working with ROCK 4 Debian, you will find it do well on playing music, playing video, Internet, Bluetooth and so on.
+
ROCK 4 Debian is an easy to use desktop system. There are two workspaces inside, desktop1 and desktop2. Click on the desktop-switch button in the bottom of the main window to switch the desktop. While working with ROCK 4 Debian, you will find it do well on playing music, playing video, Internet, BT and so on.
  
 
=== Debian Default User Account ===
 
=== Debian Default User Account ===
Line 148: Line 148:
 
   [  3]  0.0-10.0 sec  234 MBytes  196 Mbits/sec
 
   [  3]  0.0-10.0 sec  234 MBytes  196 Mbits/sec
  
=== Using Bluetooth ===
+
=== Using BT ===
  
 
Follow the [https://wiki.radxa.com/Rockpi4/radxa-apt#Introduction Guide of Radxa APT] to add Radxa APT.
 
Follow the [https://wiki.radxa.com/Rockpi4/radxa-apt#Introduction Guide of Radxa APT] to add Radxa APT.
Line 158: Line 158:
 
   $ sudo apt-get install -y broadcom-wifibt-firmware
 
   $ sudo apt-get install -y broadcom-wifibt-firmware
  
Check bluetooth service
+
Check BT service
  
 
   $ systemctl status bluetooth
 
   $ systemctl status bluetooth
  
Run bluetooth service
+
Run BT service
  
 
   $ systemctl start bluetooth
 
   $ systemctl start bluetooth
  
Check bluetooth device
+
Check BT device
  
 
   $ hciconfig
 
   $ hciconfig
Line 175: Line 175:
 
           TX bytes:4755 acl:0 sco:0 commands:62 errors:0
 
           TX bytes:4755 acl:0 sco:0 commands:62 errors:0
  
Example: Connect to Bluetooth Speaker
+
Example: Connect to BT Speaker
  
 
Run pulseaudio, otherwise ROCK Pi 4 will not be able to connect to device.
 
Run pulseaudio, otherwise ROCK Pi 4 will not be able to connect to device.

Revision as of 03:37, 29 September 2022

    ROCK 4 >  Debian

Work with ROCK 4 Debian

Introduction to ROCK 4 Debian

ROCKPI4-Debian-desktop.png

ROCK 4 Debian is an easy to use desktop system. There are two workspaces inside, desktop1 and desktop2. Click on the desktop-switch button in the bottom of the main window to switch the desktop. While working with ROCK 4 Debian, you will find it do well on playing music, playing video, Internet, BT and so on.

Debian Default User Account

Non-root User:

User Name : rock
Password  : rock

or

User Name : linaro
Password  : linaro

Root mode

rock is sudo user and switch to root can be done with the following command as user rock:

sudo su

For example:

rock@rockpi-4b:~$ 
rock@rockpi-4b:~$ sudo su
[sudo] password for rock: 
root@rockpi-4b:/home/rock# 

There is no password for root user by default. You can set the password via 'passwd root'.

root@rockpi-4b:/home/rock# passwd root
New password: 
Retype new password: 
passwd: password updated successfully
root@rockpi-4b:/home/rock#

Access from the Host PC/Laptop

Option 1: Serial console

Check Serial Console

Option 2: SSH

SSH server is enabled on port 22 of ROCK Pi 4 default image.

Please use angryip to find your board IP address.

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

Use System Tool Terminal

There are three kinds of tools for Terminal. They are LXTerminal, ""UXTerm"" and ""XTerm"". You are encouraged to choose your favorite one. Click on the icon, flying bird, on the bottom left in the ROCK 4 Debian's main window, and click on the icon, System Tools to select your wanted Terminal tool. Here is the LXTerminal as an example. If you try to experience more excitement, just as we want you to do that, you can type the following command to be a super user.

 $ sudo su

Terminal-LXTerminal.png

Setting time zone

Change time zone (default time is UTC(Universal Time Coordinated) time, this example is how changed it to CST(China Standard Time)):

   ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

Network Connection

There are two methods for network connection. One is Ethernet and the other is WIFI.

Ethernet Connection

You can use a network cable (one end connected to the external network port or route) to connect your ROCK Pi 4 to the network. The ROCK Pi 4 will automatically configure the network for your surfing on the Internet.

To test the Ethernet, we need to follow the steps:
  • Switch to super user mode by command
 $ sudo su
  • Check whether the Ethernet is normal by command, ifconfig. Here result shows us a network card, eth0, and the Ethernet IP address, 192.168.1.9. Also, use tool, ping, to connect to a normal domain.
 $ ifconfig
 $ ping www.baidu.com
  • To check the bandwidth, we need another machine, Host Linux (example). Here we use ROCK 4 Desktop as a server, and Host Linux as a client
    • Make sure there is iperf tool on your host PC. Maybe you can get it by $ sudo apt-get update, and $ sudo apt-get install iperf
    • At the Debian terminal, execute the command, $ iperf -s
    • At the Host Linux terminal, execute the command, $ iperf -c 192.168.1.9
Ethernet Test Result
  • ROCK 4 Debian

Ethernet-check.png

  • Host Linux
 $ iperf -c 192.168.1.9
 ------------------------------------------------------------
 Client connecting to 192.168.1.9, TCP port 5001
 TCP window size: 85.0 KByte (default)
 ------------------------------------------------------------
 [  3] local 192.168.1.100 port 37604 connected with 192.168.1.9 port 5001 
 [ ID] Interval       Transfer     Bandwidth
 [  3]  0.0-10.0 sec  1.09 GBytes   940 Mbits/sec

You see, The Bandwidth of Ethernet is up to nearly 1000Mbits/sec. Of course, you are encouraged to set ROCK 4 Debian as a client and Host Linux as a server when testing Ethernet network performance.

WIFI Connection

When there is not a network cable for your ROCK Pi 4, the WIFI connection is another good choice. ROCK Pi 4 supports 2.4G and 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
WIFI Test Result
  • ROCK 4 Debian

Wifi-check.png

Here we see wlan0 is working with the IP address, 192.168.31.139.

  • Host Linux
 $ iperf -c 192.168.1.10
 ------------------------------------------------------------
 Client connecting to 192.168.1.10, TCP port 5001
 TCP window size: 85.0 KByte (default)
 ------------------------------------------------------------
 [  3] local 192.168.1.100 port 60924 connected with 192.168.1.10 port 5001
 [ ID] Interval       Transfer     Bandwidth
 [  3]  0.0-10.0 sec   234 MBytes   196 Mbits/sec

Using BT

Follow the Guide of Radxa APT to add Radxa APT.

We suggest that you add stretch-testing APT Source to get the newest packages.

Install packages:

 $ sudo apt-get install -y broadcom-wifibt-firmware

Check BT service

 $ systemctl status bluetooth

Run BT service

 $ systemctl start bluetooth

Check BT device

 $ hciconfig
 hci0:   Type: Primary  Bus: UART
         BD Address: 43:45:C5:00:1F:AC  ACL MTU: 1021:8  SCO MTU: 64:1
         UP RUNNING 
         RX bytes:876 acl:0 sco:0 events:62 errors:0
         TX bytes:4755 acl:0 sco:0 commands:62 errors:0

Example: Connect to BT Speaker

Run pulseaudio, otherwise ROCK Pi 4 will not be able to connect to device.

 $ pulseaudio --start

Connect using bluetoothctl

 # bluetoothctl 
 [NEW] Controller 43:45:C5:00:1F:AC linaro-alip [default]
 
 [bluetooth]# default-agent 
 No agent is registered
 
 [bluetooth]# power on
 Changing power on succeeded
 
 [bluetooth]# scan on
 Discovery started
 [CHG] Controller 43:45:C5:00:1F:AC Discovering: yes
 [NEW] Device 22:22:30:23:04:00 22-22-30-23-04-00
 [CHG] Device 34:D7:12:AE:36:55 RSSI: -77
 [  NEW] Device 77:EC:79:4F:6B:AC HH-BTSP0003
 
 [bluetooth]# pair 77:EC:79:4F:6B:AC 
 Attempting to pair with 77:EC:79:4F:6B:AC
 [CHG] Device 77:EC:79:4F:6B:AC Connected: yes
 [CHG] Device 77:EC:79:4F:6B:AC UUIDs: 00001101-0000-1000-8000-00805f9b34fb
 [CHG] Device 77:EC:79:4F:6B:AC UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
 [CHG] Device 77:EC:79:4F:6B:AC UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
 [CHG] Device 77:EC:79:4F:6B:AC UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
 [CHG] Device 77:EC:79:4F:6B:AC UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
 [CHG] Device 77:EC:79:4F:6B:AC ServicesResolved: yes
 [CHG] Device 77:EC:79:4F:6B:AC Paired: yes
 Pairing successful
 [CHG] Device 77:EC:79:4F:6B:AC ServicesResolved: no
 [CHG] Device 77:EC:79:4F:6B:AC Connected: no
 
 [bluetooth]# trust 77:EC:79:4F:6B:AC 
 [CHG] Device 77:EC:79:4F:6B:AC Trusted: yes
 Changing 77:EC:79:4F:6B:AC trust succeeded

 [bluetooth]# connect 77:EC:79:4F:6B:AC 
 Attempting to connect to 77:EC:79:4F:6B:AC
 [CHG] Device 77:EC:79:4F:6B:AC Connected: yes
 Connection successful
 [HH-BTSP0003]# [   79.574954] input: 77:EC:79:4F:6B:AC as /devices/virtual/input/input3
 [CHG] Device 77:EC:79:4F:6B:AC ServicesResolved: yes
 [HH-BTSP0003]#

Play songs and have a good time.

Test OpenGL ES

Use glmark2-es2

OpenGL-ES.png OpenGL-ES2 result.png

Use glmark2-es2-drm

If there is no tool glmark2-es2, you can use Use glmark2-es2-drm to test GPU.

Install glmark2
 $ sudo apt update
 $ sudo apt install -y git gcc g++ libpng-dev libjpeg-dev pkg-config libx11-dev libdrm-dev libgbm-dev libgbm1 libudev-dev
 $ mkdir -p /home/rock/work
 $ cd /home/rock/work
 $ git clone https://github.com/glmark2/glmark2.git
 $ cd glmark2/
 $ ./waf configure --with-flavors=drm-glesv2
 $ ./waf build -j 4
 $ ./waf install
Install mali packages
 $ sudo apt install -y rockchip-mali-midgard14=1.6-2
 $ sudo apt install -y rockchip-mali-midgard-dev=1.6-2
Test OpenGL via glmark2-es2-drm

Change to console mode via 'Ctrl + Alt + F2'

And run the following commands:

 $ glmark2-es2-drm

Work with M.2 NVME SSD

Before supplying power for ROCK Pi 4 board, connect a Samsung EVO 960 SSD to ROCK Pi 4 Board.

Running the following commands to use the M.2 NVME SSD. Here we use a newly launched M.2 SSD.

  • Switch to super user mode
 $ sudo su
  • Check NVME devices.The character device /dev/nvme0 is the NVME device controller, and block devices like /dev/nvme0n1 are the NVME storage namespaces. Devies like /dev/nvmen0n1 are the actual storage, which will behave essentially as disks.
 $ ls /dev/nvme*
  • If there is not partition in NVME device, need to use tool fdisk to create one.
 $ fdisk /dev/nvme0n1
  • If create partition successfully, there should be at least one partition, /dev/nvme0n1p1. Then create a file system, like:
 $ mkfs.ext4 /dev/nvme0n1p1
  • Finally, mount the file system. You can absolutely create a new directory to be a mounted point.
 $ mount /dev/nvme0n1p1 /mnt
  • Remember, if you have a M.2 SSD that have already stored data, you just need to mount it.

Improve NVMe speed

By default, the PCIe of ROCK Pi 4 runs on Gen1 mode for the most capability. Once you confirm that your NVMe works well you can try to enable the PCIe gen2 mode to get the max speed of NVMe(reading/writing > 1000MB/s).

To enable PCIe gen2 mode, make sure your /boot is mounted:

     mount | grep boot

edit /boot/hw_intfc.conf, uncomment the line:

   intfc:dtoverlay=pcie-gen2

save and reboot. You should have higher speed on NVMe.

Setting Volume

When you are listening the music or watching the movie, you may need to set the output devices, headphone jack on Board or audio output port on HDMI monitor.

Set volume 1.png Set volume 2.png

Using Go

Go(also golang) runs well on Debian. To get golang do:

 $ sudo su
 $ apt-get update
 $ apt-get install golang

Using Editor Emacs

Emacs runs well on Debian. To get emacs do:

 $ sudo su
 $ apt-get update
 $ apt-get install emacs

You can start the program by command line or clicking on the Emacs Icon.

 $ emacs

HDMI

Enable hotplug

$ sudo chmod +x /usr/local/bin/drm-hotplug.sh

DP

ROCK Pi 4C supports HDMI and DP at the same time. Please confirm that the version of package rockchip-overlay is at least v2.9.

Radxa Display 10HD

ROCK Pi 4C Plus Debian supports Radxa Display 10HD Radxa Display 10HD.

Raspberry Pi 7 Inch LCD Screen

ROCK Pi 4 Debian firmware support Rasberry Pi official 7 inch LCD screen click here to get more information.

CPU Overclocking

ROCK Pi4 Debian firmware support CPU overclocking dual Cortex-A72 core frequency can overclocking over 2GHz click here to get more information.

MIPI CSI Camera

ROCK Pi4 support Raspberry pi official camera module v2 IMX219 now, click here to know how use it.

Fan

To control ROCK Pi 4C Plus fan, please use the following commands.

echo 0 > /sys/class/pwm/pwmchip0/export
sleep 0.2
echo 40000 > /sys/class/pwm/pwmchip0/pwm0/period
sleep 0.2
echo 10000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
sleep 0.2
echo normal >  /sys/class/pwm/pwmchip0/pwm0/polarity
sleep 0.2
echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable

General purpose input-output (GPIO)

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

The ROCK Pi 4 system images use hw_intfc.conf, provided by the package rockpi4-dtbo, to configure interfaces.

For more details about device tree overlays, see ROCK Pi 4 Device Tree Overlays.

Install essential package

 sudo apt-get install -y rockpi4-dtbo

I2C

Modify file /boot/hw_intfc.conf. Set "on" to enable the optional hardware interfaces while set "off" to disable.

 intfc:i2c2=on
 intfc:i2c6=on
 intfc:i2c7=on

PWM

Modify file /boot/hw_intfc.conf. Set "on" to enable the optional hardware interfaces while set "off" to disable.

 intfc:pwm0=on
 intfc:pwm1=on

SPI

Modify file /boot/hw_intfc.conf. Set "on" to enable the optional hardware interfaces while set "off" to disable.

 intfc:spi1=on
 intfc:spi2=on
 intfc:dtoverlay=devspi1
 intfc:dtoverlay=devspi2

UART

Modify file /boot/hw_intfc.conf. Set "on" to enable the optional hardware interfaces while set "off" to disable.

 intfc:uart2=on
 intfc:uart4=on

And add "#" to line "intfc:dtoverlay=console-on-ttyS2"

 #intfc:dtoverlay=console-on-ttyS2
 #intfc:dtoverlay=console-on-ttyS4

Please note that when ROCK Pi 4 uart2 is connected with your devices like Raspberry Pi CAN/RS485 hat sending some data to uart2 on ROCK Pi 4. Please do the following step.

Check the file /boot/extlinux/extlinux.conf. And delete the following line.

menu title select kernel

Debug console

Modify file /boot/hw_intfc.conf. Set ttyS2 as debug console.

Disable UART2

 intfc:uart2=off

And uncomment the following line.

 intfc:dtoverlay=console-on-ttyS2

Use SPI Flash on board

Modify file /boot/hw_intfc.conf. Disable UART4 and enable SPI1. Besides, need to load spi1-flash overlay.

 intfc:uart4=off
 intfc:spi1=on
 intfc:dtoverlay=spi1-flash

Change logs

Kernel

2019-07-30

  • Add device tree overlay for Raspberry pi official LCD screen
  • Add CPU overclocking to 2GHz dtbo option
  • support Raspberry pi official camera module v1 OV5647 dtbo option

More:
  • No more