VGA output - cubieplayer/Cubian GitHub Wiki

It's possible to let cubieboard output VGA signal.

Circuit


If you bought some daughter board with VGA connector, you can go to the next step. If not, you can build your own circuit.

Cubieboard pin Cubieboard description VGA connector pin
conn. U15 – pin 25 Ground 5,6,7,8,10
conn. U15 – pin 27 VGA – Red 1
conn. U15 – pin 29 VGA – Green 2
conn. U15 – pin 31 VGA – Blue 3
conn. U14 – pin 27 VGA – VSYNC 14
conn. U14 – pin 30 VGA - HSYNC 13
Do not use pins 33 and 35 on connector U15. It is HSYNC and VSYNC for LVDS, not VGA.

Because the HSYNC and VSYNC signals from cubieboard are 3.3V levels, they should be buffered by CMOS gates to 5V levels to reach the VGA specifications, but I found out, that every monitor I have tryed handled 3.3V signals without buffers, directly connected to VGA connector.

Each VGA analog signal (red, green and blue) should be loaded by nominal impedance of VGA. That means 75R resistors connected between color signal and ground. Without them the analog signa is very messy and picture on the monitor is quite ugly like on following photo.

VGA without resistors

That means, the minimal schematic diagram can look like this:

Simple schematic

Much better schematic is on the next picture. The 5V can be found on conn. U15 – pin 1.

Better schematic

Sunxi-tools instalation


Install required packages

apt-get install libusb-1.0-0-dev pkg-config

download the sinxi-tools source and compile it

git clone git://github.com/linux-sunxi/sunxi-tools/
cd sunxi-tools
make

VGA output configuration


Backup the script.bin

cp /boot/script.bin /boot/script.bin.bck

Convert the script.bin into .fex file (text config file)

./bin2fex /boot/script.bin /boot/script.fex

Open the script.fex with some text editor

nano /boot/script.fex

Find the block starting with β€ž[disp_init]β€œ and edit the lines by following values:

  • disp_init_enable: 0 to disable;1 to enable

  • disp_mode: Display mode to use:

    Value Mode
    0 screen0(screen0, fb0)
    1 screen1(screen1, fb0)
    2 two_diff_screen_diff_contents(screen0, screen1, fb0, fb1)
    3 two_same_screen_diff_contents(screen0, screen1, fb0)
    4 two_diff_screen_same_contents(screen0, screen1, fb0)
  • screen0_output_type: Output type for screen0:

    Value Type
    0 none
    1 lcd
    2 tv
    3 hdmi
    4 vga
  • screen1_output_type: Output type for screen1: same as previous

  • screen0_output_mode: Output mode for screen0:

    Mode Used for tv/hdmi output Used for vga output
    0 480i 1680*1050
    1 576i 1440*900
    2 480p 1360*768
    3 576p 1280*1024
    4 720p50 1024*768
    5 720p60 800*600
    6 1080i50 640*480
    7 1080i60
    8 1080p24
    9 1080p50
    10 1080p60 1920*1080
    11 pal 1280*720
    14 ntsc
  • screen1_output_mode: Output mode for screen1: same as previous

  • fb0_framebuffer_num: fb0 buffer number, use 2 for double buffering

  • fb1_framebuffer_num: fb1 buffer number, use 2 for double buffering

  • fb0_format: pixel format for fb0:

    Value Format
    4 RGB655
    5 RGB565
    6 RGB556
    7 ARGB1555
    8 RGBA5551
    9 RGB888
    10 ARGB8888
    12 ARGB4444
  • fb1_format: pixel format for fb1: same as previous

  • fb0_pixel_sequence: fb0 pixel sequence (0 generally for linux, 2 for android):

    Value Sequence
    0 ARGB
    1 BGRA
    2 ABGR
    3 RGBA
  • fb1_pixel_sequence: fb1 pixel sequence (0 generally for linux, 2 for android): same as previous

  • fb0_scaler_mode_enable: 0 to disable; 1 to enable

  • fb0_scaler_mode_enable: 0 to disable; 1 to enable

so the part of .fex file can look like this:

[disp_init]
disp_init_enable = 1
disp_mode = 0
screen0_output_type = 4
screen0_output_mode = 4
screen1_output_type = 2
screen1_output_mode = 14
fb0_framebuffer_num = 2
fb0_format = 10
fb0_pixel_sequence = 0
fb0_scaler_mode_enable = 1
fb1_framebuffer_num = 2
fb1_format = 10
fb1_pixel_sequence = 0
fb1_scaler_mode_enable = 1

It is configured for vga output with resolution 1024x768 on screen0 with framebuffer tb0 double buffered. The screen1 is disabled by β€ždisp_mode=0β€œ and screen1 parameters are ignored.

Convert the edited script.fex back into .bin file

./fex2bin /boot/script.fex /boot/script.bin

Turn of the cubieboard

shutdown –h now

and then disconnect the powerplug for a few seconds and connect it back. Now you should see the booting cubian system on your VGA monitor.

Useful links


Fex Guide: http://linux-sunxi.org/Fex_Guide#.5Bdisp_init.5D

Sunxi-tools: http://linux-sunxi.org/Sunxi-tools#Building

Forum thread about vga: http://www.cubieforums.com/index.php/topic,104.0.html

Other vga tutorial: http://taqlim.blogspot.de/2013/04/vga-out-for-cubieboard.html