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__ ===...")
 
 
(4 intermediate revisions by 2 users not shown)
Line 6: Line 6:
  
 
__TOC__
 
__TOC__
 +
 +
== This page is currently out-dated ==
 +
 +
With the new system release, the existing documentations are out of date. We are currently in the process of updating the documentation, so please only taking the rest of this page as a general guideline.
 +
 +
Some key differences are:
 +
 +
* The default account is now '''radxa/radxa'''
 +
* SSH is disabled by default.
 +
This setting can be overridden by first flash the image to microSD card, then edit '''before.txt''' in '''config''' partition on your microSD card, and add <code>enable_service ssh</code> at end of the file.
 +
* Bluetooth firmware are now included.
 +
* You can use '''rsetup''' to manage overlays.
 +
 +
== How to use Debian ==
  
 
=== Introduction of ROCK 4 Debian ===
 
=== Introduction of ROCK 4 Debian ===
Line 11: Line 25:
 
[[File:debian11-desktop.png | 800px ]]
 
[[File:debian11-desktop.png | 800px ]]
  
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 is an easy to use desktop system. While working with ROCK 4 Debian, you will find it do well on playing music, Internet, BT, AI and so on.
  
 
ROCK 4 Debian uses systemd to manage system.
 
ROCK 4 Debian uses systemd to manage system.
Line 85: Line 99:
 
   $ 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 201:
 
   $ 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
 
  ------------------------------------------------------------
 
  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 Bluetooth ===
+
<pre>
 +
% 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
  
Follow the [https://wiki.radxa.com/Rockpi4/radxa-apt#Introduction Guide of Radxa APT] to add Radxa APT.
+
iperf Done.
 +
</pre>
  
We suggest that you add '''stretch-testing''' APT Source to get the newest packages.
+
=== Use BT ===
  
Install packages:
+
Related packages:
 +
 +
$ sudo  apt-get install -y broadcom-wifibt-firmware
  
  $ sudo apt-get install -y broadcom-wifibt-firmware
+
Check BT service
  
Check bluetooth service
+
$ sudo systemctl status bluetooth
  
  $ systemctl status bluetooth
+
Run BT service
  
Run bluetooth service
+
$ sudo  systemctl start bluetooth
  
  $ systemctl start bluetooth
+
Check BT device
  
Check bluetooth device
+
<pre>
 +
rock@rockpi-4b:~$ sudo hciconfig -a
 +
[sudo] password for rock:
 +
hci0: Type: Primary  Bus: UART
 +
BD Address: E8:FB:1C:F5:5E:C2  ACL MTU: 1021:8  SCO MTU: 64:1
 +
UP RUNNING
 +
RX bytes:1954 acl:0 sco:0 events:68 errors:0
 +
TX bytes:3369 acl:0 sco:0 commands:68 errors:0
 +
Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
 +
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
 +
Link policy: RSWITCH SNIFF
 +
Link mode: SLAVE ACCEPT
 +
Name: 'rockpi-4b'
 +
Class: 0x0c0000
 +
Service Classes: Rendering, Capturing
 +
Device Class: Miscellaneous,
 +
HCI Version: 4.2 (0x8)  Revision: 0x0
 +
LMP Version: 4.2 (0x8)  Subversion: 0x6119
 +
Manufacturer: Broadcom Corporation (15)
  
  $ hciconfig
+
</pre>
  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
+
Example: Connect to BT Speaker
  
Run pulseaudio, otherwise ROCK Pi 4 will not be able to connect to device.
+
Run pulseaudio, otherwise ROCK 4 will not be able to connect to device.
  
 
   $ pulseaudio --start
 
   $ pulseaudio --start
Line 181: Line 315:
 
Connect using bluetoothctl
 
Connect using bluetoothctl
  
   # bluetoothctl  
+
   # bluetoothctl
   [NEW] Controller 43:45:C5:00:1F:AC linaro-alip [default]
+
 
 +
  Agent registered
 +
   [CHG] Controller E8:FB:1C:F5:5E:C2 Pairable: yes
 
    
 
    
 
   [bluetooth]# default-agent  
 
   [bluetooth]# default-agent  
Line 225: Line 361:
 
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 371:
  
 
* 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 389:
 
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 ===
  
Enable hotplug
+
ROCK 4 Supports HDMI 4K.
$ sudo chmod +x /usr/local/bin/drm-hotplug.sh
+
  
 
=== DP ===
 
=== DP ===
  
 
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 423:
 
</pre>
 
</pre>
  
=== <span id="gpio">General purpose input-output (GPIO) </span> ===
+
====Raspberry Pi 7 Inch Touchscreen====
 +
 
 +
 +
 
 +
====CPU Overclocking====
 +
 
 +
 +
 
 +
====MIPI CSI Camera====
 +
 
 +
 +
 
 +
==== 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 449:
 
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 496:
 
  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 502:
 
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
 +
 
 +
==== Audio Test ====
 +
 
 +
 
 +
==== 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

Latest revision as of 07:16, 24 March 2023

    ROCK 4 >  Development >  How to use Debian

This page is currently out-dated

With the new system release, the existing documentations are out of date. We are currently in the process of updating the documentation, so please only taking the rest of this page as a general guideline.

Some key differences are:

  • The default account is now radxa/radxa
  • SSH is disabled by default.

This setting can be overridden by first flash the image to microSD card, then edit before.txt in config partition on your microSD card, and add enable_service ssh at end of the file.

  • Bluetooth firmware are now included.
  • You can use rsetup to manage overlays.

How to use Debian

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, BT, 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.

Use BT

Related packages:

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

Check BT service

$ sudo systemctl status bluetooth

Run BT service

$ sudo  systemctl start bluetooth

Check BT device

rock@rockpi-4b:~$ sudo hciconfig -a
[sudo] password for rock: 
hci0:	Type: Primary  Bus: UART
	BD Address: E8:FB:1C:F5:5E:C2  ACL MTU: 1021:8  SCO MTU: 64:1
	UP RUNNING 
	RX bytes:1954 acl:0 sco:0 events:68 errors:0
	TX bytes:3369 acl:0 sco:0 commands:68 errors:0
	Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
	Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
	Link policy: RSWITCH SNIFF 
	Link mode: SLAVE ACCEPT 
	Name: 'rockpi-4b'
	Class: 0x0c0000
	Service Classes: Rendering, Capturing
	Device Class: Miscellaneous, 
	HCI Version: 4.2 (0x8)  Revision: 0x0
	LMP Version: 4.2 (0x8)  Subversion: 0x6119
	Manufacturer: Broadcom Corporation (15)

Example: Connect to BT Speaker

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

 $ pulseaudio --start

Connect using bluetoothctl

 # bluetoothctl
 Agent registered
 [CHG] Controller E8:FB:1C:F5:5E:C2 Pairable: yes
 
 [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

ROCK 4 Supports HDMI 4K.

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 Touchscreen

CPU Overclocking

MIPI CSI Camera

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

Audio Test

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