Author Topic: Sharp LQ043 4.3" 480x272 TFT  (Read 22262 times)

Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
Sharp LQ043 4.3" 480x272 TFT
« on: July 20, 2010, 03:14:48 AM »
I found an LPC2478 development board that has the Sharp LQ043 4.3" 480x272 TFT instead of the 3.5" display on the OLIMEX board.

I've got utasker and an SD Card working on the board. 

Now I'm going to try and get the tft going.

Has anyone else got the LQ043 http://www.sparkfun.com/commerce/product_info.php?products_id=8335 working with the LPC2478?

-Kevin

Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Sharp LQ043 4.3" 480x272 TFT
« Reply #1 on: July 20, 2010, 03:52:58 PM »
Mark-
 
 First I want to say the simulator is a great tool.  The new development board had access to SPI0 on port 2.  After reconfiguring utasker, I checked the pins on the simulator to see that they were assigned correctly.  With the simulator, I could see that the SSEL line had not been programmed correctly and was able to correct it without touching the HW.  SDCARD worked the first time I flashed the image in the new board.


One question:
I had to quit last night because it was getting late, but I could not find how to change the simulator TFT to 480x272.  Where is that configured?

-Kevin

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3240
    • View Profile
    • uTasker
Re: Sharp LQ043 4.3" 480x272 TFT
« Reply #2 on: July 20, 2010, 07:17:47 PM »
Hi Kevin

The display size if set in config.h:

    #define GLCD_X                 320                                   // horizontal resolution of the LCD display in pixels
    #define GLCD_Y                 240                                   // vertical resolution of the LCD display in pixels



However the different TFT types usually require different initialisations. Also they may use different color formatting and commands to set up the write coordinates and graphical windows. Therefore it is not very likely that the TFT code from the Olimex board is compatible. The simulator may work with different display size setting but this will assume the same controller, which doesn't necessarily mean that it will behave on the real HW.

Usually you will be able to find a reference driver which helps in case of adaptations.

Regards

Mark

Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Sharp LQ043 4.3" 480x272 TFT
« Reply #3 on: July 21, 2010, 06:49:37 AM »
Wow it worked great!

Once I got the 480x272 working in the simulator, I tried it out on the target and it worked

some pixels are off color, bit mainly noticeable in fine gradients. I'll have to work on the color space.

I changed tft.c based on the LQ043 datasheet

Code: [Select]
#define PIXEL_CLOCK_RATE         9000000 //9Mhz
#define HORIZONTAL_BACK_PORCH    2 //2 clocks
#define HORIZONTAL_FRONT_PORCH   2 //2 clocks
#define HORIZONTAL_PULSE         41 //41 clocks
#define VERTICAL_BACK_PORCH      2 //2 lines
#define VERTICAL_FRONT_PORCH     2 //2 lines
#define VERTICAL_PULSE           10 //10 lines
#elif defined OLIMEX_LPC2478_STK
#define PIXEL_CLOCK_RATE         6400000
#define HORIZONTAL_BACK_PORCH    38
#define HORIZONTAL_FRONT_PORCH   20
#define HORIZONTAL_PULSE         30
#define VERTICAL_BACK_PORCH      15
#define VERTICAL_FRONT_PORCH     5
#define VERTICAL_PULSE           3
#endif

and config .h
Code: [Select]
#define SUPPORT_TFT
#define LCD_PARTNER_TASK       TASK_APPLICATION
#define GLCD_X                 480                                   // horizontal resolution of the LCD display in pixels
#define GLCD_Y                 272                                   // vertical resolution of the LCD display in pixels
#define LCD_PIXEL_COLOUR       (COLORREF)RGB(255,255,255)
#define GLCD_COLOR                                                   // color GLCD being used
#define LCD_ON_COLOUR          (COLORREF)RGB(0,0,0)                  // RGB colour of LCD when backlight is on
#define LCD_OFF_COLOUR         (COLORREF)RGB(0,0,0)                  // RGB colour of LCD when backlight is off
    #elif defined OLIMEX_LPC2478_STK
   #define SUPPORT_TFT
#define LCD_PARTNER_TASK       TASK_APPLICATION
#define GLCD_X                 320                                   // horizontal resolution of the LCD display in pixels
#define GLCD_Y                 240                                   // vertical resolution of the LCD display in pixels
#define LCD_PIXEL_COLOUR       (COLORREF)RGB(255,255,255)
#define GLCD_COLOR                                                   // color GLCD being used
#define LCD_ON_COLOUR          (COLORREF)RGB(0,0,0)                  // RGB colour of LCD when backlight is on
#define LCD_OFF_COLOUR         (COLORREF)RGB(0,0,0)                  // RGB colour of LCD when backlight is off
    #endif

Here is a shot of the display (You can see the pixels set to the wrong colors)


original is located at http://static.cargurus.com/images/site/2009/12/03/05/51/2009_ferrari_f430_spider-pic-5687950062379790964.jpeg

-Kevin

« Last Edit: July 21, 2010, 01:55:59 PM by Kevin »

Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Sharp LQ043 4.3" 480x272 TFT
« Reply #4 on: August 13, 2010, 10:01:45 PM »
Found the fix for the noisy picture - Don't invert the panel clock.

Picture looks great!

#if defined TFT_LQ043
   LCD_POL    = (BYPASS_PIXEL_CLOCK_DIVIDER | INVERT_VERT_SYNC | INVERT_HORIZ_SYNC | ((GLCD_X-1) << 16));
#else
   LCD_POL    = (BYPASS_PIXEL_CLOCK_DIVIDER | INVERT_VERT_SYNC | INVERT_HORIZ_SYNC | INVERT_PANEL_CLOCK | ((GLCD_X-1) << 16));
#endif

-Kevin