0
PaddleStroke

A20 board interface LCD

Recommended Posts

(edited)

Hey guys,

Some questions about LCD interfacing.

 

I have a A20 board and 2 LCD, one 640*480 3.5" (FJ035CI54-R40), one 320*240 3.5" (LQ035NC111, same as bananapi LCD). Both LCD have the same pinout, formfactor and ribbon so should be hardware compatible.

 

1 - LQ035NC111 

I could get the LQ035NC111 to work on legacy kernel with the following script.fex (for reference)

Spoiler

 


[disp_init]
disp_init_enable = 1
disp_mode = 0
screen0_output_type = 1
screen0_output_mode = 4
screen1_output_type = 2
screen1_output_mode = 11
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 = 0
lcd0_backlight = 197
lcd1_backlight = 197
lcd0_bright = 50
lcd0_contrast = 50
lcd0_saturation = 57
lcd0_hue = 50
lcd1_bright = 50
lcd1_contrast = 50
lcd1_saturation = 57
lcd1_hue = 50

[lcd0_para]
lcd_used = 1
lcd_x = 320
lcd_y = 240
lcd_dclk_freq = 7
lcd_pwm_not_used = 0
lcd_pwm_ch = 0
lcd_pwm_freq = 22000
lcd_pwm_pol = 0
lcd_max_bright = 240
lcd_min_bright = 64
lcd_if = 0
lcd_hbp = 68
lcd_ht = 408
lcd_vbp = 18
lcd_vt = 524
lcd_vspw = 3
lcd_hspw = 30
lcd_hv_if = 0
lcd_hv_smode = 0
lcd_hv_s888_if = 0
lcd_hv_syuv_if = 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_pwm_used = 1
lcd_pwm = port:PB02<2><0><default><default>
lcdd0 = port:PD00<2><0><3><default>
lcdd1 = port:PD01<2><0><3><default>
lcdd2 = port:PD02<2><0><3><default>
lcdd3 = port:PD03<2><0><3><default>
lcdd4 = port:PD04<2><0><3><default>
lcdd5 = port:PD05<2><0><3><default>
lcdd6 = port:PD06<2><0><3><default>
lcdd7 = port:PD07<2><0><3><default>
lcdd8 = port:PD08<2><0><3><default>
lcdd9 = port:PD09<2><0><3><default>
lcdd10 = port:PD10<2><0><3><default>
lcdd11 = port:PD11<2><0><3><default>
lcdd12 = port:PD12<2><0><3><default>
lcdd13 = port:PD13<2><0><3><default>
lcdd14 = port:PD14<2><0><3><default>
lcdd15 = port:PD15<2><0><3><default>
lcdd16 = port:PD16<2><0><3><default>
lcdd17 = port:PD17<2><0><3><default>
lcdd18 = port:PD18<2><0><3><default>
lcdd19 = port:PD19<2><0><3><default>
lcdd20 = port:PD20<2><0><3><default>
lcdd21 = port:PD21<2><0><3><default>
lcdd22 = port:PD22<2><0><3><default>
lcdd23 = port:PD23<2><0><3><default>
lcdclk = port:PD24<2><0><3><default>
lcdde = port:PD25<1><0><3><0>
lcdhsync = port:PD26<2><0><3><default>
lcdvsync = port:PD27<2><0><3><default>

But can't get it to work with mainline. With mainline I get a white rectangle flashing on the left side of the screen. Interestingly I can reproduce the exact same bug with legacy by changing all the pin configurations from 

lcdd0 = port:PD00<2><0><3><default>
lcdd1...

to

lcdd0 = port:PD00<2><0><default><default>
lcdd1...

Looking at fex guide I see that the third parameter is "<drive capability> defines the output drive in mA, values are 0-3 corresponding to 10mA, 20mA, 30mA and 40mA."

 

As the visual issue is exactly the same on mainline I guess the problem must come from this but I can't figure out how to change this drive capability in mainline. Any guess?

 

2 - FJ035CI54-R40

So for this LCD I can't get over a black screen (Backlight is working). The tricky part is that the datasheet (enclosed) is not clear for me. Also supplier gave me additional data which seem different than datasheet.

#define  HT  680   //Horizontal total period = (HT + 1) pixels
#define  HPS 2   //Horizontal Sync Pulse Start Position = (HPS + 1) pixels     
#define  LPS 20   //Horizontal Display Period Start Position = LPS pixels  
#define  HPW 20   //Horizontal Sync Pulse Width = (HPW + 1) pixels 

#define  VT 550  //Vertical Total = (VT + 1) lines
#define  VPS 2 //Vertical Sync Pulse Start Position = VPS lines       
#define  FPS 6   //Vertical Display Period Start Position = FPS lines      
#define  VPW 12  //Vertical Sync Pulse Width = (VPW + 1) lines

#define HSPW 2 
#define HBPD 20
#define HFPD 20 

#define VSPW 2 
#define VBPD 6 
#define VFPD 12

//DCLK=20MHZ

 

On page 6 of datasheet the timing data looks different, but it may just be a misunderstanding from me. For instance datasheet say PCLK = 63.61MHz, but the file above say DCLK = 20MHZ (even if commented out). Do you know what is the difference between PCLK and DLCK? (The inconsistancy between LCD datasheets parameter names and symbols is killing me.)

 

Also the datasheet say "The RGB only support the DE mode: HSYNC,VSYNC,DCLK and DE pin ."

It seems from fex guide that mode can be set by "lcd_if" value. However there is no DE mode. Only :

Quote

 

hv (sync + de)

8080

ttl

lvds

dsi (on A20 it means the use of SSD2828 bridge chip, on A31 it might really mean native DSI)

edp

external dsi (the use of SSD2828 bridge chip on A31 and onwards)

 

 

So I am unsure what to select. I can't find much documentation about those modes on internet.

 

Also I can't understand what is this and how it should be set "lcd_io_cfg0 = 268435456"

 

I made several attemps with either datasheet or above code timing values but without luck so far. Only a black screen.

 

Anyone has some experience with LCD interfacing on armbian could help me writing this fex? It would really really really be appreciated. 

Above is my last attempt of fex

Spoiler

 


[disp_init]
disp_init_enable = 1
disp_mode = 0
screen0_output_type = 1
screen0_output_mode = 4
screen1_output_type = 0
screen1_output_mode = 4
fb0_framebuffer_num = 2
fb0_format = 9
fb0_pixel_sequence = 0
fb0_scaler_mode_enable = 1
fb1_framebuffer_num = 2
fb1_format = 10
fb1_pixel_sequence = 0
fb1_scaler_mode_enable = 0
lcd0_backlight = 197
lcd1_backlight = 197
lcd0_bright = 50
lcd0_contrast = 50
lcd0_saturation = 57
lcd0_hue = 50
lcd1_bright = 50
lcd1_contrast = 50
lcd1_saturation = 57
lcd1_hue = 50

[lcd0_para]
lcd_used = 1
lcd_x = 640
lcd_y = 480
lcd_dclk_freq = 20
lcd_pwm_not_used = 0
lcd_pwm_ch = 0
lcd_pwm_freq = 22000
lcd_pwm_pol = 0
lcd_max_bright = 240
lcd_min_bright = 64
lcd_if = 0
lcd_hbp = 42
lcd_ht = 680
lcd_vbp = 14
lcd_vt = 1100
lcd_vspw = 12
lcd_hspw = 20
lcd_hv_if = 0
lcd_hv_smode = 0
lcd_hv_s888_if = 0
lcd_hv_syuv_if = 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_pwm_used = 1
lcd_pwm = port:PB02<2><0><default><default>
lcdd0 = port:PD00<2><0><3><default>
  ...

 

FJ035CI54-R40.pdf

Edited by Tido
added spoiler

Share this post


Link to post
Share on other sites

you mention  fex  a few times... armbianmonitor -u   tells the reader all the details about your Installation, like Kernel-Version and much more, please post the result of this command.

 

Share this post


Link to post
Share on other sites

Hi Tido,

Thanks for your feedback.

Finally the FJ035CI54-R40 could work on legacy. Without even timing values. So it seems timing values are not critical to get picture... The error was probably somewhere else, I still need to do some test to find out more precisely.

 

Here's the fex that works with legacy and FJ035CI54-R40 for reference.

Spoiler

[disp_init]
disp_init_enable = 1
disp_mode = 0
screen0_output_type = 1
screen0_output_mode = 6
screen1_output_type = 1
screen1_output_mode = 6
fb0_width = 0
fb0_height = 0
fb0_framebuffer_num = 2
fb0_format = 10
fb0_pixel_sequence = 0
fb0_scaler_mode_enable = 0
fb1_width = 1024
fb1_height = 600
fb1_framebuffer_num = 2
fb1_format = 10
fb1_pixel_sequence = 0
fb1_scaler_mode_enable = 0
lcd0_backlight = 197
lcd1_backlight = 197
lcd0_bright = 50
lcd0_contrast = 50
lcd0_saturation = 57
lcd0_hue = 50
lcd1_bright = 239
lcd1_contrast = 50
lcd1_saturation = 57
lcd1_hue = 50

[lcd0_para]
lcd_used = 1
lcd_x = 640
lcd_y = 480
lcd_dclk_freq = 64
lcd_pwm_not_used = 0
lcd_pwm_ch = 0
lcd_pwm_freq = 22000
lcd_pwm_pol = 0
lcd_max_bright = 240
lcd_min_bright = 64
lcd_if = 0
lcd_hbp = 42
lcd_ht = 808
lcd_vbp = 14
lcd_vt = 2624
lcd_vspw = 3
lcd_hspw = 30
lcd_hv_if = 0
lcd_hv_smode = 0
lcd_hv_s888_if = 0
lcd_hv_syuv_if = 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 = 0
lcd_gamma_correction_en = 0
lcd_gamma_tbl_0 = 0x0
lcd_gamma_tbl_1 = 0x10101
lcd_gamma_tbl_255 = 0xffffff
lcd_pwm_used = 1
lcd_pwm = port:PB02<2><0><default><default>
lcdd0 = port:PD00<2><0><3><default>
lcdd1 = port:PD01<2><0><3><default>
lcdd2 = port:PD02<2><0><3><default>
lcdd3 = port:PD03<2><0><3><default>
lcdd4 = port:PD04<2><0><3><default>
lcdd5 = port:PD05<2><0><3><default>
lcdd6 = port:PD06<2><0><3><default>
lcdd7 = port:PD07<2><0><3><default>
lcdd8 = port:PD08<2><0><3><default>
lcdd9 = port:PD09<2><0><3><default>
lcdd10 = port:PD10<2><0><3><default>
lcdd11 = port:PD11<2><0><3><default>
lcdd12 = port:PD12<2><0><3><default>
lcdd13 = port:PD13<2><0><3><default>
lcdd14 = port:PD14<2><0><3><default>
lcdd15 = port:PD15<2><0><3><default>
lcdd16 = port:PD16<2><0><3><default>
lcdd17 = port:PD17<2><0><3><default>
lcdd18 = port:PD18<2><0><3><default>
lcdd19 = port:PD19<2><0><3><default>
lcdd20 = port:PD20<2><0><3><default>
lcdd21 = port:PD21<2><0><3><default>
lcdd22 = port:PD22<2><0><3><default>
lcdd23 = port:PD23<2><0><3><default>
lcdclk = port:PD24<2><0><3><default>
lcdde = port:PD25<1><0><3><0>
lcdhsync = port:PD26<2><0><3><default>
lcdvsync = port:PD27<2><0><3><default>

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
0