Orange PI HowTo: Set It Up to Use With a 5" HDMI TFT LCD Display

2,973

13

2

Published

Introduction: Orange PI HowTo: Set It Up to Use With a 5" HDMI TFT LCD Display

If You were prudent enough to order an HDMI TFT LCD Display together with Your Orange PI, You are probably discouraged by the difficulties in trying to force it to work. While others could even not note any obstacles. The key is that there are at least two (may be more) different types of those display on the market. They look very similar to each other and one may miss any difference.

Here are both:
The one to the left of the picture is the "good" one. Its installation was easy and straightforward. The one to the right is the "bad" one. Its set up was much more complicated.

There is almost no difference between the good one and the "bad" one, excluding maybe that the bad one is signed as "Rev3.0" (revision 1) and the good is signed as "Rev2" (revision 2) or "v2".

REQUISITES:

  1. Orange PI with Linux bootable SD card. (The orange PI Official Site has the instructions how to make one: http://www.orangepi.org/Docs/SDcardinstallation.html and with proper power supply.
  2. Desktop Comuter (Windows running)
  3. HDMI cable
  4. USB to mini-usb cable
  5. Working copy of the fexc.exe utility.

It's good if Your Linux image keeps its setup file (script.bin) on a FAT partition of Your flash card. If not - You will be to find a way how to scavenge it from ext2 Linux partition to Your Windows desktop all by Yourselves.

Step 1: Decide the Model

When Your display has arrived, first of all check the inscription on it's back side.

  • If You can find there a "Rev3.0" follow {REV 3} sections in the steps below.
  • If there is "Rev 2" mark, then follow the {REV 2} sections.

After You've decided the model of Your TFT display You may proceed with assembling Your Orange PI based computer.

Step 2: ​Connect the Your OPI

Connect the Orange PI board with the display by means of HDMI cable. Connect one of Your Orange PI's USB ports to the USB port of Your display by means of USB-to-mini-USB cable.

It is probably not a good idea to try to put the display onto the GPIO port. The geometry of the Orange PI differs from the one of Raspberry PI and the displays well suited for the latter may not suit for the first. In unlucky case You may even crackle some part or do some other bad thing if keep trying. In any case - forget to use this nice U-shaped HDMI-to-HDMI adapter, that accompanies Your display, the geometries of the Orange PI board and of the Display just does not allow that.

Step 3: Convert BIN to FEX

Take Your Orange PI Linux bootable flash card and plug it in Your Windows desktop PC using some proper adaptor. Then find "script.bin" file on the flash card and copy it to a good place on Your desktop PC's hard disk. E.g. to the c:\stool\ folder.

Copy the operational sample of fexc.exe utility together with fex2bin.bat and bin2fex.bat files to the same folder, where You've placed the script.bin. (Refer to my previous instructable to find a way where to get the infamous fexc.exe)

Decrypt the script.bin to text form (script.fex) by running bin2fex.bat command file.

If You are using You orange PI for a time already, it means You have properly configured processor and memory clocks. So You may proceed directly to the step 5. If You are using the Orange PI for the first time - take time to set the proper and safe speeds for the processor and memory.

Step 4: Prepare Safe Script.fex

Check the [target], [dvfs_table] and [dram_para] sections of the (text) script.fex file. Make sure that the values there do really correspond to the processing power of Your Orange PI board. Reduce the values if needed.
Good (but somewhat slow) starting point is to set

[dvfs_table]<br>max_freq = 1008000000
min_freq = 60000000
lv_count = 5
lv1_freq = 1056000000
lv1_volt = 1500
lv2_freq = 1008000000
lv2_volt = 1400
lv3_freq = 912000000
lv3_volt = 1350
lv4_freq = 864000000
lv4_volt = 1300
lv5_freq = 624000000
lv5_volt = 1250

And to set

dram_clk = 624

in [dram_para] section. In my previous instructable the procedure is described in more details.

Step 5: Configure Display Parameters

{for REV 2}
If You have the "good" model of the display, You may copy/paste (owerwrite) its [disp_init] and [hdmi_para] sections from here:

[disp_init]
disp_init_enable = 1
disp_mode = 0
screen0_output_type = 3
screen0_output_mode = 5
screen1_output_type = 3
screen1_output_mode = 5
fb0_width = 800
fb0_height = 480
fb1_width = 800
fb1_height = 480
 
[hdmi_para]
hdmi_used = 1
hdmi_x = 800
hdmi_y = 480
hdmi_power = "vcc-hdmi-18"
hdmi_cts_compatibility = 1

All credits to Jimmy Belanger - [SOLVED] Orange PI PC H3 Winner, compiled with igorpecovnik jessie desktop

Also make sure that the pll_video parameter in the [clock] section is set to 292:

[clock]
pll_video = 292

{for REV 3}

If You have the "bad" model of the display, You may copy/paste (owerwrite) its [disp_init] and [hdmi_para] sections from here:

[disp_init]
disp_init_enable = 1
disp_mode = 0
screen0_output_type = 3
screen0_output_mode = 2
screen1_output_type = 3
screen1_output_mode = 2
fb0_width = 720
fb0_height = 480
fb0_scaler_mode_enable = 1
fb0_pixel_sequence = 2
fb0_format = 4
fb0_framebuffer_num = 2
fb1_width = 720
fb1_height = 480
fb1_scaler_mode_enable = 1
fb1_pixel_sequence = 2
fb1_format = 4
fb0_framebuffer_num = 2
[hdmi_para]
hdmi_used = 1
hdmi_x = 720
hdmi_y = 480
hdmi_power = "vcc-hdmi-18"
hdmi_cts_compatibility = 1

You will also need to set the pll_video parameter in the [clock] section to 321:

[clock]
pll_video = 321

Step 6: Convert FEX to BIN

We've finished with script.fex, so save it to Your hard disk and exit the text editing software.

Use fex2bin.bat to pack the file back to the binary format. Remember that script.bin usually has "read only" attribute and the fexc utility can not overwrite it automatically.

Step 7: OPI Ready

Plug the 5v power supply to turn on the Orange PI. And now You can see cool image on Your LCD Display.

Step 8: NOTES

  1. Why Am I calling Rev2 as "good" one and Rev3 as "bad" one?
    • Rev 2 has much wider video pll clock capture range. E.g. Rev 2 woks good with a script.bin having been prepared for the Rev3, but Rev 3 will show only a white screen when used with script.bin for the Rev2. And if You begin to vary pll_video parameter You will also note the difference.
    • With Rev2 You can easily get full 800x480 resolution, while with Rev 3 You will get only 720x480
    • Rev2 has nice mounting holes, while Rev3 is difficult to install mechanically.
  2. The settings have a very straightforward logic afterwards. Indeed, Windows determine Rev3 display (by the EDID) as "66 Hz" one. And the vertical resolution of the display is 480 lines. There are only two 480 line modes in OPI settings: mode 0: 480 lines interlaced, and mode 2: 480 lines non-interlaced. So one should just set one of them and adjust the framerate. If pll_video = 292 corresponds to 60 Hz, then 292*66/80 = 320 will be close enough. However it becomes clear only after You've already found the correct settings. Everyone is strong with a back mind...
  3. The "Orange PI", "Windows", "Linux", "Sunxi-Tools", "Allwinner", etc... are the correspondent trademarks of their respective owners.

Share

    Recommendations

    • Make it Move Contest

      Make it Move Contest
    • Planter Challenge

      Planter Challenge
    • Casting Contest

      Casting Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    2 Comments

    Thanks for the writeup. I found the linux sunxi utilities much easier to deal with as I couldn't get fexc.exe to work properly on windows.

    Also I was able to get the "bad" display to work at 800x480 using screen0_output_mode = 5. It doesn't have a piggyback controller though, I'm using an Adafruit tfp401 breakout board.

    Awesome, awesome, awesome - and solved my problem of 'just' enabling the hdmi output on the orange pi. I was able to actually do the work once the device had booted by pulling the tools from 'git clone https://github.com/linux-sunxi/sunxi-tools' rather than using the dos ones. The make failed - but after building the sunxi-fexc - which is all you need. With the fexc you can directly overwrite the bin file using ./sunxi-fexc -vq -I fex -O bin ./a.fex /media/boot/script.bin (I grabbed a source fex using ./sunxi-fexc -vq -I bin -O fex /media/boot/script.bin ./a.fex - and made your changes above).

    Really helpful article and yes - I may well bat out a few other plugged in screens - mine's a cheap HDMI monitor - and the only problem I've had was with the poorly documented fex! Your article had me up and working in no time at all. Brilliant!!!