Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Using the 2.4'' LCD-Display integrated in the SAM3U-EK
PostPosted: Mon Jun 27, 2011 10:20 am 
Offline

Joined: Mon Jun 27, 2011 10:04 am
Posts: 1
Hey guys,

I'm at the moment on an internship and I set myself the task to draw something on the LCD-Display.
The problem is that I'm totally new in programming a board. I tried to use the driver included in the test software, but it doesn't work.
I used the idea of the driver and tried to build my own functions:

typedef volatile unsigned short REG16;
#define LCD_IR(baseAddr) (*((REG16 *)(baseAddr)))
#define LCD_D(baseAddr) (*((REG16 *)((unsigned int)(baseAddr) + (1 << 1))))

//defintion of R..H


void WriteReg( void *pLcdBase, int reg, int data)
{

LCD_IR(pLcdBase) = reg;
LCD_D(pLcdBase) = data;
}

void LCD_Initialize ( void *pLcdBase ) {
WriteReg(pLcdBase, R19H, 0x49); // OSCADJ=10 0000, OSD_EN=1 //60Hz
WriteReg(pLcdBase, R93H, 0x0C); // RADJ=1100

// Power on flow
WriteReg(pLcdBase, R44H, 0x4D); // VCM=100 1101
WriteReg(pLcdBase, R45H, 0x11); // VDV=1 0001
WriteReg(pLcdBase, R20H, 0x40); // BT=0100
WriteReg(pLcdBase, R1DH, 0x07); // VC1=111
WriteReg(pLcdBase, R1EH, 0x00); // VC3=000
WriteReg(pLcdBase, R1FH, 0x04); // VRH=0100

WriteReg(pLcdBase, R1CH, 0x04); // AP=100
WriteReg(pLcdBase, R1BH, 0x10); // GASENB=0, PON=1, DK=0, XDK=0, DDVDH_TRI=0, STB=0
delay(50);

WriteReg(pLcdBase, R43H, 0x80); // Set VCOMG=1
delay(50);

// Gamma for CMO 2.8
WriteReg(pLcdBase, R46H, 0x95);
WriteReg(pLcdBase, R47H, 0x51);
WriteReg(pLcdBase, R48H, 0x00);
WriteReg(pLcdBase, R49H, 0x36);
WriteReg(pLcdBase, R4AH, 0x11);
WriteReg(pLcdBase, R4BH, 0x66);
WriteReg(pLcdBase, R4CH, 0x14);
WriteReg(pLcdBase, R4DH, 0x77);
WriteReg(pLcdBase, R4EH, 0x13);
WriteReg(pLcdBase, R4FH, 0x4C);
WriteReg(pLcdBase, R50H, 0x46);
WriteReg(pLcdBase, R51H, 0x46);

//240x320 window setting
WriteReg(pLcdBase, R02H, 0x00); // Column address start2
WriteReg(pLcdBase, R03H, 0x00); // Column address start1
WriteReg(pLcdBase, R04H, 0x00); // Column address end2
WriteReg(pLcdBase, R05H, 0xEF); // Column address end1
WriteReg(pLcdBase, R06H, 0x00); // Row address start2
WriteReg(pLcdBase, R07H, 0x00); // Row address start1
WriteReg(pLcdBase, R08H, 0x01); // Row address end2
WriteReg(pLcdBase, R09H, 0x3F); // Row address end1

// Display Setting
WriteReg(pLcdBase, R01H, 0x06); // IDMON=0, INVON=1, NORON=1, PTLON=0
WriteReg(pLcdBase, R16H, 0xC8); // MY=1, MX=1, MV=0, BGR=1
WriteReg(pLcdBase, R23H, 0x95); // N_DC=1001 0101
WriteReg(pLcdBase, R24H, 0x95); // P_DC=1001 0101
WriteReg(pLcdBase, R25H, 0xFF); // I_DC=1111 1111
WriteReg(pLcdBase, R27H, 0x06); // N_BP=0000 0110
WriteReg(pLcdBase, R28H, 0x06); // N_FP=0000 0110
WriteReg(pLcdBase, R29H, 0x06); // P_BP=0000 0110
WriteReg(pLcdBase, R2AH, 0x06); // P_FP=0000 0110
WriteReg(pLcdBase, R2CH, 0x06); // I_BP=0000 0110
WriteReg(pLcdBase, R2DH, 0x06); // I_FP=0000 0110
WriteReg(pLcdBase, R3AH, 0x01); // N_RTN=0000, N_NW=001
WriteReg(pLcdBase, R3BH, 0x01); // P_RTN=0000, P_NW=001
WriteReg(pLcdBase, R3CH, 0xF0); // I_RTN=1111, I_NW=000
WriteReg(pLcdBase, R3DH, 0x00); // DIV=00
WriteReg(pLcdBase, R3EH, 0x38); // SON=38h
WriteReg(pLcdBase, R40H, 0x0F); // GDON=0Fh
WriteReg(pLcdBase, R41H, 0xF0); // GDOF=F0h
}

void LCD_WriteRAM_Prepare( void *pLcdBase )
{
LCD_IR(pLcdBase) = R22H;
}


void LCD_WriteRAM( void *pLcdBase, unsigned short color24 )
{
unsigned short color16 = RGB24ToRGB16(color24);
LCD_D(pLcdBase) = color16;
}



and I call it this way:

#define LCD_BASE_ADDR 0x62000000


LCD_Initialize((void *)LCD_BASE_ADDR);
LCD_On((void *)LCD_BASE_ADDR);

LCD_SetCursor((void *)LCD_BASE_ADDR, 0, 0);
LCD_WriteRAM_Prepare((void *)LCD_BASE_ADDR);
for (i = 0; i < (240 * 20); i++)
{
LCD_WriteRAM((void *)LCD_BASE_ADDR, 0xFF0000);
}



And nothing happens... what am I doing wrong?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: