The goal of the document is to demonstrate how to connect to SP7021 boards using VNC server from a remote Linux machine. VNC connection consists of two portions. One is VNC server which is installed and run on an SP7021 board. The other is VNC viewer which is installed and run on a remote Linux machine. After installing and building VNC connection, you can connect to SP7021 board and see its desktop and control it from the remote Linux machine (VNC viewer).

To build VNC connection, you need to:

  1. Install Raspbian on SP7021 board.

  2. Install and run VNC server on SP7021 board.

  3. Install and run VNC viewer on a remote machine.

Please follow the following steps to build VNC connection.

1. Install Raspbian on SP7021 board

Refer to How to build and install SP7021 Linux image to run Raspbian on SD card for installing Raspbian on an SP7021 board.

2. Install TightVNC server on SP7021 board

Before installing VNC server, please run apt update and apt upgrade commands to upgrade Raspbian to the latest. For example,

pi@raspberrypi:~$ sudo apt update
pi@raspberrypi:~$ sudo apt upgrade

Then, run apt install tightvncserver command to install TightVNC server. Refer to log captured when TightVNC server was installing below:

pi@raspberrypi:~$ sudo apt install tightvncserver
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  fontconfig-config fonts-dejavu-core libdrm-amdgpu1 libdrm-common
  libdrm-nouveau2 libdrm-radeon1 libdrm2 libfontconfig1 libfontenc1 libgl1
  libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libice6
  libllvm9 libsensors-config libsensors5 libsm6 libx11-xcb1 libxaw7
  libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-shape0
  libxcb-sync1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxft2
  libxi6 libxinerama1 libxmu6 libxpm4 libxrandr2 libxrender1 libxshmfence1
  libxt6 libxtst6 libxv1 libxxf86dga1 libxxf86vm1 x11-common x11-utils
  x11-xserver-utils xfonts-base xfonts-encodings xfonts-utils
Suggested packages:
 :
 :
 :
Processing triggers for libc-bin (2.28-10+rpi1) ...
Processing triggers for systemd (241-7~deb10u5+rpi1) ...
Processing triggers for man-db (2.8.5-2) ...
pi@raspberrypi:~$

TightVNC was installed successfully.

3. Run VNC server

Run vncserver command as shown below, where command-line option -geometry 1080x720 sets width and height of display frame-buffer of VNC server. When vncserver is running, it will ask you to enter your password for VNC viewer. It also asks if you need to set password especially for view-only.

pi@raspberrypi:~$ vncserver -geometry 1080x720

You will require a password to access your desktops.

Password: 
Verify:   
Would you like to enter a view-only password (y/n)? n
xauth:  file /home/pi/.Xauthority does not exist

New 'X' desktop is raspberrypi:1

Creating default startup script /home/pi/.vnc/xstartup
Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/raspberrypi:1.log

pi@raspberrypi:~$

New X desktop was created. Display number is 1. Default startup script, ~/.vnc/xstartup, and authentication for X session, ~/Xauthority, were created.

4. Install TightVNC viewer on a remote machine

At remote machine, you need to install VNC viewer. For example, in a Linux/Ubuntu machine, you can run apt install xtightvncviewer command to install TightVNC viewer. Refer to log captured when TightVNC viewer was installing below:

wells@wells-linux:~$ sudo apt install xtightvncviewer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  tightvncserver
The following NEW packages will be installed:
  xtightvncviewer
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 55.6 kB of archives.
After this operation, 172 kB of additional disk space will be used.
Get:1 http://tw.archive.ubuntu.com/ubuntu focal/universe amd64 xtightvncviewer amd64 1.3.10-0ubuntu5 [55.6 kB]
Fetched 55.6 kB in 0s (390 kB/s)         
Selecting previously unselected package xtightvncviewer.
(Reading database ... 218639 files and directories currently installed.)
Preparing to unpack .../xtightvncviewer_1.3.10-0ubuntu5_amd64.deb ...
Unpacking xtightvncviewer (1.3.10-0ubuntu5) ...
Setting up xtightvncviewer (1.3.10-0ubuntu5) ...
update-alternatives: using /usr/bin/xtightvncviewer to provide /usr/bin/vncviewer (vncviewer) in auto mode
Processing triggers for man-db (2.9.1-1) ...
wells@wells-linux:~$

TightVNC viewer was installed successfully.

5. Run TightVNC viewer to connect to SP7021 board

Refer to log below, run vncviewer command.

wells@wells-linux:~$ vncviewer &
[1] 6436
wells@wells-linux:~$ 

When vncviewer is running, a serverDiaglog window will pop up. It asks you enter host name or IP address VNC server. Please enter host name or IP address of your SP7021 board.

Then, enter password (the password you set in step 3).

Once you enter password, VNC viewer starts to connect to VNC server. Refer to log captured when vncviewer is connecting to VNC server below:

Connected to RFB server, using protocol version 3.8
Enabling TightVNC protocol extensions
Performing standard VNC authentication
Authentication successful
Desktop name "pi's X desktop (raspberrypi:1)"
VNC server default format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Warning: Cannot convert string "-*-helvetica-bold-r-*-*-16-*-*-*-*-*-*-*" to type FontStruct
Using default colormap which is TrueColor.  Pixel format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0

VNC viewer connects to VNC server successfully. 32-bit (per pixel) format is used.

As shown below, soon, we’ll see desktop of SP7021 which is running Raspbian.