Updated: December 15, 2017
Something went horribly wrong when I did an update and upgrade of the system on the Orange Pi Zero earlier today. I could no longer connect with the OPiZ. Indeed, it would not even show up as a connected device on the local network. And that was with an Ethernet connection in place.
This seemed like a good occasion to test the debug UART port which is next to the RJ45 connector. At the same time, I could test another CH340G based USB-TTL converter I purchased for next to nothing some time ago. I forget where the device came from but it looks like it is easily obtained from the usual Chinese outlets. The device shows up as
QinHeng Electronics HL-340 USB-Serial adapterin the
It was all very simple to connect and the converter performed without problem. codelectron has posted a blog on the subject back in May 2017 with numerous photographs. There is not much to add if you like PuTTY on a Linux box. I don't.
Instead I first tried
miniterm.py which I had used with
nodeMCU on ESP8266 devices. That was not a good idea,
especially when using configuration utilities or other programs that make use
of ANSI escape codes to draw on the screen in text mode. Next I tried
GNU Screen. If its not already present, it can be
installed with the Ubuntu Software Center or with the
APT package manager. I suggest installing a configuration file in the home
directory that will enable a scroll buffer.
Plug the converter to a USB port on the desktop computer. Connect the
converter to the header pins on the OPiZ which should be disconnected from its
power source. We need to know which TTY port is assigned to the USB-TTL
converter. Try listing all
tty devices. It should show up as
ttyUSB0 or something similar. If there are too many similar names
in the directory, use
dmseg which should show to which port the
ch341-uart converter (or whatever chip your USB-TTL converter
is based on) was attached.
Now that we know the port, launch
screen in the terminal and
THEN power up the OPiZ. Be prepared for a lot of text scrolling in the
terminal window. You will see the typical Linux
boot sequence just as if a physical screen had been connected to the OPiZ.
screen complains about permissions, you can change
/dev/ttyUSB0 permissions, but the much better solution is to
add yourself (well, you as a user) to the
To enter scrolling mode in
screen press the key combination
CtrlA and then the
ESC key. The up/down and PageUp/PageDown
keys will scroll through the buffer. It is possible to select a region of
text with the mouse left button which can then be copied to the system
clipboard by clicking on the right mouse button. Press ESC
button to exit scrolling mode.
To get out of
screen press the key combination
CtrlA and then the
\ key (with the French AZERTY keyboard on my
computer, I produce a "\" with the
Alt Gr8 combination).
I tried an old friend Kermit I first encountered in the 1980s. Here is how I installed and then started the program.
It is possible to start kermit in interactive mode in which to specify the paramters and then connect
Instead of entering that long convoluted command line, or going through the
little interactive session, create a
.kermrc initialization file
containing the following lines and save it in the home directory.
Then launching kermit will automatically connect to the OPiZ.
It is a huge program but simpler to use. In particular, the scroll keys work
as expected, no need to escape to a command mode. To quit the program, first
return to command mode by typing a
Ctrl\ combination and then
C. Again with an AZERTY keyboard the initial combination
is a three key affair CtrlAlt Gr8
to be followed with the single C.
In command mode enter the
If GNU screen and Kermit do not appeal to you then you could try minicom which is what Orange pi recommends. Ultimately, use what you is most comfortable.
No matter which terminal program you use, you may find it much more
convenient than opening an
ssh session. And best of all you do not
need to find the IP address assigned to the Ethernet interface to log in.
Indeed, this may be a quicker way of finding the IP address as it is
displayed on the logon screen. If you missed it,
ifconfig is not there as is the case in the
dietPi version of Armbian.
As for getting
ssh to work on my newly upgraded OPiZ... I
never did figure it out. I just reloaded a recent backup of my SD card.
With Etcher that takes less than 15 minutes, so I was
not willing to spend much time investigating the problem. The second time
around, upgrading the Armbian image went without a hitch.
NOTE: It might prove
impossible to establish a connection with
Kermit as shown below.
If there is no doubt that
/dev/ttyUSB0 is the correct
serial port, this may very well be because a process is using it. In
my case, a session of
screen that I had left hanging
when I closed the terminal in which it was running without quitting the
program was still connected to the port. To get back control
of the port, first the process id (
pid) must be obtained and then
the process can be killed.
Thank you AppBeing Studio for the information.
WARNING: I am not responsible if you loose all your work because you killed the wrong process because of fat fingers, dyslexia or bad luck. Be careful.