飞凌2440 lcd 调试

发布者:GoldenSunrise最新更新时间:2016-04-14 来源: eefocus关键字:飞凌2440  lcd  调试 手机看文章 扫描二维码
随时随地手机看文章
问题描述:lcd屏幕上 x方向画线正常,y方向画线的话就会出现重复如图




分析原因是:
时序不正确,也即lcddrv.h 和 lcddrv.c文件 不正确,需要修改。代码如下:

lcddrv.h:

#ifndef __LCDDRV_H__
#define __LCDDRV_H__

#include

#define LOWER21BITS(n)  ((n) & 0x1fffff)

#define BPPMODE_1BPP    0x8
#define BPPMODE_2BPP    0x9
#define BPPMODE_4BPP    0xA
#define BPPMODE_8BPP    0xB
#define BPPMODE_16BPP   0xC
#define BPPMODE_24BPP   0xD

#define LCDTYPE_TFT     0x3

#define ENVID_DISABLE   0
#define ENVID_ENABLE    1

#define FORMAT8BPP_5551 0
#define FORMAT8BPP_565  1

#define HSYNC_NORM      0
#define HSYNC_INV       1

#define VSYNC_NORM      0
#define VSYNC_INV       1

#define BSWP            1
#define HWSWP           1

//TFT LCD Panel(240*320)
#define MODE_TFT_1BIT_240320     (0x4101)
#define MODE_TFT_8BIT_240320   (0x4102)
#define MODE_TFT_16BIT_240320    (0x4104)
#define MODE_TFT_24BIT_240320    (0x4108)

//TFT 240320
#define LCD_XSIZE_TFT_240320  (240) 
#define LCD_YSIZE_TFT_240320  (320)

//TFT 240320
#define HOZVAL_TFT_240320 (LCD_XSIZE_TFT_240320-1)
#define LINEVAL_TFT_240320 (LCD_YSIZE_TFT_240320-1)

#define CLKVAL_TFT_240320 (4)
// 60hz @133Mhz
// (9) 60hz @100Mhz

//Timing parameter for LTS350Q1(SAMSUNG)
#define VBPD_240320  ((6-1)&0xff)
#define VFPD_240320  ((4-1)&0xff)
#define VSPW_240320  ((2-1) &0x3f)
#define HBPD_240320  ((11-1)&0x7f)
#define HFPD_240320  ((2-1)&0xff)
#define HSPW_240320  ((1-1)&0xff)

 

//TFT LCD Panel(640*480)
#define MODE_TFT_1BIT_640480     (0x4201)
#define MODE_TFT_8BIT_640480     (0x4202)
#define MODE_TFT_16BIT_640480    (0x4204)
#define MODE_TFT_24BIT_640480    (0x4208)

//TFT 640480
#define LCD_XSIZE_TFT_640480  (640) 
#define LCD_YSIZE_TFT_640480  (480)

//TFT640480
#define HOZVAL_TFT_640480 (LCD_XSIZE_TFT_640480-1)
#define LINEVAL_TFT_640480 (LCD_YSIZE_TFT_640480-1)

//Timing parameter for V16C6448AB(PRIME VIEW)
#define VBPD_640480  ((33-1)&0xff)
#define VFPD_640480  ((10-1)&0xff)
#define VSPW_640480  ((2-1) &0x3f)
#define HBPD_640480  ((48-1)&0x7f)
#define HFPD_640480  ((16-1)&0xff)
#define HSPW_640480  ((96-1)&0xff)


#define CLKVAL_TFT_640480  (1)
    //53.5hz @90Mhz
    //VSYNC,HSYNC should be inverted
    //HBPD=47VCLK,HFPD=15VCLK,HSPW=95VCLK
    //VBPD=32HSYNC,VFPD=9HSYNC,VSPW=1HSYNC

#define LCDFRAMEBUFFER 0x30400000


void Lcd_Port_Init(void);


void Tft_Lcd_Init(int type);


void Lcd_Palette8Bit_Init(void);


void Lcd_EnvidOnOff(int onoff);


void Lcd_PowerEnable(int invpwren, int pwren);


void ClearScrWithTmpPlt(UINT32 color);


void DisableTmpPlt(void);


void ChangePalette(UINT32 color);


#endif

 

------------------------------------------------------------------

lcddrv.c文件:

#include
#include "s3c24xx.h"
#include "lcddrv.h"

unsigned int fb_base_addr;
unsigned int bpp;
unsigned int xsize;
unsigned int ysize;

static const unsigned short DEMO256pal[]={
    0x0b5e,0xce9a,0xffd9,0x9d99,0xb63a,0xae7c,0xdd71,0x6c57,0xfd4d,0x00ae,0x9c4d,0xb5f8,0xad96,0x0131,0x0176,0xefff,0xcedd,0x9556,0xe4bf,0x00b6,0x22b7,0x002b,0x89de,0x002c,0x57df,0xab5f,0x3031,0x14bf,0x797e,0x5391,0x93ab,0x7239,0x7453,0xafdf,0x71b9,0x8c92,0x014d,0x302e,0x5175,0x0029,0x0969,0x004e,0x2a6d,0x0021,0x3155,0x4b6e,0xd677,0xf6b6,0x9b5f,0x4bb5,0xffd5,0x0027,0xdfdf,0x74d8,0x1256,0x6bcd,0x9b08,0x2ab2,0xbd72,0x84b5,0xfe52,0xd4ad,0x00ad,0xfffc,0x422b,0x73b0,0x0024,0x5246,0x8e5e,0x28b3,0x0050,0x3b52,0x2a4a,0x3a74,0x8559,0x3356,0x1251,0x9abf,0x4034,0x40b1,
    0x8cb9,0x00b3,0x5c55,0xdf3d,0x61b7,0x1f5f,0x00d9,0x4c59,0x0926,0xac3f,0x925f,0x85bc,0x29d2,0xc73f,0xef5c,0xcb9f,0x827b,0x5279,0x4af5,0x01b9,0x4290,0xf718,0x126d,0x21a6,0x515e,0xefbd,0xd75e,0x42ab,0x00aa,0x10b3,0x7349,0x63b5,0x61a3,0xaadf,0xcb27,0x87df,0x6359,0xc7df,0x4876,0xb5bc,0x4114,0xfe2e,0xef5e,0x65be,0x43b9,0xe5df,0x21c9,0x7d16,0x6abb,0x5c11,0x49f7,0xbc0b,0x9e1a,0x3b0f,0x202b,0xff12,0x821b,0x842f,0xbccf,0xdefb,0x8a3e,0x68fa,0xa4f1,0x38ae,0x28b7,0x21ad,0x31d7,0x0073,0x182b,0x1831,0x3415,0xbdf6,0x2dbf,0x0a5d,0xc73d,0x182c,0x293e,0x7b3d,0x643d,0x3cbd,
    0x92dd,0x09d4,0x1029,0x7cdd,0x6239,0x182e,0x5aea,0x11eb,0x8abc,0x7bfa,0x00a7,0x2153,0x1853,0x1318,0x0109,0x54fa,0x72a7,0x89e3,0x01cf,0x3a07,0x7b17,0x1a14,0x2150,0x23dc,0x4142,0x1b33,0x00a4,0xf6df,0x08fc,0x18ae,0x3a7e,0x18d1,0xa51c,0xff5a,0x1a0f,0x28fa,0xdfbe,0x82de,0x60d7,0x1027,0x48fa,0x5150,0x6213,0x89d6,0x110d,0x9bbb,0xbedd,0x28e1,0x1925,0xf449,0xaa79,0xd5f4,0x693c,0x110a,0x2889,0x08a2,0x923d,0x10a6,0xd9bc,0x5b2e,0x32ec,0xcf7f,0x1025,0x2148,0x74b4,0x6d59,0x9d14,0x0132,0x00f0,0x56bf,0x00f1,0xffff,0x0173,0x0133,0x00b0,0x00b1,0xf7ff,0x08b1,0xfffe,0x08b0,
    0x0171,0xf7bf,0x10f3,0xf7fe,0x08ef,0x1192,0xefbe,0x1131,0x2177,0xff9f,0x1116,0xffbc,0x5914,0x22ef,0xb285,0xa6df,
};


void Lcd_Port_Init(void)
{
    GPCUP   = 0xffffffff;   // 禁止内部上拉
    GPCCON  = 0xaaaaaaaa;   // GPIO管脚用于VD[7:0],LCDVF[2:0],VM,VFRAME,VLINE,VCLK,LEND
    GPDUP   = 0xffffffff;   // 禁止内部上拉
    GPDCON  = 0xaaaaaaaa;   // GPIO管脚用于VD[23:8]
}


void Tft_Lcd_Init(int type)
{
    switch(type)
    {
    case MODE_TFT_8BIT_240320:
       
       #if 0
        LCDCON1 = (CLKVAL_TFT_240320<<8) | (LCDTYPE_TFT<<5) | \
                  (BPPMODE_8BPP<<1) | (ENVID_DISABLE<<0);
        LCDCON2 = (VBPD_240320<<24) | (LINEVAL_TFT_240320<<14) | \
                  (VFPD_240320<<6) | (VSPW_240320);
        LCDCON3 = (HBPD_240320<<19) | (HOZVAL_TFT_240320<<8) | (HFPD_240320);
        LCDCON4 = HSPW_240320;
        LCDCON5 = (FORMAT8BPP_565<<11) | (HSYNC_INV<<9) | (VSYNC_INV<<8) | \
                  (BSWP<<1);
  #endif
  LCDCON1 = (8<<8) | (3<<5) | (0x0c<<1);  
   LCDCON2 = (14<<24) | (239<<14) | (11<<6) | (2<<0);
  LCDCON3 = (37<<19) | (319<<8) | (19<<0);
  LCDCON4 = 29;
   LCDCON5 = (1<<11) | (1<<10) | (1<<9)  | (0<<6) | (1<<8) | (1<<0);
  

       
        LCDSADDR1 = ((LCDFRAMEBUFFER>>22)<<21) | LOWER21BITS(LCDFRAMEBUFFER>>1);
        LCDSADDR2 = LOWER21BITS((LCDFRAMEBUFFER+ \
                    (LINEVAL_TFT_240320+1)*(HOZVAL_TFT_240320+1)*1)>>1);
        LCDSADDR3 = (0<<11) | (LCD_XSIZE_TFT_240320/2);

       
        TPAL = 0;

        fb_base_addr = LCDFRAMEBUFFER;
        bpp = 8;
   //     xsize = 240;
   //     ysize = 320;
         xsize = 320;
         ysize = 240;
        break;
       
    case MODE_TFT_16BIT_240320:
       
         #if 0
        LCDCON1 = (CLKVAL_TFT_240320<<8) | (LCDTYPE_TFT<<5) | \
                  (BPPMODE_16BPP<<1) | (ENVID_DISABLE<<0);
        LCDCON2 = (VBPD_240320<<24) | (LINEVAL_TFT_240320<<14) | \
                  (VFPD_240320<<6) | (VSPW_240320);
        LCDCON3 = (HBPD_240320<<19) | (HOZVAL_TFT_240320<<8) | (HFPD_240320);
        LCDCON4 = HSPW_240320;
        LCDCON5 = (FORMAT8BPP_565<<11) | (HSYNC_INV<<9) | (VSYNC_INV<<8) | \
                  (HWSWP<<1);
   #endif
  LCDCON1 = (8<<8) | (3<<5) | (0x0c<<1);  
   LCDCON2 = (14<<24) | (239<<14) | (11<<6) | (2<<0);
  LCDCON3 = (37<<19) | (319<<8) | (19<<0);
  LCDCON4 = 29;
   LCDCON5 = (1<<11) | (1<<10) | (1<<9)  | (0<<6) | (1<<8) | (1<<0);
  
   
       
        LCDSADDR1 = ((LCDFRAMEBUFFER>>22)<<21) | LOWER21BITS(LCDFRAMEBUFFER>>1);
        LCDSADDR2 = LOWER21BITS((LCDFRAMEBUFFER+ \
                    (239+1)*(319+1)*2)>>1);
        LCDSADDR3 = (0<<11) | (320*2/2);

       
        TPAL = 0;

        fb_base_addr = LCDFRAMEBUFFER;
        bpp = 16;
    //    xsize = 240;
    //    ysize = 320;
         xsize = 320;
         ysize = 240;

        break;
       
    case MODE_TFT_8BIT_640480:
       
        LCDCON1 = (CLKVAL_TFT_640480<<8) | (LCDTYPE_TFT<<5) | \
                  (BPPMODE_8BPP<<1) | (ENVID_DISABLE<<0);
        LCDCON2 = (VBPD_640480<<24) | (LINEVAL_TFT_640480<<14) | \
                  (VFPD_640480<<6) | (VSPW_640480);
        LCDCON3 = (HBPD_640480<<19) | (HOZVAL_TFT_640480<<8) | (HFPD_640480);
        LCDCON4 = HSPW_640480;
        LCDCON5 = (FORMAT8BPP_565<<11) | (HSYNC_INV<<9) | (VSYNC_INV<<8) | \
                  (BSWP<<1);

       
        LCDSADDR1 = ((LCDFRAMEBUFFER>>22)<<21) | LOWER21BITS(LCDFRAMEBUFFER>>1);
        LCDSADDR2 = LOWER21BITS((LCDFRAMEBUFFER+ \
                    (LINEVAL_TFT_640480+1)*(HOZVAL_TFT_640480+1)*1)>>1);
        LCDSADDR3 = (0<<11) | (LCD_XSIZE_TFT_640480/2);

       
        TPAL = 0;

        fb_base_addr = LCDFRAMEBUFFER;
        bpp = 8;
        xsize = 640;
        ysize = 480;
       
        break;
       
    case MODE_TFT_16BIT_640480:
       
        LCDCON1 = (CLKVAL_TFT_640480<<8) | (LCDTYPE_TFT<<5) | \
                  (BPPMODE_16BPP<<1) | (ENVID_DISABLE<<0);
        LCDCON2 = (VBPD_640480<<24) | (LINEVAL_TFT_640480<<14) | \
                  (VFPD_640480<<6) | (VSPW_640480);
        LCDCON3 = (HBPD_640480<<19) | (HOZVAL_TFT_640480<<8) | (HFPD_640480);
        LCDCON4 = HSPW_640480;
        LCDCON5 = (FORMAT8BPP_565<<11) | (HSYNC_INV<<9) | (VSYNC_INV<<8) | \
                  (HWSWP<<1);

       
        LCDSADDR1 = ((LCDFRAMEBUFFER>>22)<<21) | LOWER21BITS(LCDFRAMEBUFFER>>1);
        LCDSADDR2 = LOWER21BITS((LCDFRAMEBUFFER+ \
                    (LINEVAL_TFT_640480+1)*(HOZVAL_TFT_640480+1)*2)>>1);
        LCDSADDR3 = (0<<11) | (LCD_XSIZE_TFT_640480*2/2);

       
        TPAL = 0;

        fb_base_addr = LCDFRAMEBUFFER;
        bpp = 16;
        xsize = 640;
        ysize = 480;

        break;

    default:
        break;
    
}


void Lcd_Palette8Bit_Init(void)
{
    int i; 
    volatile unsigned int *palette;
 LCDCON1 &= ~0x01; // stop lcd controller
   
    LCDCON5 |= (FORMAT8BPP_565<<11); // 设置调色板中数据格式为5:6:5

    palette = (volatile unsigned int *)PALETTE;
    for (i = 0; i < 256; i++)
        *palette++ = DEMO256pal[i];
 LCDCON1 |= 0x01; // re-enable lcd controller
}


void ChangePalette(UINT32 color)
{
    int i;
    unsigned char red, green, blue;
    UINT32 *palette;

 red   = (color >> 19) & 0x1f;
 green = (color >> 10) & 0x3f;
 blue  = (color >>  3) & 0x1f;
 color = (red << 11) | (green << 5) | blue; // 格式5:6:5
   
    palette=(UINT32 *)PALETTE;
 LCDCON1 &= ~0x01; // stop lcd controller
    for (i = 0; i < 256; i++)
    {
//        while (((LCDCON5>>15) & 0x3) == 2);     // 等待直到VSTATUS不为”有效”
        *palette++ = color;
    }
 LCDCON1 |= 0x01; // re-enable lcd controller
}


void Lcd_PowerEnable(int invpwren, int pwren)
{
    GPGCON = (GPGCON & (~(3<<8))) | (3<<8);   // GPG4用作LCD_PWREN
    GPGUP  = (GPGUP & (~(1<<4))) | (1<<4);    // 禁止内部上拉
   
    LCDCON5 = (LCDCON5 & (~(1<<5))) | (invpwren<<5);  // 设置LCD_PWREN的极性: 正常/反转
    LCDCON5 = (LCDCON5 & (~(1<<3))) | (pwren<<3);     // 设置是否输出LCD_PWREN
  


void Lcd_EnvidOnOff(int onoff)
{
    if (onoff == 1)
    {
        LCDCON1 |= 1;         // ENVID ON
  GPBDAT |= (1<<0);   // Power on
    }
    else
    {
        LCDCON1 &= 0x3fffe;  // ENVID Off
     GPBDAT &= ~(1<<0);  // Power off
    }
  


void ClearScrWithTmpPlt(UINT32 color)
{
    TPAL = (1<<24)|((color & 0xffffff)<<0);
}


void DisableTmpPlt(void)
{
    TPAL = 0;
}

关键字:飞凌2440  lcd  调试 引用地址:飞凌2440 lcd 调试

上一篇:MIPS和ARM的架构比较
下一篇:arm2440的nandflash相关函数

推荐阅读最新更新时间:2024-03-16 14:50

S3C2440 (4.3寸)LCD驱动程序之层次分析(十六)
在上一节LCD层次分析时,得出写个LCD驱动入口函数,需要以下4步: 1)分配一个fb_info结构体:framebuffer_alloc(); 2)设置fb_info; 3)设置硬件相关的操作; 4)使能LCD,并注册fb_info:register_framebuffer(); 本节需要用到的函数: 函数dma_alloc_writecombine():(分配显存) void * dma_alloc_writecombine(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp);//分配DMA缓存区给现存 //返回值为:申请到
[单片机]
S3C<font color='red'>2440</font> (4.3寸)<font color='red'>LCD</font>驱动程序之层次分析(十六)
keil调试过程
在 Kei 里使用 DeBug 模式时,如要 查看外部 RAM 的数据 或查看 ACC 的内容 可以进行以下操作; sysGetTxMode: LCALL Com0185(C:2B95) JNB 0xE0.0,sysGetTxMode ........ ........ ret Com0185: MOV DPTR,#0x7020 MOVX A,@DPTR RRC A RRC A ANL A,#0x3F RET 1. 在Keil 调试的时候打开监视窗口; iframe id="iframe_0.37943524518050253" src="data:text/html;charset=utf8
[单片机]
keil<font color='red'>调试</font>过程
三星增产LCD屏主攻中端机联想华为
2014年韩国电子巨头三星的显示器部门SamsungDisplay将主攻中端市场设备的LCD液晶屏幕生产,并通过产量努力把成本降低,向市场推出更多的中端智能手机。而自家主打的AMOLED屏幕将减少生产,同时三星还承诺将降低至少10%的OLED面板价格。 韩媒称,高端智能手机市场已经趋于饱和,三星希望把接下来的重点放在新兴市场,比如印度和中国。毫无疑问,三星的新的业务重点不利于OLED产业发展。不过三星也曾多次明确表示,OLED是未来显示技术的主要发展趋势,而且将运用到更多高端设备中,三星还特别强调了柔性OLED屏幕的运用,并认为在2018年之前此类屏幕的市场份额将达到40%。当然,有传闻称,三星在2014年将尝试在其高端平板电脑中首
[嵌入式]
串口通信验证主控模块调试程序
1.主控模块调试过程 其测试程序为: #include reg51.h #include absa CC .h void delay() { int i,j; for(i=0;i 20000;i++); for (j=0;j 2000;j++);} void main() { unsigned int i; for(;;) ;无限循环执行以下发送接收语句 { TMOD=0x20; TH1=0xCC; TL1=0xcc; ;初始化T1 TR1=1; SCON=0X50; TI=0; P1=0xfe; ; LED 灭 delay(); ;延时
[单片机]
用80C31和SED1335控制三星LCD模块
韩国三星320×240LCD LCD模块是一款低价位高品质的LCD模块,具有高分辨率(点为0.27mm×0.27mm)、高对比度FSTN、高可靠性、低功耗、低价格等优点,特别适用于数控机床、PDA、掌上电脑、游戏机等产品。 SED1335是日本SEIKOEPSON公司出品的液晶显示控制器,在同类产品中是功能很强。其特点为:有较强功能的I/O缓冲器;指令功能丰富;四位数据并行发送;图形和文本方式混合显示。 SED1335指令集 SED1335有13条指令,多数指令带有参数,参数值由用户根据所控制的液晶显示模块的特征和显示的需要来设置。指令表如表1所示。 SED1335 液晶控制板是用于MPU系统与液晶模块之间的控制接口板,接收来
[电源管理]
关于示波器下EMI调试的关键
过去,示波器很难用于EMI调试,因为它没有捕获EMI辐射信号所需要的灵敏度,FFT频谱分析功能也不够强大,而且使用起来很复杂。 图1:R RTO数字示波器——低噪声前端和高级FFT分析能力使它成为强大的EMI调试工具 R&S公司的RTO数字示波器的出现,使情况完全改观。它在4GHz范围内都具有1mV/div灵敏度,有非常低的固有噪声,这使它成为使用近场探头捕获和分析EMI辐射的理想工具。基于EMC一致性测试结果,该示波器成为极为理想的实验室工具,可以快速了解有害辐射并查清这些辐射来源。 本篇文章用几个具体例子说明哪些示波器功能是成功进行EMI调试的关键。 基于频谱分析仪操作理念的FFT分析 快速傅立叶变换(Fast
[测试测量]
关于示波器下EMI<font color='red'>调试</font>的关键
加密系统调试_HCS12学习笔记(8)
最近搞了一下关于加密的调试,在此做个记录。 其实很简单,只是对#FF0F进行操作一下就可以了,具体位操作详见S12FTS256KV2.PDF,寄存器FESC。 在MAIN.C的最后加上 const volatile unsigned char SecureReg @(0xFF0F)=0xFC; 即可,注意VOLATILE字样,如果没有的话,可能被DUBUG掉。 我对所有的程序进行了调试,一切正常,只有在涉及到FLASH擦写时,程序无法正常运行,或者把程序段放入FLASH分页时无法正常运行。查了N多资料,未果。 于是找了FREESCALE的技术支持,交流过后发现,是我芯片型号的问题,
[单片机]
基于ARM的LCD触摸屏系统设计
引言 随着嵌入式系统技术的飞速发展,工业设备产品也越来越现代化,普遍要求可视化操作。LCD触摸屏低耗能.散热小,成本低,纤薄轻巧,外形尺寸小,安装容易。使用LCD触摸屏作为工业设备的输入输出设备既能达到可视化的要求,方便现场操作,又能降低产品的成本。而在产品的整体设计过程中,人机交互界面的设计往往占据着很大一部分工作,这样,不但极大地增加了产品的开发成本瓶且延长了产品的上市周期。本文设计的基于S3C44BOX的人机交互界面是一种可定制、简单易用、性能优良的通用型人机交互界面,能很好地解决上述问题。 1 系统结构 系统主要包括三个部分,分别为PC机、S3C4480X微处理器和LCD触摸屏模块。系统结构框图如图1所示
[单片机]
基于ARM的<font color='red'>LCD</font>触摸屏系统设计
小广播
添点儿料...
无论热点新闻、行业分析、技术干货……
设计资源 培训 开发板 精华推荐

最新单片机文章
何立民专栏 单片机及嵌入式宝典

北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。

换一换 更多 相关热搜器件
随便看看
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved