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

Difference between revisions of "Rockpi4/dev/how-to-use-debian"

< Rockpi4‎ | dev
(Created page with "{{rock4_header}} {{Languages|rockpi4/Debian}} ROCK 4 > Development > How to use Debian __TOC__ ===...")
 
Line 6: Line 6:
  
 
__TOC__
 
__TOC__
 +
 +
== How to use Deabian ==
  
 
=== Introduction of ROCK 4 Debian ===
 
=== Introduction of ROCK 4 Debian ===
Line 85: Line 87:
 
   $ sudo su
 
   $ 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.  
+
* Check whether the Ethernet is normal by command, ifconfig. Here result shows us a network card, eth0, and the Ethernet IP address, 192.168.2.121. Also, use tool, ping, to connect to a normal domain.  
   $ ifconfig
+
   $ ifconfig eth0
  
   $ ping www.baidu.com
+
<pre>
 +
root@rockpi-4b:/home/rock# ifconfig eth0
 +
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
 +
        inet 192.168.2.121  netmask 255.255.255.0  broadcast 192.168.2.255
 +
        inet6 240e:3b7:3245:f180::76a  prefixlen 128  scopeid 0x0<global>
 +
        inet6 240e:3b7:3245:f180:2b0a:7bbd:fb4c:db8e  prefixlen 64  scopeid 0x0<global>
 +
        inet6 fd02::76a  prefixlen 128  scopeid 0x0<global>
 +
        inet6 fe80::5399:857f:dd31:867d  prefixlen 64  scopeid 0x20<link>
 +
        inet6 fd02::940b:e7cd:38f0:55bd  prefixlen 64  scopeid 0x0<global>
 +
        ether 76:ca:5e:be:5a:f4  txqueuelen 1000  (Ethernet)
 +
        RX packets 73011  bytes 10568786 (10.0 MiB)
 +
        RX errors 0  dropped 3  overruns 0  frame 0
 +
        TX packets 903  bytes 80931 (79.0 KiB)
 +
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 +
        device interrupt 24 
 +
 
 +
</pre>
 +
 
 +
   $ ping www.baidu.com -I eth0
  
 
* 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
 
* 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
+
** Make sure there is '''iperf3''' tool on your host PC. Maybe you can get it by $ sudo apt-get update, and  $ sudo apt-get install iperf3
** At the Debian terminal,  execute the command,  $ iperf -s
+
** At the Debian terminal,  execute the command,  $ iperf3 -s
** At the Host Linux terminal, execute the command,  $ iperf -c 192.168.1.9
+
** At the Host Linux terminal, execute the command,  $ iperf3 -c 192.168.2.121
  
 
===== Ethernet Test Result =====
 
===== Ethernet Test Result =====
  
 
* ROCK 4 Debian
 
* ROCK 4 Debian
[[File:Ethernet-check.png | 1000px ]]
+
 
 +
<pre>
 +
root@rockpi-4b:/home/rock# iperf3 -s
 +
-----------------------------------------------------------
 +
Server listening on 5201
 +
-----------------------------------------------------------
 +
Accepted connection from 192.168.2.11, port 54874
 +
[ 5] local 192.168.2.121 port 5201 connected to 192.168.2.11 port 54876
 +
[ ID] Interval          Transfer    Bitrate
 +
[  5]  0.00-1.00  sec  112 MBytes  937 Mbits/sec                 
 +
[  5]   1.00-2.00  sec  112 MBytes  941 Mbits/sec                 
 +
[  5]   2.00-3.00  sec  112 MBytes  941 Mbits/sec                 
 +
[  5]  3.00-4.00  sec  112 MBytes  941 Mbits/sec                 
 +
[  5]  4.00-5.00  sec  112 MBytes  941 Mbits/sec                 
 +
[  5]  5.00-6.00  sec  112 MBytes  941 Mbits/sec                 
 +
[  5]  6.00-7.00  sec  112 MBytes  940 Mbits/sec                 
 +
[  5]  7.00-8.00  sec  112 MBytes  941 Mbits/sec                 
 +
[  5]  8.00-9.00  sec  112 MBytes  941 Mbits/sec                 
 +
[  5]  9.00-10.00  sec  112 MBytes  941 Mbits/sec                 
 +
[  5]  10.00-10.00  sec  100 KBytes  783 Mbits/sec                 
 +
- - - - - - - - - - - - - - - - - - - - - - - - -
 +
[ ID] Interval          Transfer    Bitrate
 +
[  5]  0.00-10.00  sec  1.10 GBytes  941 Mbits/sec                  receiver
 +
-----------------------------------------------------------
 +
Server listening on 5201
 +
-----------------------------------------------------------
 +
</pre>
  
 
* Host Linux
 
* Host Linux
  $ iperf -c 192.168.1.9
+
<pre>
  ------------------------------------------------------------
+
$ iperf3 -c 192.168.2.121
  Client connecting to 192.168.1.9, TCP port 5001
+
Connecting to host 192.168.2.121, port 5201
   TCP window size: 85.0 KByte (default)
+
[  4] local 192.168.2.11 port 54876 connected to 192.168.2.121 port 5201
   ------------------------------------------------------------
+
[ ID] Interval          Transfer    Bandwidth      Retr  Cwnd
  [  3] local 192.168.1.100 port 37604 connected with 192.168.1.9 port 5001
+
[  4]   0.00-1.00  sec  112 MBytes  940 Mbits/sec    0    192 KBytes     
  [ ID] Interval       Transfer    Bandwidth
+
[  4]   1.00-2.00  sec  112 MBytes  941 Mbits/sec    0    212 KBytes     
  3] 0.0-10.0 sec  1.09 GBytes  940 Mbits/sec
+
[  4]  2.00-3.00  sec  112 MBytes  942 Mbits/sec    0    223 KBytes     
 +
[  4]  3.00-4.00  sec  112 MBytes  941 Mbits/sec    0    249 KBytes     
 +
[  4]  4.00-5.00  sec  112 MBytes  942 Mbits/sec    0    262 KBytes     
 +
[  4]  5.00-6.00  sec  112 MBytes  940 Mbits/sec    0    288 KBytes     
 +
[  4]  6.00-7.00  sec  112 MBytes  941 Mbits/sec    0    304 KBytes     
 +
[  4]  7.00-8.00  sec  112 MBytes  941 Mbits/sec    0    304 KBytes     
 +
[  4]  8.00-9.00  sec  112 MBytes  942 Mbits/sec    0    304 KBytes     
 +
[  4]  9.00-10.00  sec  112 MBytes  941 Mbits/sec    0    304 KBytes     
 +
- - - - - - - - - - - - - - - - - - - - - - - - -
 +
[ ID] Interval           Transfer    Bandwidth       Retr
 +
4]   0.00-10.00 sec  1.10 GBytes  941 Mbits/sec    0            sender
 +
[  4]  0.00-10.00  sec  1.10 GBytes  941 Mbits/sec                 receiver
 +
 
 +
iperf Done.
 +
</pre>
  
 
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.  
 
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 ====
+
==== 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.
+
When there is not a network cable for your ROCK 4, the WiFi connection is another good choice. ROCK 4 supports 2.4G and 5G WIFI wireless network.
  
===== To test the WIFI performance, we need to follow the steps: =====
+
===== To test the WiFi performance, we need to follow the steps: =====
 
* Switch to super user mode
 
* Switch to super user mode
 
   $ sudo su
 
   $ sudo su
Line 129: Line 189:
 
   $ nmcli dev wifi connect "wifi_name" password "wifi_password"
 
   $ nmcli dev wifi connect "wifi_name" password "wifi_password"
  
* Test WIFI perpormance by tool iperf
+
* Test WIFI perpormance by tool iperf3.
  
===== WIFI Test Result =====
+
===== WiFi Test Result =====
 
* ROCK 4 Debian
 
* ROCK 4 Debian
[[File:wifi-check.png | 1000px ]]
+
 
 +
<pre>
 +
root@rockpi-4b:/home/rock# ifconfig wlan0
 +
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
 +
        inet 192.168.1.103  netmask 255.255.255.0  broadcast 192.168.1.255
 +
        inet6 fe80::4c2b:5ab6:dcae:8318  prefixlen 64  scopeid 0x20<link>
 +
        ether 14:13:33:51:ca:f9  txqueuelen 1000  (Ethernet)
 +
        RX packets 307249  bytes 454343058 (433.2 MiB)
 +
        RX errors 0  dropped 0  overruns 0  frame 0
 +
        TX packets 26551  bytes 1757158 (1.6 MiB)
 +
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 +
 
 +
root@rockpi-4b:/home/rock# iperf3 -s
 +
-----------------------------------------------------------
 +
Server listening on 5201
 +
-----------------------------------------------------------
 +
Accepted connection from 192.168.1.100, port 58146
 +
[ 5] local 192.168.1.103 port 5201 connected to 192.168.1.100 port 58147
 +
[ ID] Interval          Transfer    Bitrate
 +
[  5]  0.00-1.00  sec  18.9 MBytes  158 Mbits/sec                 
 +
[  5]   1.00-2.00  sec  22.0 MBytes  184 Mbits/sec                 
 +
[  5]   2.00-3.00  sec  22.7 MBytes  190 Mbits/sec                 
 +
[  5]  3.00-4.00  sec  22.8 MBytes  191 Mbits/sec                 
 +
[  5]  4.00-5.00  sec  22.5 MBytes  189 Mbits/sec                 
 +
[  5]  5.00-6.00  sec  22.0 MBytes  184 Mbits/sec                 
 +
[  5]  6.00-7.00  sec  20.4 MBytes  171 Mbits/sec                 
 +
[  5]  7.00-8.00  sec  21.9 MBytes  184 Mbits/sec                 
 +
[  5]  8.00-9.00  sec  21.7 MBytes  182 Mbits/sec                 
 +
[  5]  9.00-10.00  sec  21.5 MBytes  180 Mbits/sec                 
 +
[  5]  10.00-10.00  sec  86.3 KBytes  237 Mbits/sec                 
 +
- - - - - - - - - - - - - - - - - - - - - - - - -
 +
[ ID] Interval          Transfer    Bitrate
 +
[  5]  0.00-10.00  sec  216 MBytes  181 Mbits/sec                  receiver
 +
-----------------------------------------------------------
 +
Server listening on 5201
 +
-----------------------------------------------------------
 +
</pre>
  
 
Here we see wlan0 is working  with the IP address, 192.168.31.139.
 
Here we see wlan0 is working  with the IP address, 192.168.31.139.
 
* Host Linux
 
* Host Linux
  $ iperf -c 192.168.1.10
+
 
  ------------------------------------------------------------
+
<pre>
  Client connecting to 192.168.1.10, TCP port 5001
+
% iperf3 -c 192.168.1.103
   TCP window size: 85.0 KByte (default)
+
Connecting to host 192.168.1.103, port 5201
   ------------------------------------------------------------
+
[  5] local 192.168.1.100 port 58147 connected to 192.168.1.103 port 5201
  [  3] local 192.168.1.100 port 60924 connected with 192.168.1.10 port 5001
+
[ ID] Interval          Transfer    Bitrate
  [ ID] Interval       Transfer    Bandwidth
+
[  5]   0.00-1.00  sec  19.0 MBytes  159 Mbits/sec                 
  3] 0.0-10.0 sec  234 MBytes  196 Mbits/sec
+
[  5]   1.00-2.00  sec  21.9 MBytes  184 Mbits/sec                 
 +
[  5]  2.00-3.00  sec  22.7 MBytes  190 Mbits/sec                 
 +
[  5]  3.00-4.00  sec  22.8 MBytes  191 Mbits/sec                 
 +
[  5]  4.00-5.00  sec  22.5 MBytes  188 Mbits/sec                 
 +
[  5]  5.00-6.00  sec  22.0 MBytes  185 Mbits/sec                 
 +
[  5]  6.00-7.00  sec  20.4 MBytes  171 Mbits/sec                 
 +
[  5]  7.00-8.00  sec  22.0 MBytes  184 Mbits/sec                 
 +
[  5]  8.00-9.00  sec  21.7 MBytes  182 Mbits/sec                 
 +
[  5]  9.00-10.00  sec  21.5 MBytes  180 Mbits/sec                 
 +
- - - - - - - - - - - - - - - - - - - - - - - - -
 +
[ ID] Interval           Transfer    Bitrate
 +
5]   0.00-10.00 sec  216 MBytes  181 Mbits/sec                  sender
 +
[  5]  0.00-10.00  sec  216 MBytes  181 Mbits/sec                 receiver
 +
 
 +
iperf Done.
 +
</pre>
  
 
=== Using Bluetooth ===
 
=== Using Bluetooth ===
Line 225: Line 336:
 
Play songs and have a good time.
 
Play songs and have a good time.
  
=== Test OpenGL ES ===
+
=== Work with PCIe M.2 NVME SSD ===
  
==== Use glmark2-es2 ====
+
Before supplying power for ROCK 4 board, connect a Samsung EVO 960 SSD to ROCK 4 Board.
 
+
[[File:OpenGL-ES.png | 1000px ]]
+
[[File:OpenGL-ES2_result.png | 1000px ]]
+
 
+
==== 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. ====
 
==== Running the following commands to use the M.2 NVME SSD. Here we use a newly launched M.2 SSD. ====
Line 270: Line 346:
  
 
* 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.
 
* 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*
+
   # ls /dev/nvme*
  
 
* If there is not partition in NVME device, need to use tool fdisk to create one.
 
* If there is not partition in NVME device, need to use tool fdisk to create one.
   $ fdisk /dev/nvme0n1
+
   # fdisk /dev/nvme0n1
  
 
* If create partition successfully, there should be at least one partition, /dev/nvme0n1p1. Then create a file system, like:
 
* If create partition successfully, there should be at least one partition, /dev/nvme0n1p1. Then create a file system, like:
  $ mkfs.ext4 /dev/nvme0n1p1
+
# mkfs.ext4 /dev/nvme0n1p1
  
 
* Finally, mount the file system. You can absolutely create a new directory to be a mounted point.
 
* Finally, mount the file system. You can absolutely create a new directory to be a mounted point.
   $ mount /dev/nvme0n1p1 /mnt
+
   # mount /dev/nvme0n1p1 /mnt
  
 
*Remember, if you have a M.2 SSD that have already stored data, you just need to mount it.
 
*Remember, if you have a M.2 SSD that have already stored data, you just need to mount it.
Line 288: Line 364:
 
To enable PCIe gen2 mode, make sure your '''/boot''' is mounted:
 
To enable PCIe gen2 mode, make sure your '''/boot''' is mounted:
  
      mount | grep boot
+
mount | grep boot
  
edit '''/boot/hw_intfc.conf''', uncomment the line:
+
Edit '''/boot/hw_intfc.conf''', uncomment the line:
  
    intfc:dtoverlay=pcie-gen2
+
intfc:dtoverlay=pcie-gen2
  
 
save and reboot. You should have higher speed on NVMe.
 
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.
 
 
[[File:set_volume_1.png | 1000px ]]
 
[[File:set_volume_2.png | 1000px ]]
 
 
=== 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 ===
 
=== HDMI ===
Line 328: Line 380:
  
 
ROCK Pi 4C supports HDMI and DP at the same time.
 
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 ===
+
=== Hardware configuration ===
  
ROCK Pi 4C Plus Debian supports Radxa Display 10HD [[rockpi4/hardware/display | Radxa Display 10HD]].
+
====Fan ====
  
===Raspberry Pi 7 Inch LCD Screen===
+
To control ROCK 4C Plus fan, please use the following commands.
 
+
ROCK Pi 4 Debian firmware support Rasberry Pi official 7 inch LCD screen [https://wiki.radxa.com/Rockpi4/Raspberry_Pi_official_LCD click here] to get more information.
+
 
+
===CPU Overclocking===
+
 
+
ROCK Pi4 Debian firmware support CPU overclocking dual Cortex-A72 core frequency can overclocking over 2GHz [https://wiki.radxa.com/Rockpi4/CPU_overclocking click here] to get more information.
+
 
+
===MIPI CSI Camera===
+
 
+
ROCK Pi4 support Raspberry pi official camera module v2 IMX219 now, [https://wiki.radxa.com/Rockpi4/MIPI_Camera click here] to know how use it.
+
 
+
===Fan ===
+
 
+
To control ROCK Pi 4C Plus fan, please use the following commands.
+
  
 
<pre>
 
<pre>
Line 362: Line 399:
 
</pre>
 
</pre>
  
=== <span id="gpio">General purpose input-output (GPIO) </span> ===
+
====Raspberry Pi 7 Inch LCD Screen====
 +
 
 +
ROCK 4 Debian firmware support Rasberry Pi official 7 inch LCD screen [https://wiki.radxa.com/Rockpi4/Raspberry_Pi_official_LCD click here] to get more information.
 +
 
 +
====CPU Overclocking====
 +
 
 +
ROCK 4 Debian firmware support CPU overclocking dual Cortex-A72 core frequency can overclocking over 2GHz [https://wiki.radxa.com/Rockpi4/CPU_overclocking click here] to get more information.
 +
 
 +
====MIPI CSI Camera====
 +
 
 +
ROCK Pi4 support Raspberry pi official camera module v2 IMX219 now, [https://wiki.radxa.com/Rockpi4/MIPI_Camera click here] to know how use it.
 +
 
 +
==== Radxa Display 10HD ====
 +
 
 +
ROCK 4C Plus Debian supports Radxa Display 10HD [[rockpi4/hardware/display | Radxa Display 10HD]].
 +
 
 +
==== <span id="gpio">General purpose input-output (GPIO) </span> ====
  
 
* ROCK Pi 4 has one 40-pin expansion header. To control them, see [[rockpi4/hardware/gpio | ROCK Pi 4 GPIO Pinout]].
 
* ROCK Pi 4 has one 40-pin expansion header. To control them, see [[rockpi4/hardware/gpio | ROCK Pi 4 GPIO Pinout]].
  
=== <span id="common_hardware_interface">Common Hardware Interfaces, I2C, PWM, SPI, UART, etc</span> ===
+
==== <span id="common_hardware_interface">Common Hardware Interfaces, I2C, PWM, SPI, UART, etc</span> ====
  
 
The ROCK Pi 4 system images use hw_intfc.conf, provided by the package rockpi4-dtbo, to configure interfaces.
 
The ROCK Pi 4 system images use hw_intfc.conf, provided by the package rockpi4-dtbo, to configure interfaces.
Line 372: Line 425:
 
For more details about device tree overlays, see [[rockpi4/hardware/devtree_overlays | ROCK Pi 4 Device Tree Overlays]].
 
For more details about device tree overlays, see [[rockpi4/hardware/devtree_overlays | ROCK Pi 4 Device Tree Overlays]].
  
==== Install essential package ====
+
===== Install essential package =====
  
  sudo apt-get install -y rockpi4-dtbo
+
$ sudo apt-get install -y rockpi4-dtbo
  
==== I2C ====
+
===== I2C =====
  
 
Modify file /boot/hw_intfc.conf. Set "on" to enable the optional hardware interfaces while set "off" to disable.
 
Modify file /boot/hw_intfc.conf. Set "on" to enable the optional hardware interfaces while set "off" to disable.
  
  intfc:i2c2=on
+
intfc:i2c2=on
  intfc:i2c6=on
+
intfc:i2c6=on
  intfc:i2c7=on
+
intfc:i2c7=on
  
==== PWM ====
+
===== PWM =====
  
 
Modify file /boot/hw_intfc.conf. Set "on" to enable the optional hardware interfaces while set "off" to disable.
 
Modify file /boot/hw_intfc.conf. Set "on" to enable the optional hardware interfaces while set "off" to disable.
  
  intfc:pwm0=on
+
intfc:pwm0=on
  intfc:pwm1=on
+
intfc:pwm1=on
  
==== SPI ====
+
===== SPI =====
  
 
Modify file /boot/hw_intfc.conf. Set "on" to enable the optional hardware interfaces while set "off" to disable.
 
Modify file /boot/hw_intfc.conf. Set "on" to enable the optional hardware interfaces while set "off" to disable.
  
  intfc:spi1=on
+
intfc:spi1=on
  intfc:spi2=on
+
intfc:spi2=on
  intfc:dtoverlay=devspi1
+
intfc:dtoverlay=devspi1
  intfc:dtoverlay=devspi2
+
intfc:dtoverlay=devspi2
 +
#intfc:dtoverlay=spi1-flash
  
==== UART ====
+
===== UART =====
  
 
Modify file /boot/hw_intfc.conf. Set "on" to enable the optional hardware interfaces while set "off" to disable.
 
Modify file /boot/hw_intfc.conf. Set "on" to enable the optional hardware interfaces while set "off" to disable.
  
  intfc:uart2=on
+
intfc:uart2=on
  intfc:uart4=on
+
intfc:uart4=on
  
 
And add "#" to line "intfc:dtoverlay=console-on-ttyS2"
 
And add "#" to line "intfc:dtoverlay=console-on-ttyS2"
Line 418: Line 472:
 
  menu title select kernel
 
  menu title select kernel
  
==== Debug console ====
+
===== Debug console =====
  
 
Modify file /boot/hw_intfc.conf. Set ttyS2 as debug console.
 
Modify file /boot/hw_intfc.conf. Set ttyS2 as debug console.
Line 424: Line 478:
 
Disable UART2
 
Disable UART2
  
  intfc:uart2=off
+
intfc:uart2=off
  
 
And uncomment the following line.
 
And uncomment the following line.
  
  intfc:dtoverlay=console-on-ttyS2
+
intfc:dtoverlay=console-on-ttyS2
  
==== Use SPI Flash on board ====
+
===== Use SPI Flash on board =====
  
 
Modify file /boot/hw_intfc.conf. Disable UART4 and enable SPI1. Besides, need to load spi1-flash overlay.
 
Modify file /boot/hw_intfc.conf. Disable UART4 and enable SPI1. Besides, need to load spi1-flash overlay.
  
  intfc:uart4=off
+
intfc:uart4=off
  intfc:spi1=on
+
intfc:spi1=on
  intfc:dtoverlay=spi1-flash
+
intfc:dtoverlay=spi1-flash
  
== <span id="change-log">Change logs </span>==
+
=== Applications ===
  
=== Kernel ===
+
==== OpenGL ES Test ====
{{Changelog_rockpi4_kernel}}
+
 
 +
===== Use glmark2-es2 =====
 +
 
 +
glmark2-es2 is out of box.
 +
 
 +
<pre>
 +
rock@rockpi-4b:~$ glmark2-es2
 +
arm_release_ver of this libmali is 'r18p0-01rel0', rk_so_ver is '4'.=======================================================
 +
    glmark2 2021.02
 +
=======================================================
 +
    OpenGL Information
 +
    GL_VENDOR:    ARM
 +
    GL_RENDERER:  Mali-T860
 +
    GL_VERSION:    OpenGL ES 3.2 v1.r18p0-01rel0.5cb5681058e8e076ff89747c20c32578
 +
=======================================================
 +
[build] use-vbo=false: FPS: 59 FrameTime: 16.949 ms
 +
[build] use-vbo=true: FPS: 60 FrameTime: 16.667 ms
 +
[texture] texture-filter=nearest: FPS: 60 FrameTime: 16.667 ms
 +
[texture] texture-filter=linear: FPS: 60 FrameTime: 16.667 ms
 +
[texture] texture-filter=mipmap: FPS: 60 FrameTime: 16.667 ms
 +
[shading] shading=gouraud: FPS: 60 FrameTime: 16.667 ms
 +
[shading] shading=blinn-phong-inf: FPS: 60 FrameTime: 16.667 ms
 +
[shading] shading=phong: FPS: 60 FrameTime: 16.667 ms
 +
[shading] shading=cel: FPS: 60 FrameTime: 16.667 ms
 +
[bump] bump-render=high-poly: FPS: 60 FrameTime: 16.667 ms
 +
[bump] bump-render=normals: FPS: 60 FrameTime: 16.667 ms
 +
[bump] bump-render=height: FPS: 60 FrameTime: 16.667 ms
 +
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 60 FrameTime: 16.667 ms
 +
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 60 FrameTime: 16.667 ms
 +
[pulsar] light=false:quads=5:texture=false: FPS: 60 FrameTime: 16.667 ms
 +
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 60 FrameTime: 16.667 ms
 +
[desktop] effect=shadow:windows=4: FPS: 60 FrameTime: 16.667 ms
 +
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 30 FrameTime: 33.333 ms
 +
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 30 FrameTime: 33.333 ms
 +
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 30 FrameTime: 33.333 ms
 +
[ideas] speed=duration: FPS: 60 FrameTime: 16.667 ms
 +
[jellyfish] <default>: FPS: 60 FrameTime: 16.667 ms
 +
[terrain] <default>: FPS: 30 FrameTime: 33.333 ms
 +
[shadow] <default>: FPS: 60 FrameTime: 16.667 ms
 +
[refract] <default>: FPS: 59 FrameTime: 16.949 ms
 +
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 60 FrameTime: 16.667 ms
 +
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 60 FrameTime: 16.667 ms
 +
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
 +
[function] fragment-complexity=low:fragment-steps=5: FPS: 60 FrameTime: 16.667 ms
 +
[function] fragment-complexity=medium:fragment-steps=5: FPS: 60 FrameTime: 16.667 ms
 +
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
 +
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
 +
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
 +
=======================================================
 +
                                  glmark2 Score: 56
 +
=======================================================
 +
</pre>
 +
 
 +
===== Use glmark2-es2-drm =====
 +
 
 +
If there is no tool glmark2-es2, you can build one from source code.
 +
 
 +
Here is the example of building glmark2-es2-drm.
 +
 
 +
====== 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
 +
 
 +
====== Test OpenGL via glmark2-es2-drm ======
 +
 
 +
Change to console mode via 'Ctrl + Alt + F2'
 +
 
 +
And run the following commands:
 +
  $ glmark2-es2-drm
 +
 
 +
==== 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.
 +
 
 +
[[File:set_volume_1.png | 1000px ]]
 +
[[File:set_volume_2.png | 1000px ]]
 +
 
 +
==== Use Go ====
 +
 
 +
Go(also golang) runs well on Debian. To get golang do:
 +
  $ sudo su
 +
  $ apt-get update
 +
  $ apt-get install golang
 +
 
 +
==== Use 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

Revision as of 07:10, 15 September 2022

    ROCK 4 >  Development >  How to use Debian

How to use Deabian

Introduction of ROCK 4 Debian

Debian11-desktop.png

ROCK 4 Debian is an easy to use desktop system. While working with ROCK 4 Debian, you will find it do well on playing music, Internet, Bluetooth, AI and so on.

ROCK 4 Debian 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.

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: HDMI monitor and Mouse

You would see Desktop on HDMI monitor.

Option 2: SSH

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

Please use angryip to find your board IP address.

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

Option 3: Serial console

Check Serial Console

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, Ethernet and WiFi.

Ethernet Connection

You can use a network cable (one end connected to the external network port or route) to connect your ROCK 4 to the network. The ROCK 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.2.121. Also, use tool, ping, to connect to a normal domain.
 $ ifconfig eth0
root@rockpi-4b:/home/rock# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.121  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 240e:3b7:3245:f180::76a  prefixlen 128  scopeid 0x0<global>
        inet6 240e:3b7:3245:f180:2b0a:7bbd:fb4c:db8e  prefixlen 64  scopeid 0x0<global>
        inet6 fd02::76a  prefixlen 128  scopeid 0x0<global>
        inet6 fe80::5399:857f:dd31:867d  prefixlen 64  scopeid 0x20<link>
        inet6 fd02::940b:e7cd:38f0:55bd  prefixlen 64  scopeid 0x0<global>
        ether 76:ca:5e:be:5a:f4  txqueuelen 1000  (Ethernet)
        RX packets 73011  bytes 10568786 (10.0 MiB)
        RX errors 0  dropped 3  overruns 0  frame 0
        TX packets 903  bytes 80931 (79.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 24  

 $ ping www.baidu.com -I eth0
  • 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 iperf3 tool on your host PC. Maybe you can get it by $ sudo apt-get update, and $ sudo apt-get install iperf3
    • At the Debian terminal, execute the command, $ iperf3 -s
    • At the Host Linux terminal, execute the command, $ iperf3 -c 192.168.2.121
Ethernet Test Result
  • ROCK 4 Debian
root@rockpi-4b:/home/rock# iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.2.11, port 54874
[  5] local 192.168.2.121 port 5201 connected to 192.168.2.11 port 54876
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec   112 MBytes   937 Mbits/sec                  
[  5]   1.00-2.00   sec   112 MBytes   941 Mbits/sec                  
[  5]   2.00-3.00   sec   112 MBytes   941 Mbits/sec                  
[  5]   3.00-4.00   sec   112 MBytes   941 Mbits/sec                  
[  5]   4.00-5.00   sec   112 MBytes   941 Mbits/sec                  
[  5]   5.00-6.00   sec   112 MBytes   941 Mbits/sec                  
[  5]   6.00-7.00   sec   112 MBytes   940 Mbits/sec                  
[  5]   7.00-8.00   sec   112 MBytes   941 Mbits/sec                  
[  5]   8.00-9.00   sec   112 MBytes   941 Mbits/sec                  
[  5]   9.00-10.00  sec   112 MBytes   941 Mbits/sec                  
[  5]  10.00-10.00  sec   100 KBytes   783 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.00  sec  1.10 GBytes   941 Mbits/sec                  receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
  • Host Linux
$ iperf3 -c 192.168.2.121 
Connecting to host 192.168.2.121, port 5201
[  4] local 192.168.2.11 port 54876 connected to 192.168.2.121 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec   112 MBytes   940 Mbits/sec    0    192 KBytes       
[  4]   1.00-2.00   sec   112 MBytes   941 Mbits/sec    0    212 KBytes       
[  4]   2.00-3.00   sec   112 MBytes   942 Mbits/sec    0    223 KBytes       
[  4]   3.00-4.00   sec   112 MBytes   941 Mbits/sec    0    249 KBytes       
[  4]   4.00-5.00   sec   112 MBytes   942 Mbits/sec    0    262 KBytes       
[  4]   5.00-6.00   sec   112 MBytes   940 Mbits/sec    0    288 KBytes       
[  4]   6.00-7.00   sec   112 MBytes   941 Mbits/sec    0    304 KBytes       
[  4]   7.00-8.00   sec   112 MBytes   941 Mbits/sec    0    304 KBytes       
[  4]   8.00-9.00   sec   112 MBytes   942 Mbits/sec    0    304 KBytes       
[  4]   9.00-10.00  sec   112 MBytes   941 Mbits/sec    0    304 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  1.10 GBytes   941 Mbits/sec    0             sender
[  4]   0.00-10.00  sec  1.10 GBytes   941 Mbits/sec                  receiver

iperf Done.

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 4, the WiFi connection is another good choice. ROCK 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 iperf3.
WiFi Test Result
  • ROCK 4 Debian
root@rockpi-4b:/home/rock# ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.103  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::4c2b:5ab6:dcae:8318  prefixlen 64  scopeid 0x20<link>
        ether 14:13:33:51:ca:f9  txqueuelen 1000  (Ethernet)
        RX packets 307249  bytes 454343058 (433.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 26551  bytes 1757158 (1.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@rockpi-4b:/home/rock# iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.1.100, port 58146
[  5] local 192.168.1.103 port 5201 connected to 192.168.1.100 port 58147
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  18.9 MBytes   158 Mbits/sec                  
[  5]   1.00-2.00   sec  22.0 MBytes   184 Mbits/sec                  
[  5]   2.00-3.00   sec  22.7 MBytes   190 Mbits/sec                  
[  5]   3.00-4.00   sec  22.8 MBytes   191 Mbits/sec                  
[  5]   4.00-5.00   sec  22.5 MBytes   189 Mbits/sec                  
[  5]   5.00-6.00   sec  22.0 MBytes   184 Mbits/sec                  
[  5]   6.00-7.00   sec  20.4 MBytes   171 Mbits/sec                  
[  5]   7.00-8.00   sec  21.9 MBytes   184 Mbits/sec                  
[  5]   8.00-9.00   sec  21.7 MBytes   182 Mbits/sec                  
[  5]   9.00-10.00  sec  21.5 MBytes   180 Mbits/sec                  
[  5]  10.00-10.00  sec  86.3 KBytes   237 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.00  sec   216 MBytes   181 Mbits/sec                  receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

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

  • Host Linux
% iperf3 -c 192.168.1.103
Connecting to host 192.168.1.103, port 5201
[  5] local 192.168.1.100 port 58147 connected to 192.168.1.103 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  19.0 MBytes   159 Mbits/sec                  
[  5]   1.00-2.00   sec  21.9 MBytes   184 Mbits/sec                  
[  5]   2.00-3.00   sec  22.7 MBytes   190 Mbits/sec                  
[  5]   3.00-4.00   sec  22.8 MBytes   191 Mbits/sec                  
[  5]   4.00-5.00   sec  22.5 MBytes   188 Mbits/sec                  
[  5]   5.00-6.00   sec  22.0 MBytes   185 Mbits/sec                  
[  5]   6.00-7.00   sec  20.4 MBytes   171 Mbits/sec                  
[  5]   7.00-8.00   sec  22.0 MBytes   184 Mbits/sec                  
[  5]   8.00-9.00   sec  21.7 MBytes   182 Mbits/sec                  
[  5]   9.00-10.00  sec  21.5 MBytes   180 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.00  sec   216 MBytes   181 Mbits/sec                  sender
[  5]   0.00-10.00  sec   216 MBytes   181 Mbits/sec                  receiver

iperf Done.

Using Bluetooth

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 bluetooth service

 $ systemctl status bluetooth

Run bluetooth service

 $ systemctl start bluetooth

Check bluetooth 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 Bluetooth 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.

Work with PCIe M.2 NVME SSD

Before supplying power for ROCK 4 board, connect a Samsung EVO 960 SSD to ROCK 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.

HDMI

Enable hotplug

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

DP

ROCK Pi 4C supports HDMI and DP at the same time.

Hardware configuration

Fan

To control ROCK 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

Raspberry Pi 7 Inch LCD Screen

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

CPU Overclocking

ROCK 4 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.

Radxa Display 10HD

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

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
#intfc:dtoverlay=spi1-flash
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

Applications

OpenGL ES Test

Use glmark2-es2

glmark2-es2 is out of box.

rock@rockpi-4b:~$ glmark2-es2 
arm_release_ver of this libmali is 'r18p0-01rel0', rk_so_ver is '4'.=======================================================
    glmark2 2021.02
=======================================================
    OpenGL Information
    GL_VENDOR:     ARM
    GL_RENDERER:   Mali-T860
    GL_VERSION:    OpenGL ES 3.2 v1.r18p0-01rel0.5cb5681058e8e076ff89747c20c32578
=======================================================
[build] use-vbo=false: FPS: 59 FrameTime: 16.949 ms
[build] use-vbo=true: FPS: 60 FrameTime: 16.667 ms
[texture] texture-filter=nearest: FPS: 60 FrameTime: 16.667 ms
[texture] texture-filter=linear: FPS: 60 FrameTime: 16.667 ms
[texture] texture-filter=mipmap: FPS: 60 FrameTime: 16.667 ms
[shading] shading=gouraud: FPS: 60 FrameTime: 16.667 ms
[shading] shading=blinn-phong-inf: FPS: 60 FrameTime: 16.667 ms
[shading] shading=phong: FPS: 60 FrameTime: 16.667 ms
[shading] shading=cel: FPS: 60 FrameTime: 16.667 ms
[bump] bump-render=high-poly: FPS: 60 FrameTime: 16.667 ms
[bump] bump-render=normals: FPS: 60 FrameTime: 16.667 ms
[bump] bump-render=height: FPS: 60 FrameTime: 16.667 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 60 FrameTime: 16.667 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 60 FrameTime: 16.667 ms
[pulsar] light=false:quads=5:texture=false: FPS: 60 FrameTime: 16.667 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 60 FrameTime: 16.667 ms
[desktop] effect=shadow:windows=4: FPS: 60 FrameTime: 16.667 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 30 FrameTime: 33.333 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 30 FrameTime: 33.333 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 30 FrameTime: 33.333 ms
[ideas] speed=duration: FPS: 60 FrameTime: 16.667 ms
[jellyfish] <default>: FPS: 60 FrameTime: 16.667 ms
[terrain] <default>: FPS: 30 FrameTime: 33.333 ms
[shadow] <default>: FPS: 60 FrameTime: 16.667 ms
[refract] <default>: FPS: 59 FrameTime: 16.949 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 60 FrameTime: 16.667 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 60 FrameTime: 16.667 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 60 FrameTime: 16.667 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 60 FrameTime: 16.667 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
=======================================================
                                  glmark2 Score: 56 
=======================================================
Use glmark2-es2-drm

If there is no tool glmark2-es2, you can build one from source code.

Here is the example of building glmark2-es2-drm.

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
Test OpenGL via glmark2-es2-drm

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

And run the following commands:

 $ glmark2-es2-drm

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

Use Go

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

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

Use 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