使用T113S3 tina linux驱动ST7701S RGB长条屏幕,显示lvgl demo分两半问题
-
问题卡了两周,各位路过的大佬帮忙看看呗!感激不尽
使用T113S3 tina linux驱动ST7701S RGB屏幕,打开lvgl demo,显示分了两半的问题:
通过指令保存的图片是正常的:
echo 0 > /sys/class/disp/disp/attr/disp echo /data/1.bmp > /sys/class/disp/disp/attr/capture_dump
厂家给的参数:
HS:10 HBP:30 HFP: 50
VS:2 VBP:15 VFP:17
400*960DTS部分配置如下:
&disp { disp_init_enable = <1>; disp_mode = <0>; screen0_output_type = <1>; screen0_output_mode = <4>; screen1_output_type = <3>; screen1_output_mode = <4>; screen1_output_format = <0>; screen1_output_bits = <0>; screen1_output_eotf = <4>; screen1_output_cs = <257>; screen1_output_range = <2>; screen1_output_scan = <0>; screen1_output_aspect_ratio = <8>; dev0_output_type = <1>; dev0_output_mode = <4>; dev0_screen_id = <0>; dev0_do_hpd = <0>; dev1_output_type = <4>; dev1_output_mode = <10>; dev1_screen_id = <1>; dev1_do_hpd = <1>; def_output_dev = <0>; disp_rotation_used = <1>; degree0 = <0>; fb0_format = <0>; fb0_buffer_num = <1>; fb0_width = <400>; fb0_height = <960>; /*read from lcd*/ fb1_format = <0>; fb1_width = <0>; fb1_height = <0>; chn_cfg_mode = <1>; disp_para_zone = <1>; /*VCC-LCD*/ /* dc1sw-supply = <®_dc1sw>;*/ /*VCC-DSI*/ /* eldo3-supply = <®_eldo3>;*/ /*VCC-PD*/ /* dcdc1-supply = <®_dcdc1>;*/ };
&lcd0 { lcd_used = <1>; lcd_driver_name = "st7701s_rgb"; lcd_if = <0>; //0:rgb 1:CPU/I80 2:保留 3:lvds 4:dsi lcd_hv_if = <0>; //0:并行rgb lcd_width = <46>; //物理宽度 mm lcd_height = <110>; //物理高度 mm lcd_x = <400>; //宽度 lcd_y = <960>; //高度 lcd_dclk_freq = <29>; //屏幕时钟 MHz lcd_hbp = <40>; //hbp+hspw,从时序图可以看到hspw包含在hbp中,所以只需要填写hbp的值 lcd_ht = <490>; //lcd_x+hs+hbp+hspw lcd_hspw = <10>; //hspw lcd_vbp = <17>; //vbp+vspw lcd_vt = <994>; //lcd_y+vs+vbp+vspw lcd_vspw = <2>; //vspw lcd_backlight = <50>; //背光默认亮度 lcd_pwm_used = <1>; //使用背光 lcd_pwm_ch = <7>; //使用pwm通道7 lcd_pwm_freq = <10000>; //PWM 频率,单位 Hz lcd_pwm_pol = <0>; //背光 PWM 的极性 lcd_pwm_max_limit = <255>; lcd_bright_curve_en = <0>; lcd_dsi_if = <0>; lcd_dsi_lane = <4>; lcd_lvds_if = <0>; lcd_lvds_colordepth = <0>; lcd_lvds_mode = <0>; lcd_frm = <1>; lcd_hv_clk_phase = <0>; lcd_hv_sync_polarity= <0>; lcd_io_phase = <0x0000>; lcd_gamma_en = <0>; lcd_bright_curve_en = <0>; lcd_cmap_en = <0>; lcd_fsync_en = <0>; lcd_fsync_act_time = <1000>; lcd_fsync_dis_time = <1000>; lcd_fsync_pol = <0>; deu_mode = <0>; lcdgamma4iep = <22>; smart_color = <90>; pinctrl-0 = <&rgb18_pins_a>; pinctrl-1 = <&rgb18_pins_b>; lcd_gpio_0 = <&pio PE 9 GPIO_ACTIVE_HIGH>; //RST lcd_gpio_1 = <&pio PE 8 GPIO_ACTIVE_HIGH>; //CS lcd_gpio_2 = <&pio PE 7 GPIO_ACTIVE_HIGH>; //SDA lcd_gpio_3 = <&pio PE 6 GPIO_ACTIVE_HIGH>; //SCK };
驱动部分参考sdk的st7701改的,spi+rgb驱动
#include "st7701s_rgb.h" #include "default_panel.h" //s32 sunxi_lcd_gpio_set_value(u32 screen_id, u32 io_index, u32 value) #define st7701s_spi_scl_1 sunxi_lcd_gpio_set_value(0, 3, 1) #define st7701s_spi_scl_0 sunxi_lcd_gpio_set_value(0, 3, 0) #define st7701s_spi_sdi_1 sunxi_lcd_gpio_set_value(0, 2, 1) #define st7701s_spi_sdi_0 sunxi_lcd_gpio_set_value(0, 2, 0) #define st7701s_spi_cs_1 sunxi_lcd_gpio_set_value(0, 1, 1) #define st7701s_spi_cs_0 sunxi_lcd_gpio_set_value(0, 1, 0) #define st7701s_spi_reset_1 sunxi_lcd_gpio_set_value(0, 0, 1) #define st7701s_spi_reset_0 sunxi_lcd_gpio_set_value(0, 0, 0) static void LCD_power_on(u32 sel); static void LCD_power_off(u32 sel); static void LCD_bl_open(u32 sel); static void LCD_bl_close(u32 sel); static void LCD_panel_init(u32 sel); static void LCD_panel_exit(u32 sel); static void LCD_cfg_panel_info(panel_extend_para *info) { u32 i = 0, j = 0; u32 items; u8 lcd_gamma_tbl[][2] = { /* {input value, corrected value} */ {0, 0}, {15, 15}, {30, 30}, {45, 45}, {60, 60}, {75, 75}, {90, 90}, {105, 105}, {120, 120}, {135, 135}, {150, 150}, {165, 165}, {180, 180}, {195, 195}, {210, 210}, {225, 225}, {240, 240}, {255, 255}, }; u32 lcd_cmap_tbl[2][3][4] = { { {LCD_CMAP_G0, LCD_CMAP_B1, LCD_CMAP_G2, LCD_CMAP_B3}, {LCD_CMAP_B0, LCD_CMAP_R1, LCD_CMAP_B2, LCD_CMAP_R3}, {LCD_CMAP_R0, LCD_CMAP_G1, LCD_CMAP_R2, LCD_CMAP_G3}, }, { {LCD_CMAP_B3, LCD_CMAP_G2, LCD_CMAP_B1, LCD_CMAP_G0}, {LCD_CMAP_R3, LCD_CMAP_B2, LCD_CMAP_R1, LCD_CMAP_B0}, {LCD_CMAP_G3, LCD_CMAP_R2, LCD_CMAP_G1, LCD_CMAP_R0}, }, }; items = sizeof(lcd_gamma_tbl) / 2; for (i = 0; i < items - 1; i++) { u32 num = lcd_gamma_tbl[i + 1][0] - lcd_gamma_tbl[i][0]; for (j = 0; j < num; j++) { u32 value = 0; value = lcd_gamma_tbl[i][1] + ((lcd_gamma_tbl[i + 1][1] - lcd_gamma_tbl[i][1]) * j) / num; info->lcd_gamma_tbl[lcd_gamma_tbl[i][0] + j] = (value << 16) + (value << 8) + value; } } info->lcd_gamma_tbl[255] = (lcd_gamma_tbl[items - 1][1] << 16) + (lcd_gamma_tbl[items - 1][1] << 8) + lcd_gamma_tbl[items - 1][1]; memcpy(info->lcd_cmap_tbl, lcd_cmap_tbl, sizeof(lcd_cmap_tbl)); } static s32 LCD_open_flow(u32 sel) { printk("=====================LCD_open_flow\n"); /* open lcd power, and delay 50ms */ LCD_OPEN_FUNC(sel, LCD_power_on, 20); /* open lcd power, than delay 200ms */ LCD_OPEN_FUNC(sel, LCD_panel_init, 20); /* open lcd controller, and delay 100ms */ LCD_OPEN_FUNC(sel, sunxi_lcd_tcon_enable, 100); /* open lcd backlight, and delay 0ms */ LCD_OPEN_FUNC(sel, LCD_bl_open, 0); return 0; } static s32 LCD_close_flow(u32 sel) { /* close lcd backlight, and delay 0ms */ LCD_CLOSE_FUNC(sel, LCD_bl_close, 0); /* close lcd controller, and delay 0ms */ LCD_CLOSE_FUNC(sel, sunxi_lcd_tcon_disable, 0); /* open lcd power, than delay 200ms */ LCD_CLOSE_FUNC(sel, LCD_panel_exit, 200); /* close lcd power, and delay 500ms */ LCD_CLOSE_FUNC(sel, LCD_power_off, 500); return 0; } static void LCD_power_on(u32 sel) { printk("=====================LCD_power_on\n"); /* config lcd_power pin to open lcd power0 */ sunxi_lcd_power_enable(sel, 0); sunxi_lcd_pin_cfg(sel, 1); } static void LCD_power_off(u32 sel) { sunxi_lcd_pin_cfg(sel, 0); /* config lcd_power pin to close lcd power0 */ sunxi_lcd_power_disable(sel, 0); } static void LCD_bl_open(u32 sel) { printk("=====================LCD_bl_open\n"); sunxi_lcd_pwm_enable(sel); sunxi_lcd_backlight_enable(sel); } static void LCD_bl_close(u32 sel) { /* config lcd_bl_en pin to close lcd backlight */ sunxi_lcd_backlight_disable(sel); sunxi_lcd_pwm_disable(sel); } //three line 9bit mode static void LCD_WRITE_DATA(u32 value) { u32 i; st7701s_spi_cs_0; st7701s_spi_sdi_1; st7701s_spi_scl_0; sunxi_lcd_delay_us(10); st7701s_spi_scl_1; for (i = 0; i < 8; i++) { sunxi_lcd_delay_us(10); if (value & 0x80) st7701s_spi_sdi_1; else st7701s_spi_sdi_0; value <<= 1; sunxi_lcd_delay_us(10); st7701s_spi_scl_0; st7701s_spi_scl_1; } sunxi_lcd_delay_us(10); st7701s_spi_cs_1; } static void LCD_WRITE_COMMAND(u32 value) { u32 i; st7701s_spi_cs_0; st7701s_spi_sdi_0; st7701s_spi_scl_0; sunxi_lcd_delay_us(10); st7701s_spi_scl_1; for (i = 0; i < 8; i++) { sunxi_lcd_delay_us(10); if (value & 0x80) st7701s_spi_sdi_1; else st7701s_spi_sdi_0; st7701s_spi_scl_0; sunxi_lcd_delay_us(10); st7701s_spi_scl_1; value <<= 1; } sunxi_lcd_delay_us(10); st7701s_spi_cs_1; } static void LCD_panel_init(u32 sel) { printk("=====================LCD_panel_init\n"); //ST7701S+AUO4.58 LCD_WRITE_COMMAND (0xFF); LCD_WRITE_DATA (0x77); LCD_WRITE_DATA (0x01); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x13); LCD_WRITE_COMMAND (0xEF); LCD_WRITE_DATA (0x08); LCD_WRITE_COMMAND (0xFF); LCD_WRITE_DATA (0x77); LCD_WRITE_DATA (0x01); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x10); LCD_WRITE_COMMAND (0xC0); LCD_WRITE_DATA (0x77); LCD_WRITE_DATA (0x00); LCD_WRITE_COMMAND (0xC1); LCD_WRITE_DATA (0x09); LCD_WRITE_DATA (0x08); LCD_WRITE_COMMAND (0xC2);//inv LCD_WRITE_DATA (0x01); LCD_WRITE_DATA (0x02); LCD_WRITE_COMMAND (0xC3); //???? LCD_WRITE_DATA (0x02); //82 HVmode 02 DEmode LCD_WRITE_COMMAND (0xCC); LCD_WRITE_DATA (0x10); LCD_WRITE_COMMAND (0xB0); LCD_WRITE_DATA (0x40); LCD_WRITE_DATA (0x14); LCD_WRITE_DATA (0x59); LCD_WRITE_DATA (0x10); LCD_WRITE_DATA (0x12); LCD_WRITE_DATA (0x08); LCD_WRITE_DATA (0x03); LCD_WRITE_DATA (0x09); LCD_WRITE_DATA (0x05); LCD_WRITE_DATA (0x1E); LCD_WRITE_DATA (0x05); LCD_WRITE_DATA (0x14); LCD_WRITE_DATA (0x10); LCD_WRITE_DATA (0x68); LCD_WRITE_DATA (0x33); LCD_WRITE_DATA (0x15); LCD_WRITE_COMMAND (0xB1); LCD_WRITE_DATA (0x40); LCD_WRITE_DATA (0x08); LCD_WRITE_DATA (0x53); LCD_WRITE_DATA (0x09); LCD_WRITE_DATA (0x11); LCD_WRITE_DATA (0x09); LCD_WRITE_DATA (0x02); LCD_WRITE_DATA (0x07); LCD_WRITE_DATA (0x09); LCD_WRITE_DATA (0x1A); LCD_WRITE_DATA (0x04); LCD_WRITE_DATA (0x12); LCD_WRITE_DATA (0x12); LCD_WRITE_DATA (0x64); LCD_WRITE_DATA (0x29); LCD_WRITE_DATA (0x29); LCD_WRITE_COMMAND (0xFF); LCD_WRITE_DATA (0x77); LCD_WRITE_DATA (0x01); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x11); LCD_WRITE_COMMAND (0xB0); LCD_WRITE_DATA (0x6D); //6D LCD_WRITE_COMMAND (0xB1); //vcom LCD_WRITE_DATA (0x1D); LCD_WRITE_COMMAND (0xB2); LCD_WRITE_DATA (0x87); LCD_WRITE_COMMAND (0xB3); LCD_WRITE_DATA (0x80); LCD_WRITE_COMMAND (0xB5); LCD_WRITE_DATA (0x49); LCD_WRITE_COMMAND (0xB7); LCD_WRITE_DATA (0x85); LCD_WRITE_COMMAND (0xB8); LCD_WRITE_DATA (0x20); LCD_WRITE_COMMAND (0xC1); LCD_WRITE_DATA (0x78); LCD_WRITE_COMMAND (0xC2); LCD_WRITE_DATA (0x78); LCD_WRITE_COMMAND (0xD0); LCD_WRITE_DATA (0x88); LCD_WRITE_COMMAND (0xE0); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x02); LCD_WRITE_COMMAND (0xE1); LCD_WRITE_DATA (0x02); LCD_WRITE_DATA (0x8C); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x03); LCD_WRITE_DATA (0x8C); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x33); LCD_WRITE_DATA (0x33); LCD_WRITE_COMMAND (0xE2); LCD_WRITE_DATA (0x33); LCD_WRITE_DATA (0x33); LCD_WRITE_DATA (0x33); LCD_WRITE_DATA (0x33); LCD_WRITE_DATA (0xC9); LCD_WRITE_DATA (0x3C); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0xCA); LCD_WRITE_DATA (0x3C); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_COMMAND (0xE3); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x33); LCD_WRITE_DATA (0x33); LCD_WRITE_COMMAND (0xE4); LCD_WRITE_DATA (0x44); LCD_WRITE_DATA (0x44); LCD_WRITE_COMMAND (0xE5); LCD_WRITE_DATA (0x05); LCD_WRITE_DATA (0xCD); LCD_WRITE_DATA (0x82); LCD_WRITE_DATA (0x82); LCD_WRITE_DATA (0x01); LCD_WRITE_DATA (0xC9); LCD_WRITE_DATA (0x82); LCD_WRITE_DATA (0x82); LCD_WRITE_DATA (0x07); LCD_WRITE_DATA (0xCF); LCD_WRITE_DATA (0x82); LCD_WRITE_DATA (0x82); LCD_WRITE_DATA (0x03); LCD_WRITE_DATA (0xCB); LCD_WRITE_DATA (0x82); LCD_WRITE_DATA (0x82); LCD_WRITE_COMMAND (0xE6); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x33); LCD_WRITE_DATA (0x33); LCD_WRITE_COMMAND (0xE7); LCD_WRITE_DATA (0x44); LCD_WRITE_DATA (0x44); LCD_WRITE_COMMAND (0xE8); LCD_WRITE_DATA (0x06); LCD_WRITE_DATA (0xCE); LCD_WRITE_DATA (0x82); LCD_WRITE_DATA (0x82); LCD_WRITE_DATA (0x02); LCD_WRITE_DATA (0xCA); LCD_WRITE_DATA (0x82); LCD_WRITE_DATA (0x82); LCD_WRITE_DATA (0x08); LCD_WRITE_DATA (0xD0); LCD_WRITE_DATA (0x82); LCD_WRITE_DATA (0x82); LCD_WRITE_DATA (0x04); LCD_WRITE_DATA (0xCC); LCD_WRITE_DATA (0x82); LCD_WRITE_DATA (0x82); LCD_WRITE_COMMAND (0xEB); LCD_WRITE_DATA (0x08); LCD_WRITE_DATA (0x01); LCD_WRITE_DATA (0xE4); LCD_WRITE_DATA (0xE4); LCD_WRITE_DATA (0x88); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x40); LCD_WRITE_COMMAND (0xEC); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_COMMAND (0xED); LCD_WRITE_DATA (0xFF); LCD_WRITE_DATA (0xF0); LCD_WRITE_DATA (0x07); LCD_WRITE_DATA (0x65); LCD_WRITE_DATA (0x4F); LCD_WRITE_DATA (0xFC); LCD_WRITE_DATA (0xC2); LCD_WRITE_DATA (0x2F); LCD_WRITE_DATA (0xF2); LCD_WRITE_DATA (0x2C); LCD_WRITE_DATA (0xCF); LCD_WRITE_DATA (0xF4); LCD_WRITE_DATA (0x56); LCD_WRITE_DATA (0x70); LCD_WRITE_DATA (0x0F); LCD_WRITE_DATA (0xFF); LCD_WRITE_COMMAND (0xEF); LCD_WRITE_DATA (0x10); LCD_WRITE_DATA (0x0D); LCD_WRITE_DATA (0x04); LCD_WRITE_DATA (0x08); LCD_WRITE_DATA (0x3F); LCD_WRITE_DATA (0x1F); LCD_WRITE_COMMAND (0xFF); LCD_WRITE_DATA (0x77); LCD_WRITE_DATA (0x01); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_DATA (0x00); LCD_WRITE_COMMAND (0x11); sunxi_lcd_delay_ms(120); LCD_WRITE_COMMAND (0x35); LCD_WRITE_DATA (0x00); LCD_WRITE_COMMAND (0x3A); LCD_WRITE_DATA (0x66); //LCD_WRITE_COMMAND (0x11); //sunxi_lcd_delay_ms(120); LCD_WRITE_COMMAND (0x29); return; } static void LCD_panel_exit(u32 sel) { return; } /* sel: 0:lcd0; 1:lcd1 */ static s32 LCD_user_defined_func(u32 sel, u32 para1, u32 para2, u32 para3) { return 0; } __lcd_panel_t st7701s_rgb_panel = { /* panel driver name, must mach the lcd_drv_name in sys_config.fex */ .name = "st7701s_rgb", .func = { .cfg_panel_info = LCD_cfg_panel_info, .cfg_open_flow = LCD_open_flow, .cfg_close_flow = LCD_close_flow, .lcd_user_defined_func = LCD_user_defined_func, } , };
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号