CFAF240320S-032T Initialization problems

sch0bert

New member
Hello my name is Pascal,

I used to have the CFAF240320P-T screen but now I'm trying to migrate to the new CFAF240320S-032T. I'm using a MSP430 that runs at 8 Mhz. I configured (IM3 = GND) the screen to be interfaced with 16 pins. As I read in the web page, pinout didn't change with this new graphic microcontroler so I connected it with the same hardware configuration.

I downloaded the demonstration initialization to the target and it didn't work, nothing is being paint on the screen. I verified that all the hardware connections were correct and it is. I checked the timings of sending a command or data and were correct (actually more than normal). So I concluded that it might not be correct the initialization that you guys are giving so I checked the flowchart of how to turn it on and it was not exactly like it supposed to be so I made my own initialization code and all I got was a very faint blue label light in one of the side of the screen.

This is my code (I removed the function prototypes and the includes so don't worry about that jejeje :D)

// Definición de colores

#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF

// Macros para Controlar los pines

#define CLR_CD P4OUT &= ~BIT5;
#define SET_CD P4OUT |= BIT5;

#define CLR_CS P4OUT &= ~BIT4;
#define SET_CS P4OUT |= BIT4;

#define CLR_RESET P9OUT &= ~BIT0;
#define SET_RESET P9OUT |= BIT0;

#define CLR_WR P4OUT &= ~BIT6;
#define SET_WR P4OUT |= BIT6;
#define CLR_RD P4OUT &= ~BIT7;
#define SET_RD P4OUT |= BIT7;


void Ports_init(){

P4DIR |= BIT4 | BIT5 | BIT6 | BIT7; /* 4.4 /.5 /.6 /.7 son salidas */
P9DIR |= BIT0; /* 9.0 es salida */
P8DIR |= 0xFF; /* Todo el puerto 8 es salida */
P7DIR |= 0xFF; /* Todo el puerto 7 es salida */

}

/*************************************************/

void delay(uint16_t t){

uint8_t t1;
while(t--)
for(t1=11;t1>0;t1--)
{asm("nop");}
}

/*************************************************/

void write_command(uint16_t command){

CLR_CS;
CLR_CD;
SET_RD;
SET_WR;

P8OUT=command>>8;
P7OUT=command;

CLR_WR;
delay(1);
SET_WR;
SET_CS;
}

/*************************************************/

void write_data(uint16_t data){

CLR_CS;
SET_CD;
SET_RD;
SET_WR;

P8OUT=data>>8;
P7OUT=data;

CLR_WR;
delay(1);
SET_WR;
SET_CS;
}

/*************************************************/

void Display_Home(){

write_command(0x0020); // GRAM Address Set (Horizontal Address) (R20h)
write_data(0x0000);
write_command(0x0021); // GRAM Address Set (Vertical Address) (R21h)
write_data(0x0000);
write_command(0x0022); // Write Data to GRAM (R22h)
}

/*************************************************/


void LCD_test(){

uint16_t i,j;
Display_Home();

for(i=0;i<320;i++)
{
for(j=0;j<240;j++)
{
if(i>279)write_data(WHITE);
else if(i>239)write_data(BLUE);
else if(i>199)write_data(GREEN);
else if(i>159)write_data(CYAN);
else if(i>119)write_data(RED);
else if(i>79)write_data(MAGENTA);
else if(i>39)write_data(YELLOW);
else write_data(BLACK);
}
}
}
/*************************************************/

void init_LCD(){

delay(1000);

CLR_RESET;
delay(1000);
delay(1000);
SET_RESET;
delay(5000);

write_command(0x0007); // Display Control (R07h)
write_data(0x0000); // Page 20, OTM3225A Datasheet

write_command(0x0012); // Power Control 3 (R12h)
write_data(0x0000); // Page 28, OTM3225A Datasheet

delay(5000);
delay(5000);

write_command(0x0011); // Power Control 2 (R11h)
write_data(0x0007); // Page 27, OTM3225A Datasheet

write_command(0x0012); // Power Control 3 (R12h)
write_data(0x000B); // Page 28, OTM3225A Datasheet

write_command(0x0029); // NVM read data 2 (R29h)
write_data(0x0010); // Page 39, OTM3225A Datasheet

write_command(0x0013); // Power Control 4 (R13h)
write_data(0x1300); // Page 29, OTM3225A Datasheet

write_command(0x0012); // Power Control 3 (R12h)
write_data(0x000B); // Page 28, OTM3225A Datasheet

delay(5000);

write_command(0x0010); // Power Control 1 (R10h)
write_data(0x10B0); // Page 26, OTM3225A Datasheet

write_command(0x0011); // Power Control 2 (R11h)
write_data(0x0007); // Page 27, OTM3225A Datasheet

write_command(0x0012); // Power Control 3 (R12h)
write_data(0x001B); // Page 28, OTM3225A Datasheet

write_command(0x0010); // Power Control 1 (R10h)
write_data(0x0030); // Page 26, OTM3225A Datasheet

delay(5000);
delay(5000);
delay(5000);

write_command(0x0010); // Power Control 1 (R10h)
write_data(0x1230); // Page 26, OTM3225A Datasheet

}

void additional_LCD_settings(){

write_command(0x0001); // Driver Output Control Register (R01h)
write_data(0x0000); // Page 15, OTM3225A Datasheet

write_command(0x0002); // LCD Driving Waveform Control (R02h)
write_data(0x0700); // Page 16, OTM3225A Datasheet

write_command(0x0003); // Entry Mode (R03h)
write_data(0x5000); // Page 16, OTM3225A Datasheet

write_command(0x0004); // Scaling Control register (R04h)
write_data(0x0000); // Page 19, OTM3225A Datasheet

write_command(0x0008); // Display Control 2 (R08h)
write_data(0x0203); // Page 21, OTM3225A Datasheet //***** MODIFICADO 207 **///

write_command(0x0009); // Display Control 3 (R09h)
write_data(0x0000); // Page 22, OTM3225A Datasheet

write_command(0x000A); // Frame Cycle Control (R0Ah)
write_data(0x0000); // Page 23, OTM3225A Datasheet

write_command(0x000C); // External Display Interface Control 1 (R0Ch)
write_data(0x0001); // Page 24, OTM3225A Datasheet //***** MODIFICADO 000 **///

write_command(0x000D); // Frame Maker Position (R0Dh)
write_data(0x0000); // Page 25, OTM3225A Datasheet

write_command(0x000F); // External Display Interface Control 2 (R0Fh)
write_data(0x0000); // Page 25, OTM3225A Datasheet

write_command(0x0030); // Gamma Control 1
write_data(0x000A); // Page 41, OTM3225A Datasheet
write_command(0x0031); // Gamma Control 2
write_data(0x1326); // Page 41, OTM3225A Datasheet
write_command(0x0032); // Gamma Control 3
write_data(0x0A29); // Page 41, OTM3225A Datasheet
write_command(0x0033); // Gamma Control 4
write_data(0x290A); // Page 41, OTM3225A Datasheet
write_command(0x0034); // Gamma Control 5
write_data(0x2613); // Page 41, OTM3225A Datasheet
write_command(0x0035); // Gamma Control 6
write_data(0x0A0A); // Page 41, OTM3225A Datasheet
write_command(0x0036); // Gamma Control 7
write_data(0x1E03); // Page 41, OTM3225A Datasheet
write_command(0x0037); // Gamma Control 8
write_data(0x031E); // Page 41, OTM3225A Datasheet
write_command(0x0038); // Gamma Control 9
write_data(0x0706); // Page 41, OTM3225A Datasheet
write_command(0x0039); // Gamma Control 10
write_data(0x0303); // Page 41, OTM3225A Datasheet
write_command(0x003A); // Gamma Control 11
write_data(0x0E04); // Page 41, OTM3225A Datasheet
write_command(0x003B); // Gamma Control 12
write_data(0x0E01); // Page 41, OTM3225A Datasheet
write_command(0x003C); // Gamma Control 13
write_data(0x010E); // Page 41, OTM3225A Datasheet
write_command(0x003D); // Gamma Control 14
write_data(0x040E); // Page 41, OTM3225A Datasheet
write_command(0x003E); // Gamma Control 15
write_data(0x0303); // Page 41, OTM3225A Datasheet
write_command(0x003F); // Gamma Control 16
write_data(0x0607); // Page 41, OTM3225A Datasheet

write_command(0x0050); // Window Horizontal RAM Address Start (R50h)
write_data(0x0000); // Page 42, OTM3225A Datasheet
write_command(0x0051); // Window Horizontal RAM Address End (R51h)
write_data(0x00EF); // Page 42, OTM3225A Datasheet
write_command(0x0052); // Window Vertical RAM Address Start (R52h)
write_data(0x0000); // Page 42, OTM3225A Datasheet
write_command(0x0053); // Window Vertical RAM Address End (R53h)
write_data(0x013F); // Page 42, OTM3225A Datasheet

write_command(0x0060); // Driver Output Control (R60h)
write_data(0x2700); // Page 42, OTM3225A Datasheet
write_command(0x0061); // Driver Output Control (R61h)
write_data(0x0000); // Page 45, OTM3225A Datasheet /**** MODIFICADO 001 **///
write_command(0x006A); // Vertical Scroll Control (R6Ah)
write_data(0x0000); // Page 45, OTM3225A Datasheet

write_command(0x0080); // Display Position - Partial Display 1 (R80h)
write_data(0x0000); // Page 46, OTM3225A Datasheet
write_command(0x0081); // RAM Address Start - Partial Display 1 (R81h)
write_data(0x0000); // Page 46, OTM3225A Datasheet
write_command(0x0082); // RAM Address End - Partial Display 1 (R82h)
write_data(0x0000); // Page 46, OTM3225A Datasheet
write_command(0x0083); // Display Position - Partial Display 2 (R83h)
write_data(0x0000); // Page 46, OTM3225A Datasheet
write_command(0x0084); // RAM Address Start - Partial Display 2 (R84h)
write_data(0x0000); // Page 46, OTM3225A Datasheet
write_command(0x0085); // RAM Address End - Partial Display 2 (R85h)
write_data(0x0000); // Page 46, OTM3225A Datasheet

write_command(0x0090); // Panel Interface Control 1 (R90h)
write_data(0x0010); // Page 47, OTM3225A Datasheet
write_command(0x0092); // Panel Interface Control 2 (R92h)
write_data(0x0700); // Page 48, OTM3225A Datasheet /*** MODIFICADO 000 ***//
write_command(0x0095); // Panel Interface control 4 (R95h)
write_data(0x0210); // Page 49, OTM3225A Datasheet

}

void display_ON(){

write_command(0x0010); // Power Control 1 (R10h)
write_data(0x12B0); // Page 26, OTM3225A Datasheet

write_command(0x0007); // Display Control (R07h)
write_data(0x0001); // Page 20, OTM3225A Datasheet

delay(100);

write_command(0x0007); // Display Control (R07h)
write_data(0x0021); // Page 20, OTM3225A Datasheet

delay(100);

write_command(0x0007); // Display Control (R07h)
write_data(0x0023); // Page 20, OTM3225A Datasheet

delay(100);

write_command(0x0007); // Display Control (R07h)
write_data(0x0033); // Page 20, OTM3225A Datasheet

}

/*************************************************/

void main (void){

WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer

Ports_init();

init_LCD();
additional_LCD_settings();
display_ON();

for(;;){
//display_rgb(RED);
LCD_test();

}
}

I saw that the faint blue label light appears when I finish executing the function "display_ON()". I put huge delays because I don't want to have problems being in the minimum time limit.

Best regards,
Pascal.
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 
Top