Solving Blurry VGA Font Display Issues on AM335x Linux

1. In the AM335x display driver, VGA display adjustments are generally made in the file drivers/video/da8xx-fb.c within the following structure:

static struct da8xx_panel known_lcd_panels[] = {

    [2] = {

        .name = "TFC_S9700RTWV35TR_01B",

        .width = 800,

        .height = 600,

        .hfp = 128,

        .hbp = 88,

        .hsw = 40,

        .vfp = 4,

        .vbp = 23,

        .vsw = 1,

        .pxl_clk = (800+210+46)*(600+28)*60,

        .invert_pxl_clk = 1,

    },

}

2. However, some VGA displays may show slightly blurry text in certain vertical areas, and adjusting the above parameters may not resolve the issue. Using an oscilloscope to measure the VGA signals revealed that the horizontal and vertical sync signals differ from those of a PC, as shown in the figures below.

 

图1.jpg

Figure 1: PC horizontal sync signal

 

图2.jpg

Figure 2: PC vertical sync signal

 图3.jpg

Figure 3: AM335X output horizontal sync (top) and vertical sync (bottom) 

图4.jpg

Figure 4: AM335X output horizontal sync (bottom) and vertical sync (top)

 

3. From the comparison, it can be seen that the PC's vertical and horizontal sync signals are low during idle periods, while the signals output by the AM335X have high levels during idle periods. Therefore, we should invert these signals. The code shows that only the pixel signal is inverted. After checking the AM335X manual, it was found that the AM335X has registers for inverting the vertical (Vsync) and horizontal (Hsync) sync signals, specifically the ivs and ihs bits in the RASTER_TIMING_2 register.

 

4. In the lcd_init function of the code, add the settings for these two bits in the red font section:

static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg, struct da8xx_panel *panel)

{

    u32 bpp;

    int ret = 0;

    lcd_reset(par);

    /* Calculate the divider */

    lcd_calc_clk_divider(par);

 

    if (panel->invert_pxl_clk)

        lcdc_write((lcdc_read(LCD_RASTER_TIMING_2_REG) |

LCD_INVERT_PIXEL_CLOCK), LCD_RASTER_TIMING_2_REG);

    else

        lcdc_write((lcdc_read(LCD_RASTER_TIMING_2_REG) &

            ~LCD_INVERT_PIXEL_CLOCK), LCD_RASTER_TIMING_2_REG);

 

    lcdc_write((lcdc_read(LCD_RASTER_TIMING_2_REG) |

         LCD_INVERT_LINE_CLOCK), LCD_RASTER_TIMING_2_REG);

 

    lcdc_write((lcdc_read(LCD_RASTER_TIMING_2_REG) |

         LCD_INVERT_FRAME_CLOCK), LCD_RASTER_TIMING_2_REG);

 

    /* Configure the DMA burst size and fifo threshold. */

    ret = lcd_cfg_dma(cfg->dma_burst_sz, cfg->fifo_th);

    if (ret < 0)

        return ret;

    After recompiling the kernel, the blurriness disappeared, and the issue was resolved.

 

 

weathink AM335x SOM:https://www.weathink.com/products/hexinban/2.html


 


Tags: Array