lpcware

LCD Orientation Issue

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by rmoss on Mon Jan 28 08:53:50 MST 2013
I am using the LCP1788 with DisplayTech 2.8" LCD (320x240, 16bpp RGB Mode).  The screen buffer managed by emWin is located in external Static RAM at address 0x90000000.  I have an image on the screen, however it is rotated 90 degrees.  An image is attached that shows the rotation issue.  Is there a register setting that is setup incorrectly or needs to be added to correct this issue?  Here are my LCD setup register values:

#define TIMH_HBP20// Horizontal Back Porch
#define TIMH_HFP10// Horizontal Front Porch
#define TIMH_HSW10// Horizontal Synchronization pulse width
#define TIMH_PPL19// Pixels per line
#define TIMH_RSV0// Reserved

#define TIMV_VBP2// Vertical Back Porch
#define TIMV_VFP4// Vertical Front Porch
#define TIMV_VSW2// Vertical Synchronization pulse width
#define TIMV_LPP239

#define POL_PCD_HI0
#define POL_BCD    0
#define POL_CPL    319
#define POL_RSV    0
#define POL_IOE    0
#define POL_IPC    0
#define POL_IHS    1
#define POL_IVS 1
#define POL_ACB    0
#define POL_CLKSEL0
#define POL_PCD_LO1

/* LCD IO Setup */
LPC_IOCON->P2_12 = (PIN_FUNC_LCDVD_3 | PIN_MODE_PLAIN);     /* LCDVD[3] */
LPC_IOCON->P2_6 = (PIN_FUNC_LCDVD_4 | PIN_MODE_PLAIN);      /* LCDVD[4] */
LPC_IOCON->P2_7 = (PIN_FUNC_LCDVD_5 | PIN_MODE_PLAIN);      /* LCDVD[5] */
LPC_IOCON->P1_20 = (PIN_FUNC_LCDVD_6 | PIN_MODE_PLAIN);     /* LCDVD[6] */
LPC_IOCON->P1_21 = (PIN_FUNC_LCDVD_7 | PIN_MODE_PLAIN);     /* LCDVD[7] */ 
 
LPC_IOCON->P4_28 = (PIN_FUNC_LCDVD_10 | PIN_MODE_PLAIN);   /* LCDVD[10] */
LPC_IOCON->P4_29 = (PIN_FUNC_LCDVD_11 | PIN_MODE_PLAIN);   /* LCDVD[11] */
LPC_IOCON->P1_22 = (PIN_FUNC_LCDVD_12 | PIN_MODE_PLAIN);   /* LCDVD[12] */
LPC_IOCON->P1_23 = (PIN_FUNC_LCDVD_13 | PIN_MODE_PLAIN);   /* LCDVD[13] */
LPC_IOCON->P1_24 = (PIN_FUNC_LCDVD_14 | PIN_MODE_PLAIN);   /* LCDVD[14] */
LPC_IOCON->P1_25 = (PIN_FUNC_LCDVD_15 | PIN_MODE_PLAIN);   /* LCDVD[15] */
 
LPC_IOCON->P2_13 = (PIN_FUNC_LCDVD_19 | PIN_MODE_PLAIN);   /* LCDVD[19] */
LPC_IOCON->P1_26 = (PIN_FUNC_LCDVD_20 | PIN_MODE_PLAIN);   /* LCDVD[20] */
LPC_IOCON->P1_27 = (PIN_FUNC_LCDVD_21 | PIN_MODE_PLAIN);   /* LCDVD[21] */
LPC_IOCON->P1_28 = (PIN_FUNC_LCDVD_22 | PIN_MODE_PLAIN);   /* LCDVD[22] */
LPC_IOCON->P1_29 = (PIN_FUNC_LCDVD_23 | PIN_MODE_PLAIN);   /* LCDVD[23] */

LPC_IOCON->P2_0 = (PIN_FUNC_LCD_PWR | PIN_MODE_PLAIN);           /* LCD_PWR */
LPC_IOCON->P2_2 = (PIN_FUNC_LCD_DCLK | PIN_MODE_PLAIN | HYSTERESIS_MODE);          /* LCD_DCLK */
LPC_IOCON->P2_3 = (PIN_FUNC_LCD_FP | PIN_MODE_PLAIN);            /* LCD_FP - V SYNCH */
LPC_IOCON->P2_4 = (PIN_FUNC_LCD_ENAB_M | PIN_MODE_PLAIN);        /* LCD_ENAB_M */
LPC_IOCON->P2_5 = (PIN_FUNC_LCD_LP | PIN_MODE_PLAIN);            /* LCD_LP - H SYNCH*/

LPC_LCD->CTRL = 0;  // turn off LCD if on
LPC_LCD->INTCLR = 0x1F;  // CLEAR ANY PENDING IRQS


LPC_LCD->TIMH = (TIMH_HBP<<24) |   \
                  (TIMH_HFP<<16) | \
                  (TIMH_HSW<<8) |  \
                  (TIMH_PPL<<2) |  \
                  (TIMH_RSV<<0);
 
LPC_LCD->TIMV = (TIMV_VBP<<24) |    \
                  (TIMV_VFP<<16) |  \
                  (TIMV_VSW<<10) |  \
                  (TIMV_LPP<<0);

LPC_LCD->POL = (POL_PCD_HI<<27) | \
                 (POL_BCD<<26) |  \
                 (POL_CPL<<16) |  \
                 (POL_RSV<<15) |  \
                 (POL_IOE<<14) |  \
                 (POL_IPC<<13) |  \
                 (POL_IHS<<12) |  \
                 (POL_IVS<<11) |  \
                 (POL_ACB<<6) |   \
                 (POL_CLKSEL<<5) | \
                 (POL_PCD_LO<<0);

LPC_LCD->LE = 0;

LPC_LCD->UPBASE = 0x90000000;  // sets the frame buffer address

LPC_LCD->LPBASE = 0x00000000;
LPC_LCD->INTMSK = 0;// NO INTERRUPTS FROM LCD

LPC_LCD->CTRL = 0x0000082D;  // RGB 565

LPC_SC->LCD_CFG = 0x07;  // No panel clock prescaler

Thanks,
RMoss

Outcomes