Forum: Mikrocontroller und Digitale Elektronik Graphikchip SSD1963: Weiß geht nicht


von Joachim .. (joachim_01)


Lesenswert?

Moin,

hab hiern SSD1963 für ein 272x480 LCD im 565RGB Modus (16bit Busbreite) 
der an nem Cortex M3 hängt. Das Display funktioniert eigentlich nicht 
schlecht, aber es scheint als ob mindestens weiß (0xFFFF) rumzickt und 
den Controller gelegentlich völlig durcheinander bringt. Nach der 
Initialisierung kommt statt weiß nur knallbuntes Rauschen (nicht 
formatierter internes RAM des SSD1963?), danach wird weiß, jedesmal 
durch schwarz (0000) ersetzt, dargestellt.
Textfonts funktionieren, HW-mäßig scheint also alles ok zu sein. Der 
hier gepostete Init Code ist aus unbekannter chinesischer Quelle und war 
ursprünglich für nen ollen 8051 gedacht.

1
uint32_t HDP = 479;
2
uint32_t HT = 531;  //horiz. total period (display + non-display) in pixel clocks 
3
uint32_t HPS = 43;  //byte of the non-display period between the start of the horiz. sync (LLINE) signal and first
4
                    //display data = "hor. back porch + hor. pulse width?"
5
uint32_t LPS = 8;   //horizontal sync pulse (LLINE) start location in pixel clocks = "front porch?"
6
uint32_t HPW = 10;  //horizontal sync pulse width (= (HPW + 1) pixels )
7
uint32_t VDP = 271;
8
uint32_t VT = 288;
9
uint32_t VPS = 12; //Vertical Sync Pulse Width = (VPW + 1) lines 
10
uint32_t FPS = 4;  //vertical sync pulse (LFRAME) start location in lines.
11
uint32_t VPW = 10;
12
13
14
void Lcd_Init(void)
15
 {
16
   gpio_set_pin_high(LCD_CS); // LCD_CS = 1;
17
   gpio_set_pin_high(LCD_RD);
18
   gpio_set_pin_high(LCD_WR);   
19
   
20
   gpio_set_pin_high(LCD_RES);
21
   mdelay(100);
22
   gpio_set_pin_low(LCD_RES);
23
   mdelay(5);   
24
   gpio_set_pin_high(LCD_RES);
25
   mdelay(5);
26
   gpio_set_pin_high(LCD_CS);
27
   //gpio_set_pin_high(LCD_RD);
28
   //gpio_set_pin_high(LCD_WR);
29
   mdelay(5);
30
   
31
   gpio_set_pin_low(LCD_CS);
32
33
  LCD_WR_REG(0x00E2);    //PLL multiplier, set PLL clock to 120M
34
//    LCD_WR_DATA(0x002d);  //N=0x36 for 6.5M, 0x23 for 10M crystal
35
    LCD_WR_DATA(0x0023);  //N=0x36 for 6.5M, 0x23 for 10M crystal
36
    LCD_WR_DATA(0x0002);
37
    LCD_WR_DATA(0x0004);
38
    mdelay(1);
39
40
  LCD_WR_REG(0x00E0);
41
  LCD_WR_DATA(0x0001);  // 03
42
  mdelay(10);
43
44
45
  LCD_WR_REG(0x00E0);
46
    LCD_WR_DATA(0x0003);  // 03
47
    mdelay(10);
48
49
  LCD_WR_REG(0x0001);    // software reset
50
    mdelay(100);
51
52
  LCD_WR_REG(0x00E6);    //PLL setting for PCLK, depends on resolution
53
    LCD_WR_DATA(0x0000);
54
    LCD_WR_DATA(0x00ff);
55
    LCD_WR_DATA(0x00be);  
56
     
57
   LCD_WR_REG(0x00B0);  //LCD SPECIFICATION
58
     LCD_WR_DATA(0x0020);  //24bit to panel
59
     LCD_WR_DATA(0x0000);
60
     LCD_WR_DATA((HDP>>8)&0X00FF);  //Set HDP
61
     LCD_WR_DATA(HDP&0X00FF);
62
     LCD_WR_DATA((VDP>>8)&0X00FF);  //Set VDP
63
     LCD_WR_DATA(VDP&0X00FF);
64
     LCD_WR_DATA(0x0000);
65
     mdelay(5);
66
  
67
   LCD_WR_REG(0x00B4);  //HSYNC   ///531[d] = 213[h] 
68
     LCD_WR_DATA((HT>>8) & 0x00FF);  //Set HT    2     
69
     LCD_WR_DATA(HT & 0x00FF);
70
     LCD_WR_DATA((HPS>>8) & 0x00FF);  //Set HPS
71
     LCD_WR_DATA(HPS&0X00FF);
72
     LCD_WR_DATA(HPW);         //Set HPW
73
     LCD_WR_DATA((LPS>>8)&0X00FF);  //SetLPS
74
     LCD_WR_DATA(LPS&0X00FF);
75
     LCD_WR_DATA(0x0000);
76
77
   LCD_WR_REG(0x00B6);  //VSYNC
78
    LCD_WR_DATA((VT>>8)&0X00FF);   //Set VT
79
    LCD_WR_DATA(VT&0X00FF);
80
    LCD_WR_DATA((VPS>>8)&0X00FF);  //Set VPS
81
    LCD_WR_DATA(VPS&0X00FF);
82
    LCD_WR_DATA(VPW);         //Set VPW
83
    LCD_WR_DATA((FPS>>8)&0X00FF);  //Set FPS
84
    LCD_WR_DATA(FPS&0X00FF);
85
86
87
   LCD_WR_REG(0x0036); //rotation
88
    LCD_WR_DATA(0x0000);
89
90
  LCD_WR_REG(0x3A);  //Set Pixel Format
91
    LCD_WR_DATA(0x50);
92
93
94
   LCD_WR_REG(0x00F0); //pixel data interface
95
    LCD_WR_DATA(0x0003);  // width: 16-bit (565 format) 
96
97
   mdelay(5);
98
99
   LCD_WR_REG(0x0029); //display on
100
101
   LCD_WR_REG(0x00BE); //set PWM for B/L
102
    LCD_WR_DATA(0x0006);
103
    LCD_WR_DATA(0x00f0);
104
    LCD_WR_DATA(0x0001);
105
    LCD_WR_DATA(0x00f0);
106
    LCD_WR_DATA(0x0000);
107
    LCD_WR_DATA(0x0000);
108
109
   LCD_WR_REG(0x00d0);
110
    LCD_WR_DATA(0x000d);
111
112
   //----------LCD RESET---GPIO0-------------------//
113
   LCD_WR_REG(0x00B8);
114
    LCD_WR_DATA(0x0000);    //GPIO3=input, GPIO[2:0]=output
115
    LCD_WR_DATA(0x0001);    //GPIO0 normal
116
117
   LCD_WR_REG(0x00BA);
118
    LCD_WR_DATA(0x0000);
119
 }

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.