Cubieboard/LVDS

= Introduction =

To use a LVDS TFT-LCD display with Cubieboard is very simple job.

There are two main activities do to:


 * 1) Connect the LVDS to Cubieboard.
 * 2) Configure script.bin for LVDS display.

For this example I will use a CHI-MEI G070Y2-L01 800x480 LED backlight TFT-LCD. For other displays there would be different power-supply requirements, LCD I/O pin layouts and script.fex values.

Powersupply
The LCD is a device which require a lot of power to work so we need two extra-power supplies:


 * 1) One at 3.3V to supply LCD main board.
 * 2) One at 12V to supply LCD backlight system.

NB: Often you can't use 3.3V from Cubieboard because the display will typically have a Rush Current of > 1A at startup and Cubieboard can't supply that much power.

Verify all these values with the datasheet of your display. There are displays which only use 5V for the LED power supply (e.g. AUO B089AW01 V1). Using 12V on these displays will destroy them (and potentially the board you connect them to).

Hardware Connections
Generally the following can be said of the hardware connection.
 * 1) The pins VDD, VCC or similar must be connected to 3.3V external supply
 * 2) The pins VDD_LED, VDD_BL or similar must be connected to 5V/12V external backlight supply
 * 3) If there is a backlight PWM pin on the display connect it to PWM channel 0 on the board
 * 4) The pins GND must be connected to both cubieboard and external supply GND


 * 1) Each LVDS lane RX0+/- to RX3+/- and the clock lane RXC+/- must be connected to corrosponding pins on cubieboard

Note for users of other boards: Mapping of LCD-Dx pin names to LVDS pin names is RX0+ = LCD0-D0 RX0- = LCD0-D1 RX1+ = LCD0-D3 RX1- = LCD0-D4 RX2+ = LCD0-D5 RX2- = LCD0-D6 RXC+ = LCD0-D7 RXC- = LCD0-D8

Software Configuration
At this point is important to understand HOW TO set properly the A10 chip to run with the specific display settings. More simple job is recover and set display X/Y resolutions. With example's devices we should use:

[lcd0_para] lcd_x = 800 lcd_y = 480

Now we will enter in the more complex range of settings regarding timings.

At this point only display datasheet can help us with the TIMING CHARACTERISTICS:

LCD Data Clock Frequency
Looking in the table, at field Clock Frequency, a good value for lcd_dclk_freq should be comprised between 29.5 to 33 MHz. The value of 30MHz should go fine so:

; lcd data clock frequency lcd_dclk_freq = 30

LCD Interface
LCD interface define what type of interface to use for LCD. For LVDS the right value is 3:

; lcd interface lcd_if = 3

Check whether 24 or 18 bit color is used, and set lcd_lvds_bitwidth = 1 (if 18bit (RGB666) is used)

LCD Sync Settings
Now more interesting part of settings, the sync timings. A10 require four values:


 * 1) LCD horizontal sync back porch
 * 2) LCD horizontal sync total cycle
 * 3) LCD vertical sync back porch
 * 4) LCD vertical sync total cycle * 2

In the upon table we can the needed values.
 * 1) Horizontal sync total sycle (lcd_ht) is the same as horizontal period in the datasheet which is = 1055 at 30Mhz
 * 2) Horizontal back porch (lcd_hpb) is the same as horizontal blanking in the datasheet, which is the difference between horizontal period and the horizontal active time (1055-800) which is = 255, here 200 is used an approximate value
 * 3) Vertical sync total cycle (lcd_vt) is the same as 2*vertical period in the datasheet which is = 1050 at 30Mhz
 * 4) Horizontal back porch (lcd_hpb) is the same as 2*vertical blanking in the datasheet, which is the difference between 2*vertical period and the 2*vertical active time (1050-1000) which is = 50, 25 is used as an approximate value.

So the final values are: lcd_hbp = 200 lcd_ht = 1055 lcd_vbp = 25 lcd_vt = 1050

So the final config of the script.fex file:

[disp_init] disp_init_enable = 1 disp_mode = 0 screen0_output_type = 1 screen0_output_mode = 4 screen1_output_type = 1 screen1_output_mode = 4 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 lcd0_bright = 197 lcd1_bright = 197 lcd0_screen_bright = 50 lcd0_screen_contrast = 50 lcd0_screen_saturation = 57 lcd0_screen_hue = 50 lcd1_screen_bright = 50 lcd1_screen_contrast = 50 lcd1_screen_saturation = 57 lcd1_screen_hue = 50 [lcd0_para] lcd_used = 1 lcd_x = 800 lcd_y = 480 lcd_dclk_freq = 30 lcd_pwm_not_used = 0 lcd_pwm_ch = 0 lcd_pwm_freq = 10000 lcd_pwm_pol = 0 lcd_if = 3 lcd_hbp = 200 lcd_ht = 1055 lcd_vbp = 25 lcd_vt = 1050 lcd_hv_if = 0 lcd_hv_smode = 0 lcd_hv_s888_if = 0 lcd_hv_syuv_if = 0 lcd_hv_vspw = 0 lcd_hv_hspw = 0 lcd_lvds_ch = 0 lcd_lvds_mode = 0 lcd_lvds_bitwidth = 0 lcd_lvds_io_cross = 0 lcd_cpu_if = 0 lcd_frm = 0 lcd_io_cfg0 = 268435456 lcd_gamma_correction_en = 0 lcd_gamma_tbl_0 = 0x0 lcd_gamma_tbl_1 = 0x10101 lcd_gamma_tbl_255 = 0xffffff lcd_bl_en_used = 0 lcd_bl_en = port:PH07<1><0> <1> lcd_power_used = 1 lcd_power = port:PH08<1><0> <1> lcd_pwm_used = 1 lcd_pwm = port:PB02<2><0> lcd_gpio_0 = lcd_gpio_1 = lcd_gpio_2 = lcd_gpio_3 = lcdd0 = port:PD00<2><0> lcdd1 = port:PD01<2><0> lcdd2 = port:PD02<2><0> lcdd3 = port:PD03<2><0> lcdd4 = port:PD04<2><0> lcdd5 = port:PD05<2><0> lcdd6 = port:PD06<2><0> lcdd7 = port:PD07<2><0> lcdd8 = port:PD08<2><0> lcdd9 = port:PD09<2><0> lcdd10 = port:PD10<2><0> lcdd11 = port:PD11<2><0> lcdd12 = port:PD12<2><0> lcdd13 = port:PD13<2><0> lcdd14 = port:PD14<2><0> lcdd15 = port:PD15<2><0> lcdd16 = port:PD16<2><0> lcdd17 = port:PD17<2><0> lcdd18 = port:PD18<2><0> lcdd19 = port:PD19<2><0> lcdd20 = port:PD20<2><0> lcdd21 = port:PD21<2><0> lcdd22 = port:PD22<2><0> lcdd23 = port:PD23<2><0> lcdclk = port:PH24<2><0> lcdde = port:PH25<2><0> lcdhsync = port:PH26<2><0> lcdvsync = port:PH27<2><0>