Get HDMI Output From Your Rock64 Using Armbian

by onehandclappin in Circuits > Linux

3754 Views, 2 Favorites, 0 Comments

Get HDMI Output From Your Rock64 Using Armbian

coverrock64.png

You're probably here after google searches for "Rock64 no hdmi output" pointed you in this direction.

Or you could be wondering how to use the 16 x 2 screen that came with a purchase that seemed to good to be true:

"For $10-$20, a Single Board Computer that rivals a Pi 3B+, ugly case, plus a power adapter, LCD screen and 16 gb micro sd card."

whah?....

This instructable will assist both endeavors. It will establish a path to an OS that will allow the HDMI to be recognized by your monitor. After that, it will enable you to also use 95 percent of the goodies that came with the offer that seemed to be a great idea at the time.

A little background: There is some history with these boards. We are getting these boards at a low cost because we are not the first purchasers. In fact, we are really the third or fourth owner of these so our expectations should be set accordingly. Many of us that purchased these boards were hoping things wold work right out of the box - and they didn't.

So now what? .... If you have "Caveat Emptor" voices in your head, - I have limited good news - but what could be really frustrating is the lack of support for these boards.

And that is why this instructable is being offered: To get you up and running with the HDMI first, and as a bonus, we can also plug and play with the LCD screen using some borrowed code I found on a different website.

Supplies

What is needed: Almost everything that came in the bundle of well packaged, liquidated surveillence equipment of no joy, a micro sd to usb connector, some knowledge with etcher software or creating an image on to a micro sd card, some patience, 4 female to female jumper wires.

What is not needed: You can take that female header with the four wires connecting to the I2C board and throw it in the trash.

No soldering! yeah!

Dis-assemble

We are going to dis-assemble the contents of the packaging by removing the SBC from it's case by unscrewing the 4 tiny screws that keeps the board secured, and the additional tiny-er screws that keep the lcd secured to the case. I only had two tiny-er screws for the lcd, you may have more.

Now carefully dislodge the LCD header from the GPIO pins of the rock 64, and also gently pull the four cables from the I2C connector that are labeled "GND", "VCC", "SDA", and "SCL". I don't know of any way to reuse this piece but we will be using 4 different pins, so we can discard the female header with wires.

We will also want to remove the SD card from the SBC. I ordered two boards, one had a 16gb card as advertised, and one had an 8gb card.

At that point i started to wonder a few things about these.....

Download Armbian Ubuntu Legacy Kernel

armbian1.png
bionic.png

Don't even try to run the software as received! Let's take out the sd card, and reformat it to load a brand new OS (operating system) on the board. Many of the reviews I read for these stated there was no issue loading a new OS such as DietPi or Manjarro, and HDMI worked out of the gate. I wasn't as fortunate. I was 0 for 2.

But there is good news. The legacy version of Armbian Ubuntu (kernel 4.4) will work - and as long as we don't update the kernel, we should be allowed to use the display configuration provided by that kernel. So, reformat the SD card and let's download the Legacy OS (Use the Ubuntu - Bionic - Desktop on legacy BSP version) from this site:

https://wiki.pine64.org/index.php/ROCK64_Software_Release#Armbian

Note: user = root

Password = 1234

Burn the New Image Using Etcher

8_Use_Etcher_to_burn_resinOS_managed_image_to_SD_card.png

You are probably already familiar with using etcher to download and install images if you have owned a SBC before. This step is a requirement, so it should be mentioned, but if this is brand new to you - you will need to install etcher on your desktop machine and use Etcher to burn the image to the SD card that is affixed to a Micro SD to USB card adapter that is connected to your desktop/laptop.

Once Etcher has validated the image file creation, safely eject your micro sd card from your machine, place it back on the Rock64, attach your keyboard, mouse, HDMI cable and ethernet cable. Plug in the power cord and keep your fingers crossed.

Hey, Look at That! - Something Besides "HDMI Out of Range"

I did not take any screenshots of this sequence of steps (how could i?), but If I recall, the new image dropped me off at a command line, and not the desktop. The screen looked frozen until I hit enter, and then I had to change the root password to a non dictionary name, add a new user, (my new user is named pi), and make some local configuration options before proceeding further. Armbian made some localization options for me already that I just needed to confirm.

In my wild excitement of seeing an actual desktop for the first time, I did not take good notes here.

Alter Settings-Display Customize Our Desktop

screenshot1.png
screenshot2.png
screenshot3.png

Now that we have a desktop to configure, let's make some basic optimizations. To change the display resolution, from the main menu - choose Settings-Display and then alter our resolution to 1920 x 1080. This will make our desktop look a little more crisp. From here, change the wallpaper, font, theme and all other preferences to your liking.

If you feel like you really just want to run a headless server, I believe there are some options in Armbian-config to disable the desktop.

Prepare Armbian for LCD Display - and Armbian Config

Start preparation for the LCD display by installing some necessary packages. From the command line type:

sudo apt-get update --fix-missing
sudo apt-get install i2c-tools

and now that python3 is the norm, we also have to configure smbus:

sudo apt-get install python-smbus 
sudo apt-get install python3-smbus 

some configuration changes:

Using the command:

sudo armbian-config

Armbian-Config

armbian_config2.png
armbian_config3.png

We can make some hardware configurations to allow I2C and SPI from the hardware options, under System - Hardware Configuration

And While We're Here - Other Configurations: Go back 1 step to the previous screen, and make some personal changes. Make sure we have the correct time zone and language configured, and I always like to alter my hostname so I can identify the equipment on my network easily.

I usually have some raspberry pi's playing music at all times.

Exit out of the configuration section, and reboot if necessary.

Reconnect the I2C Display

I2c_wires.jpg
pinoutxyzpi.png

Even though the board came with 4 wires included on the header, and is obviously not a Raspberry Pi, we are going to re-wire it as if it was. I know, it makes little sense to me either, but it will work. Using the pinouts for the Raspberry pi schematic, we are going to connect VCC to Pin #2 or 4, SDA to Pin #3, SCL to Pin #5, and finally Ground to Pin # 6. Please note I was using Pi Pins, not the GPIO pin numbers.

Why Reinvent the Wheel ? - Lets Use Existing Code

cblink.png


This step is by far the most important. But I cannot honestly take credit for it. I can include the link though - https://www.circuitbasics.com/raspberry-pi-i2c-lcd-set-up-and-programming/

Borrow some python code. Make sure you create the I2C_LCD_driver.py in your local machine using the code provided. You can even download all the files needed from there.

Don't forget to ensure you have the library moved over to the Rock64.

Towards the bottom of the tutorial will be some sample python scripts. Even if you have 0 familiarity with python code, the scripts are simple to read and will be excellent snippets of code to get us on our way. I recommend using all the information provided here, and develop as many scripts as you fee are necessary.

Detect Our I2C

armbian_i2cdetect.png
detect1b.png


Inside the library from the previous step are references and addresses that we will have to modify.

run the following code to determine what the address for our display is:

sudo i2cdetect -y 0

In my case, I noticed the reference to 3f, so I will note that, and change the LCD address in the library configuration file accordingly.

Please click on each image to expand the image to notice the location and address.

Install Idle - Optional

We probably can work in python using the terminal window, but just in case we want to really make some cool things using python in the future, it would be great to have a shell window to work from.

 sudo apt-get install idle

Idle will add itself to our menu bar called development.

Let's Test


Still in our terminal window, we can test our work thus far: using the sample file provided by either the Circuit Basics link, or the attachment provided here, Test our first run: (Circuit Basics file name is "hello.py")

sudo python3 cbhello.py

"Hello World" should be displaying on our screen - congratulations!

Ctrl-C will stop the python code, and return the command prompt.

Just seeing a blue screen still? Your contrast settings may be too low. Take a small philips head screw driver and slightly turn the pot on the back of the I2C screen board to adjust your contrast up a bit. Same goes true, but directionally opposite if you can see "Hello World", but it appears behind blocks.

Check your terminal for any python error messages.

Downloads

Now Freeze!

armbian_config.png


Almost done, Just some clean up work from here. Remember we are using an older kernel version. Updating our software should pose as no risk, however updates to the firmware can spell disaster. Freeze our system from further firmware upgrades by revisiting:

sudo armbian-config

- this time to lock the system down from allowing upgrades. You will notice my screenshot was taken after I froze the upgrades (See "defreeze" - and the background is red vs. blue after the freeze). I can always Defreeze, however I strongly recommend we avoid this temptation. For giggles, I upgraded the firmware just to see what would happen, and as expected, bad things happened to my X11 folder. I had to start over from scratch, not just a simple undo.

Dremelize Access for the HDMI, Re-assemble

dremel1.png

Do you have a dremel lying around? The plastic on the case is pretty thin, and dremilizing an hdmi port is quite easy. I would imagine a good, sharp pair of scissors would also make short work of creating a hole for the hdmi cable. Due to the angle of the port to the case, you have to leave extra room for the width of the cable cord. If you screw this step up, no worries as the case is, how do i put this nicely? - unattractive?

One of the nicest attributes of the board that is not widely touted is the audio quality. I drilled a hole large enough to snake a 3.5mm audio jack through the case, not too far away from my hdmi cutout. I don't find it necessary to attach a hat or dac/hat as the audio out of the jack is very good quality.

In the opposite direction that we dis-assembled the case, re-assemble the board and screen to the case. Our work is done here.

Conclusion

After attempting to try various other Operating Systems, I am more than content with Armbian. In fact, I was pleased with the initial setup and configuration, and compared to the equivalent of initializing a pi, Armbian seemed a little more intuitive. I also attempted (real) Debian, but that seemed to bog the board down, and a few other OS's that I wont mention because they just would not work.

Armbian seems to be the Rodney Dangerfield of Linux OS's, (even Distro Watch gives them the cold shoulder), but I am starting to really enjoy it.

While I have no displeasure with the rock64, it will take me some time before I trust buying another board on a whim again though.

Hopefully this got you out of a bind, and you're on your way to developmental bliss.

-special Thanks to Scott Campbell at Circuit Basics for your excellent work!