Problem FEZ Touch

Hy. I am trying to program the following LCD (http://www.ghielectronics.com/catalog/product/262) which use the ILI9325 controller. I modified the code given for HX8347 (http://mbed.org/users/Suky/programs/LCDTFT_Library/llv383) to ca work with the ILI9325, i changed all the register. i used 16bit data in 8bit parallel interface. But it’s not work and i don’t know were is the problem. i used mbed which is based on the LPC11U24

there is the important part of code :


enum
{
  ILI9325_COMMANDS_DRIVERCODEREAD                 = 0x0000,
  ILI9325_COMMANDS_DRIVEROUTPUTCONTROL1           = 0x0001,
  ILI9325_COMMANDS_LCDDRIVINGCONTROL              = 0x0002,
  ILI9325_COMMANDS_ENTRYMODE                      = 0x0003,
  ILI9325_COMMANDS_RESIZECONTROL                  = 0x0004,
  ILI9325_COMMANDS_DISPLAYCONTROL1                = 0x0007,
  ILI9325_COMMANDS_DISPLAYCONTROL2                = 0x0008,
  ILI9325_COMMANDS_DISPLAYCONTROL3                = 0x0009,
  ILI9325_COMMANDS_DISPLAYCONTROL4                = 0x000A,
  ILI9325_COMMANDS_RGBDISPLAYINTERFACECONTROL1    = 0x000C,
  ILI9325_COMMANDS_FRAMEMAKERPOSITION             = 0x000D,
  ILI9325_COMMANDS_RGBDISPLAYINTERFACECONTROL2    = 0x000F,
  ILI9325_COMMANDS_POWERCONTROL1                  = 0x0010,
  ILI9325_COMMANDS_POWERCONTROL2                  = 0x0011,
  ILI9325_COMMANDS_POWERCONTROL3                  = 0x0012,
  ILI9325_COMMANDS_POWERCONTROL4                  = 0x0013,
  ILI9325_COMMANDS_HORIZONTALGRAMADDRESSSET       = 0x0020,
  ILI9325_COMMANDS_VERTICALGRAMADDRESSSET         = 0x0021,
  ILI9325_COMMANDS_WRITEDATATOGRAM                = 0x0022,
  ILI9325_COMMANDS_POWERCONTROL7                  = 0x0029,
  ILI9325_COMMANDS_FRAMERATEANDCOLORCONTROL       = 0x002B,
  ILI9325_COMMANDS_GAMMACONTROL1                  = 0x0030,
  ILI9325_COMMANDS_GAMMACONTROL2                  = 0x0031,
  ILI9325_COMMANDS_GAMMACONTROL3                  = 0x0032,
  ILI9325_COMMANDS_GAMMACONTROL4                  = 0x0035,
  ILI9325_COMMANDS_GAMMACONTROL5                  = 0x0036,
  ILI9325_COMMANDS_GAMMACONTROL6                  = 0x0037,
  ILI9325_COMMANDS_GAMMACONTROL7                  = 0x0038,
  ILI9325_COMMANDS_GAMMACONTROL8                  = 0x0039,
  ILI9325_COMMANDS_GAMMACONTROL9                  = 0x003C,
  ILI9325_COMMANDS_GAMMACONTROL10                 = 0x003D,
  ILI9325_COMMANDS_HORIZONTALADDRESSSTARTPOSITION = 0x0050,
  ILI9325_COMMANDS_HORIZONTALADDRESSENDPOSITION   = 0x0051,
  ILI9325_COMMANDS_VERTICALADDRESSSTARTPOSITION   = 0x0052,
  ILI9325_COMMANDS_VERTICALADDRESSENDPOSITION     = 0x0053,
  ILI9325_COMMANDS_DRIVEROUTPUTCONTROL2           = 0x0060,
  ILI9325_COMMANDS_BASEIMAGEDISPLAYCONTROL        = 0x0061,
  ILI9325_COMMANDS_VERTICALSCROLLCONTROL          = 0x006A,
  ILI9325_COMMANDS_PARTIALIMAGE1DISPLAYPOSITION   = 0x0080,
  ILI9325_COMMANDS_PARTIALIMAGE1AREASTARTLINE     = 0x0081,
  ILI9325_COMMANDS_PARTIALIMAGE1AREAENDLINE       = 0x0082,
  ILI9325_COMMANDS_PARTIALIMAGE2DISPLAYPOSITION   = 0x0083,
  ILI9325_COMMANDS_PARTIALIMAGE2AREASTARTLINE     = 0x0084,
  ILI9325_COMMANDS_PARTIALIMAGE2AREAENDLINE       = 0x0085,
  ILI9325_COMMANDS_PANELINTERFACECONTROL1         = 0x0090,
  ILI9325_COMMANDS_PANELINTERFACECONTROL2         = 0x0092,
  ILI9325_COMMANDS_PANELINTERFACECONTROL3         = 0x0093,
  ILI9325_COMMANDS_PANELINTERFACECONTROL4         = 0x0095,
  ILI9325_COMMANDS_PANELINTERFACECONTROL5         = 0x0097,
  ILI9325_COMMANDS_PANELINTERFACECONTROL6         = 0x0098,
  ILI9325_COMMANDS_OTPVCMPROGRAMMINGCONTROL       = 0x00A1,
  ILI9325_COMMANDS_OTPVCMSTATUSANDENABLE          = 0x00A2,
  ILI9325_COMMANDS_OTPPROGRAMMINGIDKEY            = 0x00A5
};


 #include "LCDTFT_16bitto8bit.h"

LCDTFT::LCDTFT(PinName PIN_RD

,PinName PIN_WR,PinName PIN_RS,PinName PIN_CS,PinName PIN_RESET, BusInOut *BUSLCD)
: LCD_PIN_RD(PIN_RD),LCD_PIN_WR(PIN_WR),LCD_PIN_RS(PIN_RS),LCD_PIN_CS(PIN_CS),LCD_PIN_RESET(PIN_RESET){
LCD_PORT=BUSLCD;
X=0;
Y=0;
X_min=0;
X_max=LCD_X_MAX;
_Alto=1;
_Color=0x0000;
}

void LCDTFT::vLCDTFTSetParametersPrintf(uint16_t Xo,uint16_t Yo,uint16_t Xmin,uint16_t Xmax,unsigned char Alto, uint16_t Color){

X=Xo;
Y=Yo;
X_min=Xmin;
X_max=Xmax;
_Alto=Alto;
_Color=Color;

}

int LCDTFT::_putc(int value){
char Fmt[2]={value,0};

if(value=='\n'){
    X=X_min;
    Y+=7*_Alto + 1;
}else{
    vLCDTFTText(X,Y,(const char *)&Fmt[0],&ARIAL[0],_Alto,_Color);
    X+=5*_Alto+1;
    if(X >= X_max){
        X = X_min;                           
        Y += 7*_Alto + 1;                
    }
}
return(value);

}

int LCDTFT::_getc(){
return(-1);
}

//
/*!
@ brief Writes the supplied 16-bit command using an 8-bit interface
*/
/
/
void LCDTFT::vLCDTFTWriteCommand(uint16_t Command){

LCD_PIN_CS=0;
LCD_PIN_RS=0;
LCD_PIN_WR=1;
LCD_PIN_RD=1;
LCD_PORT->write(Command >> 8);   
LCD_PIN_WR=0;
wait_ms(100);
LCD_PIN_WR=1;
LCD_PORT->write(Command);
LCD_PIN_WR=0;
wait_ms(100);
LCD_PIN_WR=1;
LCD_PIN_CS=1;  

}

//
/*!
@ brief Writes the supplied 16-bit data using an 8-bit interface
*/
/
/
void LCDTFT::vLCDTFTWriteData(uint16_t Data){

LCD_PIN_CS=0;
LCD_PIN_WR=1;
LCD_PIN_RS=1; 
LCD_PIN_RD=1;
LCD_PORT->write(Data >> 8);   
LCD_PIN_WR=0;
wait_ms(100);
LCD_PIN_WR=1;
LCD_PORT->write(Data);
LCD_PIN_WR=0;
wait_ms(100);
LCD_PIN_WR=1;
LCD_PIN_CS =1; 

}
//
/*!
@ brief Sends a 16-bit command + 16-bit data
*/
/
/
void LCDTFT::vLCDTFTWriteCommandData(uint16_t Command,uint16_t Data){
vLCDTFTWriteCommand(Command);
vLCDTFTWriteData(Data);
}
//
/*!
@ brief Sets the cursor to the specified X/Y position
*/
/
/
void LCDTFT::vLCDTFTAddressSetPoint(uint16_t x,uint16_t y){

vLCDTFTWriteCommandData(ILI9325_COMMANDS_HORIZONTALGRAMADDRESSSET,x); 
vLCDTFTWriteCommandData(ILI9325_COMMANDS_VERTICALGRAMADDRESSSET,y); 
vLCDTFTWriteCommand(0x0022);

}
//
/*!
@ brief Sets the window confines
*/
/
/
void LCDTFT::vLCDTFTAddressSet(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2){
// vLCDTFTAddressSet(PosXImagen, y, PosXImagen+WidthPixel-1, y);

vLCDTFTWriteCommandData(ILI9325_COMMANDS_HORIZONTALADDRESSSTARTPOSITION, x1);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_HORIZONTALADDRESSENDPOSITION, x2);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_VERTICALADDRESSSTARTPOSITION, y1);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_VERTICALADDRESSENDPOSITION, y2);
vLCDTFTAddressSetPoint(x1, y1);

}
//
/*!
@ brief Sends the initialisation sequence to the display controller
*/
/
/
void LCDTFT::vLCDTFTInit(void){ // Initialize the ILI9225 lcd driver. return 0 if initial succeded

LCD_PIN_RD=1;
LCD_PIN_WR=1;
LCD_PIN_CS=1;
LCD_PIN_RS=1;

LCD_PIN_RESET=1;
wait_ms(100);   
LCD_PIN_RESET=0;
wait_ms(100);
LCD_PIN_RESET=1;
wait_ms(100);
    
vLCDTFTWriteCommandData(ILI9325_COMMANDS_DRIVERCODEREAD, 0x0001);  // Star oscillator
wait_ms(50);

vLCDTFTWriteCommandData(ILI9325_COMMANDS_DRIVEROUTPUTCONTROL1, 0x0100);  // Driver Output Control Register (R01h)
vLCDTFTWriteCommandData(ILI9325_COMMANDS_LCDDRIVINGCONTROL, 0x0700);     // LCD Driving Waveform Control (R02h)
vLCDTFTWriteCommandData(ILI9325_COMMANDS_ENTRYMODE, 0x1030);             // Entry Mode (R03h)
vLCDTFTWriteCommandData(ILI9325_COMMANDS_RESIZECONTROL, 0x0000);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_DISPLAYCONTROL2, 0x0202);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_DISPLAYCONTROL3, 0x0000);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_DISPLAYCONTROL4, 0x0000);       // Fmark On
vLCDTFTWriteCommandData(ILI9325_COMMANDS_RGBDISPLAYINTERFACECONTROL1, 0x0000);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_FRAMEMAKERPOSITION, 0x0000);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_RGBDISPLAYINTERFACECONTROL2, 0x0000);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_POWERCONTROL1, 0x0000);         // Power Control 1 (R10h)
vLCDTFTWriteCommandData(ILI9325_COMMANDS_POWERCONTROL2, 0x0007);         // Power Control 2 (R11h)
vLCDTFTWriteCommandData(ILI9325_COMMANDS_POWERCONTROL3, 0x0000);         // Power Control 3 (R12h)
vLCDTFTWriteCommandData(ILI9325_COMMANDS_POWERCONTROL4, 0x0000);         // Power Control 4 (R13h)
wait_ms(200);

vLCDTFTWriteCommandData(ILI9325_COMMANDS_POWERCONTROL1, 0x1690);         // Power Control 1 (R10h)
vLCDTFTWriteCommandData(ILI9325_COMMANDS_POWERCONTROL2, 0x0227);         // Power Control 2 (R11h)
wait_ms(50);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_POWERCONTROL3, 0x001A);         // Power Control 3 (R12h)
wait_ms(50);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_POWERCONTROL4, 0x1800);         // Power Control 4 (R13h)
vLCDTFTWriteCommandData(ILI9325_COMMANDS_POWERCONTROL7, 0x002A);         // NVM read data 2 (R29h)
wait_ms(50);

vLCDTFTWriteCommandData(ILI9325_COMMANDS_GAMMACONTROL1, 0x0000);         // Gamma Control 1
vLCDTFTWriteCommandData(ILI9325_COMMANDS_GAMMACONTROL2, 0x0000);         // Gamma Control 2
vLCDTFTWriteCommandData(ILI9325_COMMANDS_GAMMACONTROL3, 0x0000);         // Gamma Control 3
vLCDTFTWriteCommandData(ILI9325_COMMANDS_GAMMACONTROL4, 0x0206);         // Gamma Control 4
vLCDTFTWriteCommandData(ILI9325_COMMANDS_GAMMACONTROL5, 0x0808);         // Gamma Control 5
vLCDTFTWriteCommandData(ILI9325_COMMANDS_GAMMACONTROL6, 0x0007);         // Gamma Control 6
vLCDTFTWriteCommandData(ILI9325_COMMANDS_GAMMACONTROL7, 0x0201);         // Gamma Control 7
vLCDTFTWriteCommandData(ILI9325_COMMANDS_GAMMACONTROL8, 0x0000);         // Gamma Control 8
vLCDTFTWriteCommandData(ILI9325_COMMANDS_GAMMACONTROL9, 0x0000);         // Gamma Control 9
vLCDTFTWriteCommandData(ILI9325_COMMANDS_GAMMACONTROL10, 0x0000);        // Gamma Control 10

vLCDTFTWriteCommandData(ILI9325_COMMANDS_HORIZONTALGRAMADDRESSSET, 0x0000);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_VERTICALGRAMADDRESSSET, 0x0000);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_HORIZONTALADDRESSSTARTPOSITION, 0x0000);                      // Window Horizontal RAM Address Start (R50h)
vLCDTFTWriteCommandData(ILI9325_COMMANDS_HORIZONTALADDRESSENDPOSITION, 0x00EF); // ili9325Properties.width - 1);   // Window Horizontal RAM Address End (R51h)
vLCDTFTWriteCommandData(ILI9325_COMMANDS_VERTICALADDRESSSTARTPOSITION, 0x0000);                        // Window Vertical RAM Address Start (R52h)
vLCDTFTWriteCommandData(ILI9325_COMMANDS_VERTICALADDRESSENDPOSITION, 0x013F); // ili9325Properties.height - 1);    // Window Vertical RAM Address End (R53h)

vLCDTFTWriteCommandData(ILI9325_COMMANDS_DRIVEROUTPUTCONTROL2, 0xA700);    // Driver Output Control (R60h)
vLCDTFTWriteCommandData(ILI9325_COMMANDS_BASEIMAGEDISPLAYCONTROL, 0x0003); // Driver Output Control (R61h) - enable VLE
vLCDTFTWriteCommandData(ILI9325_COMMANDS_VERTICALSCROLLCONTROL, 0x0000);

vLCDTFTWriteCommandData(ILI9325_COMMANDS_PANELINTERFACECONTROL1, 0x0010);  // Panel Interface Control 1 (R90h)
vLCDTFTWriteCommandData(ILI9325_COMMANDS_PANELINTERFACECONTROL2, 0x0000);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_PANELINTERFACECONTROL3, 0x0003);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_PANELINTERFACECONTROL4, 0x1100);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_PANELINTERFACECONTROL5, 0x0000);
vLCDTFTWriteCommandData(ILI9325_COMMANDS_PANELINTERFACECONTROL6, 0x0000);

// Display On
vLCDTFTWriteCommandData(ILI9325_COMMANDS_DISPLAYCONTROL1, 0x0133);     // Display Control (R07h)
wait_ms(100);
vLCDTFTWriteCommand(ILI9325_COMMANDS_WRITEDATATOGRAM);

}
//
/*!
@ brief Assign background color
*/
/
/
void LCDTFT::vLCDTFTFillScreen(uint16_t Color){
uint16_t i,j;

vLCDTFTAddressSet(0,0,239,319);
vLCDTFTWriteCommand(ILI9325_COMMANDS_WRITEDATATOGRAM);

//LCD_PIN_CS=0;
//LCD_PIN_RS=1; 
//LCD_PIN_RD=1;
//LCD_PIN_WR=1;

for(i=0;i<320;i++){
    for (j=0;j<240;j++){
        vLCDTFTWriteData(Color);
    }
} 
//LCD_PIN_CS=1;     

}
//
/*!
@ brief Draws a single pixel at the specified X/Y location
*/
/
/
void LCDTFT::vLCDTFTPoint(uint16_t x,uint16_t y,uint16_t Color){

vLCDTFTAddressSetPoint(x,y);
vLCDTFTWriteCommand(ILI9325_COMMANDS_WRITEDATATOGRAM);  // Write Data to GRAM (R22h) 
vLCDTFTWriteData(Color);

}

#include “mbed.h”
#include “LCDTFT_16bitto8bit.h”
// LCDTFT(PIN_RD , PIN_WR , PIN_RS , PIN_CS , PIN_RESET , BusOut *BUSLCD);

BusInOut MyBus(p29,p22,p23,p24,p25,p26,p27,p28);
PwmOut BL(p21);
LCDTFT MyLCD(p19,p18,p17,p16,p20,&MyBus);

int main(){

MyLCD.vLCDTFTInit();
MyLCD.vLCDTFTFillScreen(ColorRed);
MyLCD.vLCDTFTSetParametersPrintf(10,20,10,229,2,0x0000);
MyLCD.printf("Hola mbed!!!");
wait_ms(2000);
MyLCD.vLCDTFTRectangle(0,0,239,319,1,0x0000);
MyLCD.vLCDTFTCircle(120,160,110,0,0xFFFF);

}



thanks

There are many drivers on here http://www.tinyclr.com/codeshare I suggest you compare code.

@ User_8237

Have you asked at the mbed forum?

@ User_8237,

I’ve had a look at the code and cant see where you are setting a PWM value?

Thanks for yours reply. i just have look to the suggest code, they looks the same, and i delete the PWM value and i connected the BackLight to 3.3V. the image show how i do all the connections.

@ User_8237 - If you have connected the back light directly to 3.3v that may be a problem, I will check the circuit if its available. Normally you would connect via a resistor.

I skimmed the docs but could not find any reference to the back light, but i would advise connecting at least a 150 Ohm resistor to limmit current. I would also try following the brochure with respect to the power connections ie connecting pins 38 and 40 etc.