Forum: Mikrocontroller und Digitale Elektronik VGA Display am PIC24FJ256DA210 läuft nicht


von Andreas Häusler (Gast)


Angehängte Dateien:

Lesenswert?

Neuer Tag neues Problem...

Versuche nach dem erfolgreichen Einbinden des 3,5" 320x240 Display 
ET0350G0DH6 nun auch das VGA Display ETV570G2DHU mit einer Auflösung von 
640x480 am PIC24FJ256DA210 zum Laufen zu bringen.

(Die beiden Displays stammen übrigens aus dem Familienkonzept der Firma 
Glyn.)

Mit der Anpassung des Microchip Demos (AN1227) habe ich bereits erste 
Erfolge gehabt. Die Buttons sind auf dem Display sichtbar.

Ich habe nun aber das Problem, dass nicht der gesamte Screen mit Daten 
gefüllt wird. Horizontal scheint alles zu stimmen, vertikal werden Daten 
nur ca. bis Zeile 410 anstatt 480 angezeigt. (Ich zeichne unter anderem 
einen Rahmen mit folgenden Daten:
1
   PolyPoints[0]=1;
2
   PolyPoints[1]=1;
3
   
4
   PolyPoints[2]=640;
5
   PolyPoints[3]=1;
6
   
7
   PolyPoints[4]=640;
8
   PolyPoints[5]=480;
9
   
10
   PolyPoints[6]=1;
11
   PolyPoints[7]=480;
12
   
13
   PolyPoints[8]=1;
14
   PolyPoints[9]=1;
15
  
16
   pPoints = &PolyPoints[0]; 
17
   
18
   while(!DrawPoly(5, pPoints));

Ich verwende folgende Konfiguration des Displays:
1
//Auto Generated Code
2
#define PIC24FJ256DA210_DEV_BOARD
3
#define USE_USB_INTERFACE
4
#define ENABLE_USB_MSD_DEMO
5
#define ENABLE_USB_HOST_HID_DEMO
6
#define USE_16BIT_PMP
7
#define DISPLAY_CONTROLLER MCHP_DA210
8
#define DISPLAY_PANEL TFT_ETV570G2DHU
9
#define COLOR_DEPTH 8  //16
10
#define GFX_GCLK_DIVIDER 12 // _GCLKDIV=(96MHz/24MHz)-1) / 0,25 = 12
11
#define GFX_DISPLAY_BUFFER_START_ADDRESS 0x00020000ul
12
#define GFX_DISPLAY_BUFFER_LENGTH 0x00F00000ul
13
#define GFX_WORK_AREA1_START_ADDRESS 0x00020000ul
14
#define GFX_WORK_AREA2_START_ADDRESS 0x00020000ul
15
#define GFX_EPMP_CS1_BASE_ADDRESS 0x00020000ul
16
//End Auto Generated Code
17
18
und
19
20
// --------------------------------------------------------------------------
21
// Glyn Familien Konzept Displays
22
// --------------------------------------------------------------------------
23
    
24
#if (DISPLAY_PANEL == TFT_ETV570G2DHU)  
25
  #define DISP_ORIENTATION  0
26
        #define DISP_HOR_RESOLUTION  640
27
        #define DISP_VER_RESOLUTION  480
28
        #define DISP_DATA_WIDTH    18  
29
        #define DISP_HOR_PULSE_WIDTH    30    
30
        #define DISP_HOR_BACK_PORCH     144  
31
        #define DISP_HOR_FRONT_PORCH    16  
32
        #define DISP_VER_PULSE_WIDTH    3  
33
        #define DISP_VER_BACK_PORCH     35  
34
        #define DISP_VER_FRONT_PORCH    40  
35
        
36
        #if (DISPLAY_CONTROLLER == MCHP_DA210)
37
            #define GFX_LCD_TYPE                        GFX_LCD_TFT
38
            #define GFX_DISPLAYENABLE_ENABLE
39
            #define GFX_HSYNC_ENABLE
40
            #define GFX_VSYNC_ENABLE
41
            #define GFX_DISPLAYPOWER_ENABLE
42
            #define GFX_CLOCK_POLARITY                  GFX_ACTIVE_HIGH
43
            #define GFX_DISPLAYENABLE_POLARITY          GFX_ACTIVE_HIGH
44
            #define GFX_HSYNC_POLARITY                  GFX_ACTIVE_LOW
45
            #define GFX_VSYNC_POLARITY                  GFX_ACTIVE_LOW
46
            #define GFX_DISPLAYPOWER_POLARITY           GFX_ACTIVE_HIGH
47
        #endif
48
       
49
#endif // #if (DISPLAY_PANEL == TFT_ETV570G2DHU)

Ich finde die Daten im Datenblatt sehr verwirrend und bin mir nicht 
sicher, ob alles korrekt im Headerfile eingetragen wurde.

Durch die Farbtiefe von nur 8Bit, sehen die Buttons nicht ansehlich aus.
Könnte man da was mit der Palette machen?

Bin für jede Hilfe sehr dankbar.
Im Voraus besten Dank...

von Arc N. (arc)


Lesenswert?

Was hängt denn für ein Speicher am PIC?
640 * 410 ~ 256k, 640*480 wären 307k...

von Andreas Häusler (Gast)


Lesenswert?

Sieht genau nach diesem Problem aus...

Auf dem PIC24FJ256DA210 Development Board befindet sich ein externes 
512kB SRAM. Per default ist dieses aber nur bis 256kB verwendbar (Jumper 
auf Adresse 17 nicht gesetzt)

-------
The PIC24FJ256DA210 Development Board is provided with 512 Kbyte of 
external
SRAM, populating U6. By default, only 256 out of the 512 KByte is 
enabled; this allows
PMA17 to control LED D4 in the default board default configuration.
--------

Muss ich neben diesem Jumper auch in der Software Anpassungen machen, 
wenn ich die 512kB ausnützen will?

von Andreas Häusler (Gast)



Lesenswert?

Hier übrigens noch die korrekten Treibereinstellungen für das VGA 
Display
ETV570G2DHU der Firma Glyn:
1
#if (DISPLAY_PANEL == TFT_ETV570G2DHU)  
2
  #define DISP_ORIENTATION              0
3
        #define DISP_HOR_RESOLUTION    640
4
        #define DISP_VER_RESOLUTION    480
5
        #define DISP_DATA_WIDTH         18  
6
        #define DISP_HOR_PULSE_WIDTH    30    
7
        #define DISP_HOR_BACK_PORCH     114 (101)  
8
        #define DISP_HOR_FRONT_PORCH    16  (29)  
9
        #define DISP_VER_PULSE_WIDTH    3  
10
        #define DISP_VER_BACK_PORCH     32  
11
        #define DISP_VER_FRONT_PORCH    10  
12
        
13
        #if (DISPLAY_CONTROLLER == MCHP_DA210)
14
            #define GFX_LCD_TYPE                        GFX_LCD_TFT
15
            #define GFX_DISPLAYENABLE_ENABLE
16
            #define GFX_HSYNC_ENABLE
17
            #define GFX_VSYNC_ENABLE
18
            #define GFX_DISPLAYPOWER_ENABLE
19
            #define GFX_CLOCK_POLARITY                  GFX_ACTIVE_HIGH
20
            #define GFX_DISPLAYENABLE_POLARITY          GFX_ACTIVE_HIGH
21
            #define GFX_HSYNC_POLARITY                  GFX_ACTIVE_LOW
22
            #define GFX_VSYNC_POLARITY                  GFX_ACTIVE_LOW
23
            #define GFX_DISPLAYPOWER_POLARITY           GFX_ACTIVE_HIGH
24
        #endif

Das Problem mit dem Speicher bleibt mir aber weiterhin.
Hat den noch niemand das PIC24FJ256DA210 Development Board mit einem VGA 
Display betrieben?
Im Anhang findet Ihr die Datei, wo der Speicher initiallisiert wird.
Sowie das Handbuch zum Board.

Nachfolgend ein Auszug aus dem Source:
1
void EPMP_Init(void)
2
{
3
  /* Note: When using the EPMP to access external RAM or Flash, PMA0-PMA16 will only access a range of 
4
           256K RAM. To increase this range enable higher Address lines.
5
  */
6
  ANSDbits.ANSD7 = 0;   // PMD15
7
  ANSDbits.ANSD6 = 0;   // PMD14
8
  ANSFbits.ANSF0 = 0;   // PMD11
9
10
  ANSBbits.ANSB15 = 0;  // PMA0
11
  ANSBbits.ANSB14 = 0;  // PMA1
12
  ANSGbits.ANSG9  = 0;  // PMA2
13
  ANSBbits.ANSB13 = 0;  // PMA10
14
  ANSBbits.ANSB12 = 0;  // PMA11
15
  ANSBbits.ANSB11 = 0;  // PMA12
16
  ANSBbits.ANSB10 = 0;  // PMA13
17
  ANSAbits.ANSA7 = 0;   // PMA17
18
  ANSGbits.ANSG6 = 0;   // PMA18
19
20
  PMCON1bits.ADRMUX = 0;                      // address is not multiplexed
21
  PMCON1bits.MODE = 3;                        // master mode
22
  PMCON1bits.CSF = 0;                         // PMCS1 pin used for chip select 1, PMCS2 pin used for chip select 2
23
  PMCON1bits.ALP = 1;                         // set address latch strobes to high active level (for sn74lvc16373)
24
  PMCON1bits.ALMODE = 1;                      // "smart" address strobes are not used
25
  PMCON1bits.BUSKEEP = 0;                     // bus keeper is not used
26
27
    #if defined (GFX_EPMP_CS1_BASE_ADDRESS)
28
    #ifdef USE_DOUBLE_BUFFERING
29
      PMCS1BS = ((DWORD)GFX_BUFFER1>>8);          // CS1 start address
30
      PMCON3 |= 0x0003;                       // PMA16 - PMA17 address lines are enabled 
31
    #else
32
      PMCS1BS = (GFX_EPMP_CS1_BASE_ADDRESS>>8);      // CS1 start address
33
      PMCON3 |= 0x0001;                       // PMA16 address line is enabled 
34
    #endif //USE_DOUBLE_BUFFERING
35
36
    PMCS1CFbits.CSDIS = 0;                    // enable CS
37
    PMCS1CFbits.CSP = EPMPCS1_CS_POLARITY;              // CS1 polarity 
38
    PMCS1CFbits.BEP = EPMPCS1_BE_POLARITY;              // byte enable polarity
39
    PMCS1CFbits.WRSP = EPMPCS1_WR_POLARITY;             // write strobe polarity
40
    PMCS1CFbits.RDSP = EPMPCS1_RD_POLARITY;             // read strobe polarity
41
    PMCS1CFbits.CSPTEN = 1;                   // enable CS port
42
    PMCS1CFbits.SM = 0;                       // read and write strobes on separate lines 
43
    PMCS1CFbits.PTSZ = 2;                     // data bus width is 16-bit 
44
  
45
    PMCS1MDbits.ACKM = 0;                      // PMACK is not used
46
47
    // The device timing parameters. Set the proper timing
48
    // according to the device used (the timing macros are defined in the hardware profile)
49
    PMCS1MDbits.DWAITB = EPMPCS1_DWAITB;              // access time 1 Tcy
50
    PMCS1MDbits.DWAITM = EPMPCS1_DWAITM;
51
    PMCS1MDbits.DWAITE = EPMPCS1_DWAITE;
52
    PMCS1MDbits.AMWAIT = EPMPCS1_AMWAIT;          // Note: adjust this delay for slower devices 
53
54
  #else
55
      PMCS1CFbits.CSDIS = 1;                   // disable CS1 functionality  
56
  #endif //#if defined (GFX_EPMP_CS1_BASE_ADDRESS)
57
58
  #if defined (GFX_EPMP_CS2_BASE_ADDRESS)
59
60
    PMCS2BS = (GFX_EPMP_CS2_BASE_ADDRESS>>8);        // CS2 start address
61
62
    PMCS2CFbits.CSDIS = 0;                    // enable CS
63
64
    PMCS2CFbits.CSP = EPMPCS2_CS_POLARITY;              // CS2 polarity 
65
    PMCS2CFbits.BEP = EPMPCS2_BE_POLARITY;              // byte enable polarity
66
    PMCS2CFbits.WRSP = EPMPCS2_WR_POLARITY;             // write strobe polarity
67
    PMCS2CFbits.RDSP = EPMPCS2_RD_POLARITY;             // read strobe polarity
68
    PMCS2CFbits.CSPTEN = 1;                   // enable CS port
69
    PMCS2CFbits.SM = 0;                       // read and write strobes on separate lines 
70
    PMCS2CFbits.PTSZ = 2;                     // data bus width is 16-bit 
71
  
72
    PMCS2MDbits.ACKM = 0;                      // PMACK is not used
73
    
74
    // The device timing parameters. Set the proper timing
75
    // according to the device used (the timing macros are defined in the hardware profile)
76
    PMCS2MDbits.DWAITB = EPMPCS2_DWAITB;              // access time 1 Tcy
77
    PMCS2MDbits.DWAITM = EPMPCS2_DWAITM;
78
    PMCS2MDbits.DWAITE = EPMPCS2_DWAITE;
79
    PMCS2MDbits.AMWAIT = EPMPCS2_AMWAIT;          // Note: adjust this delay for slower devices 
80
81
82
  #else  
83
    PMCS2CFbits.CSDIS = 1;                     // disable CS2 functionality  
84
  #endif //#if defined (GFX_EPMP_CS2_BASE_ADDRESS)
85
  
86
  PMCON2bits.RADDR = 0xFF;                  // set CS2 end address
87
  PMCON4 = 0xFFFF;                            // PMA0 - PMA15 address lines are enabled
88
  
89
90
  PMCON3bits.PTWREN = 1;                      // enable write strobe port
91
  PMCON3bits.PTRDEN = 1;                      // enable read strobe port
92
  PMCON3bits.PTBE0EN = 1;                     // enable byte enable port
93
  PMCON3bits.PTBE1EN = 1;                     // enable byte enable port
94
  PMCON3bits.AWAITM = 0;                      // set address latch pulses width to 1/2 Tcy
95
  PMCON3bits.AWAITE = 0;                      // set address hold time to 1/4 Tcy
96
  
97
  DelayMs(100);
98
99
  PMCON2bits.MSTSEL = 3;                    // select EPMP bypass mode (for Graphics operation)
100
  PMCON1bits.PMPEN = 1;                    // enable the module
101
102
  DelayMs(100);
103
104
}

Wäre wirklich sehr dankbar, wenn mir jemand weiterhelfen könnte.

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.