Mein 2,2-Zoll-TFT-LCD funktioniert nicht (ILI9225-Treiber) (STM32F1)

Heute habe ich an diesem TFT-LCD gearbeitet und weiß nicht, warum es nicht funktioniert.

Abbildung 1

Figur 2

Dieses LCD ist ein 2,2-Zoll-TFT mit ILI9225-LCD-Treiber und ist mit meinem STM32F1 verbunden. Hier ist das Datenblatt des LCD-Treibers:

http://www.hpinfotech.ro/ILI9225B.pdf

Und Beispielcode:

http://www.displayfuture.com/Display/datasheet/controller/ILI9225.pdf

Und hier sind andere Quellen, die ich gelesen habe:

https://github.com/prenticedavid/TFT_SPI_kbv/blob/master/ILI9225_kbv.cpp https://github.com/prenticedavid/TFT_SPI_kbv/blob/master/ILI9225_kbv.h

https://github.com/Nkawu/TFT_22_ILI9225/blob/master/src/TFT_22_ILI9225.h https://github.com/Nkawu/TFT_22_ILI9225/blob/master/src/TFT_22_ILI9225.cpp

https://www.mikrocontroller.net/topic/373581

Software

Für Software ist hier der Code, den ich verwendet habe, um das LCD zu initiieren:

void TM_ILI9225_Init(void) 
  {


    ILI9225_RST_RESET;         
        TM_ILI9225_Delay(20000);  
    ILI9225_RST_SET;
        TM_ILI9225_Delay(200000);
    ILI9225_RST_RESET;
        TM_ILI9225_Delay(400000);   

    TM_ILI9225_SendCommand(0x28);
    TM_ILI9225_SendData(0x00CE);


    TM_ILI9225_SendCommand(0x10);
    TM_ILI9225_SendData(0x0000);
    TM_ILI9225_SendCommand(0x11);
    TM_ILI9225_SendData(0x0000);    
    TM_ILI9225_SendCommand(0x12);
    TM_ILI9225_SendData(0x0000);
    TM_ILI9225_SendCommand(0x13);
    TM_ILI9225_SendData(0x0000);
    TM_ILI9225_SendCommand(0x14);
    TM_ILI9225_SendData(0x0000);

    TM_ILI9225_Delay(400000);

    TM_ILI9225_SendCommand(0x11);
    TM_ILI9225_SendData(0x103B);//0x0018    
    TM_ILI9225_SendCommand(0x12);
    TM_ILI9225_SendData(0x6121);
    TM_ILI9225_SendCommand(0x13);
    TM_ILI9225_SendData(0x006F);
    TM_ILI9225_SendCommand(0x14);
    TM_ILI9225_SendData(0x495F);
    TM_ILI9225_SendCommand(0x10);
    TM_ILI9225_SendData(0x0A00);

    TM_ILI9225_Delay(400000);

    TM_ILI9225_SendCommand(0x11);
    TM_ILI9225_SendData(0x1000);

    TM_ILI9225_Delay(400000);

    TM_ILI9225_SendCommand(0x01);
    TM_ILI9225_SendData(0x011C);
    TM_ILI9225_SendCommand(0x02);
    TM_ILI9225_SendData(0x0100);//0x0100
    TM_ILI9225_SendCommand(0x03);
    TM_ILI9225_SendData(0x1030);
    TM_ILI9225_SendCommand(0x07);
    TM_ILI9225_SendData(0x0000);
    TM_ILI9225_SendCommand(0x08);
    TM_ILI9225_SendData(0x0808);
    TM_ILI9225_SendCommand(0x0B);
    TM_ILI9225_SendData(0x1100);
    TM_ILI9225_SendCommand(0x0C);
    TM_ILI9225_SendData(0x0111);//0x0000
    TM_ILI9225_SendCommand(0x0F);
    TM_ILI9225_SendData(0x0F01);//
    TM_ILI9225_SendCommand(0x20);
    TM_ILI9225_SendData(0x0000);
    TM_ILI9225_SendCommand(0x21);
    TM_ILI9225_SendData(0x0000);

    TM_ILI9225_SendCommand(0x30);
    TM_ILI9225_SendData(0x0000);
    TM_ILI9225_SendCommand(0x31);
    TM_ILI9225_SendData(0x00DB);
    TM_ILI9225_SendCommand(0x32);
    TM_ILI9225_SendData(0x0000);
    TM_ILI9225_SendCommand(0x33);
    TM_ILI9225_SendData(0x0000);
    TM_ILI9225_SendCommand(0x34);
    TM_ILI9225_SendData(0x00DB);
    TM_ILI9225_SendCommand(0x35);
    TM_ILI9225_SendData(0x0000);
    TM_ILI9225_SendCommand(0x36);
    TM_ILI9225_SendData(0x00AF);
    TM_ILI9225_SendCommand(0x37);
    TM_ILI9225_SendData(0x0000);
    TM_ILI9225_SendCommand(0x38);
    TM_ILI9225_SendData(0x00DB);
    TM_ILI9225_SendCommand(0x39);
    TM_ILI9225_SendData(0x0000);


    TM_ILI9225_SendCommand(0x50);
    TM_ILI9225_SendData(0x0000);
    TM_ILI9225_SendCommand(0x51);
    TM_ILI9225_SendData(0x0808);
    TM_ILI9225_SendCommand(0x52);
    TM_ILI9225_SendData(0x080A);
    TM_ILI9225_SendCommand(0x53);
    TM_ILI9225_SendData(0x000A);
    TM_ILI9225_SendCommand(0x54);
    TM_ILI9225_SendData(0x0A08);
    TM_ILI9225_SendCommand(0x55);
    TM_ILI9225_SendData(0x0808);
    TM_ILI9225_SendCommand(0x56);
    TM_ILI9225_SendData(0x0000);
    TM_ILI9225_SendCommand(0x57);
    TM_ILI9225_SendData(0x0A00);
    TM_ILI9225_SendCommand(0x58);
    TM_ILI9225_SendData(0x0710);
    TM_ILI9225_SendCommand(0x59);
    TM_ILI9225_SendData(0x0710);

    TM_ILI9225_SendCommand(0x07);
    TM_ILI9225_SendData(0x0012);

    TM_ILI9225_Delay(400000);

    TM_ILI9225_SendCommand(0x07);
    TM_ILI9225_SendData(0x1017);    


}

Und hier sind Funktionen:

void TM_ILI9225_Delay(volatile unsigned int delay) {
    for (; delay != 0; delay--); 
}

void TM_ILI9225_SendCommand(uint16_t data) {

    ILI9225_WRX_RESET;
    a = 3;
    while(a){
        a--;
    }
    GPIOA->BRR = GPIO_Pin_4;
    a = 3;
    while(a){
        a--;
    }
    SPI1->DR = data;
    a = 3;
    while(a){
        a--;
    }
    GPIOA->BSRR = GPIO_Pin_4; //setbit

}

void TM_ILI9225_SendData(uint16_t data) {

    ILI9225_WRX_SET;
    a = 3;
    while(a){
        a--;
    }
    GPIOA->BRR = GPIO_Pin_4;
    a = 3;
    while(a){
        a--;
    }
    SPI1->DR = data;
    a = 3;
    while(a){
        a--;
    }
    GPIOA->BSRR = GPIO_Pin_4;

}

void TM_ILI9225_SetCursorPosition(uint16_t x1, uint16_t y1) {
    TM_ILI9225_SendCommand(0x20);
    TM_ILI9225_SendData(x1);

    TM_ILI9225_SendCommand(0x21);
    TM_ILI9225_SendData(y1);

}

void TM_ILI9225_Fill(uint16_t color) {
    unsigned int n, i, j;
    i = color >> 8;
    j = color & 0xFF;
    TM_ILI9225_SetCursorPosition(0, 0);

    TM_ILI9225_SendCommand(0x22);

    for (n = 0; n < ILI9225_PIXEL; n++) {
        TM_ILI9225_SendData(i);
        TM_ILI9225_SendData(j);
    }

Und Makros:

#define ILI9225_RST_SET             GPIO_SetBits( GPIOA , GPIO_Pin_3)
#define ILI9225_RST_RESET           GPIO_ResetBits(GPIOA, GPIO_Pin_3)
#define ILI9225_WRX_SET             GPIO_SetBits(GPIOA, GPIO_Pin_2)
#define ILI9225_WRX_RESET           GPIO_ResetBits(GPIOA, GPIO_Pin_2)

#define ILI9225_WIDTH               220
#define ILI9225_HEIGHT              176
#define ILI9225_PIXEL                   38720

Und dies ist der Code, den ich verwende, um die Farbe des LCD zu ändern.

TM_ILI9225_Init();
TM_ILI9225_Fill(0xfb20);

Ich werde keine anderen Teile des Codes (wie SPI-Initialisierung usw.) einfügen, da der Rest des Codes getestet wurde und sehr gut funktioniert.

Hardware

Hier die Belegung der Pins:

MCU -------- LCD

PIN-3A ----> RST

PIN-2A ----> RS

NSS -------> CS

MOSI ------> SDI

CLK -------> CLK

3v3 -------> LED

Vcc -------> Vcc

Masse -------> Masse

Ich habe die Verdrahtung von meinem Logikanalysator überprüft und sie funktioniert sehr gut.

Was habe ich bisher gemacht?

Dieses LCD-Modul hat einen 74HC245 IC und ich dachte, es könnte möglich sein, dass dieser IC nicht mit Hochgeschwindigkeits-SPI umgehen kann, dann habe ich die Geschwindigkeit der Schnittstelle reduziert und erhöht und sie mit meinem Logikanalysator überprüft, und nichts hat sich geändert. Ich habe den Initialisierungscode und insbesondere diesen Teil manipuliert:

TM_ILI9225_SendCommand(0x0C);
TM_ILI9225_SendData(0x0000);

Dazu:

TM_ILI9225_SendCommand(0x0C);
TM_ILI9225_SendData(0x0111);

Aber es passierte nichts. Ich denke, dass viele Codes im Netz den falsch verwendeten Wert 0x0000für register verwenden 0x0c.

Jede Idee wäre willkommen

Ihre Verzögerungen werden wahrscheinlich nicht wie beabsichtigt funktionieren. Außerdem sollten Sie warten, bis alle vorherigen Übertragungen abgeschlossen sind, bevor Sie die Steuerleitungen (WRX, A4) wechseln.
Dein Code ist komplett falsch. Fast alles Wichtige ist falsch. Verzögerungen sind falsch, Kommunikation ist falsch - Sie prüfen, ob Sie etwas an DR schreiben können, Sie warten nicht, bis die Übertragung abgeschlossen ist, sondern ändern die Steuerleitungen. Sie setzen DR-Schreibvorgänge nicht um, um korrekte Daten in DR zu schreiben. Du musst es umschreiben

Antworten (1)

Das Display, das Sie auf den Fotos gezeigt haben, ist mit dem ILI9341-Controller, nicht mit dem ILI9225. Daher können Sie es nicht mit der 9225-Initialisierung ausführen.