AnsweredAssumed Answered

stm32f103 and winstar TFT display problem

Question asked by kula.rafal on Mar 9, 2016
Hi all,

I have problem with displaying any data at WF57STIACDNN0 TFT display. This is a TFT display with ST7511U driver. In my SW driver I successfully pass the display initialization procedure - I see some randomize pixels set, but I am NOT able to display any data by write RAM command - 0x2C (ST75_WRAM).
First my goal is to clear whole display and set each pixel on the screen. For communication I am using 4 line (A0 + SPI).

In the past I only wrote some drivers for easy ALPHA display so I have no any knowledge about graphic display.

Below I will put by initialize function and function where I would like to clear whole display area.

static
void display_init()
{
    CS_ENABLE;

    spi_write_command(ST75_SWRESET);
    spi_write_data(0xa5);

    //Power Control
    spi_write_command(ST75_PWRCTL);
    spi_write_data(0x8f);   //booster setting = "10" = -2   ??
    spi_write_data(0x04);   //SAMPSet = "100"               ??
    spi_write_data(0xa5);   //WARNING in spec is 0x0a5      ??
    spi_write_data(0xa5);

    //Electronic Volume Set 1
    spi_write_command(ST75_EVSET1);
    spi_write_data(0x36);   //VCOM      ??
    spi_write_data(0x0b);   //VGHREG    ??
    spi_write_data(0x0b);   //VGLREG    ??
    spi_write_data(0xa5);

    //Display area
    spi_write_command(0x31);
    spi_write_data(0x00);
    spi_write_data(0xEF);//0 - 239 = 240
    spi_write_data(0x02);
    spi_write_data(0x7F);


    //Display Set 2: Set source and gate ON/OFF timing
    spi_write_command(ST75_DISSET2);
    spi_write_data(0x07);
    spi_write_data(0x2c);
    spi_write_data(0x09);
    spi_write_data(0x2a);

    //Electronic Volume Set 2
    spi_write_command(ST75_EVSET2);
    spi_write_data(0x09);   //GVDD[4:0] ??
    spi_write_data(0x17);   //GVCL[4:0] ??
    spi_write_data(0xa5);   //
    spi_write_data(0xa5);   //

    //Gamma Set 4bpp Positive 1
    spi_write_command(ST75_GAMSET4P1);
    spi_write_data(0x00);
    spi_write_data(0x16);
    spi_write_data(0x1B);
    spi_write_data(0x1C);
    spi_write_command(ST75_GAMSET4P2);
    spi_write_data(0x1E);
    spi_write_data(0x1F);
    spi_write_data(0x20);
    spi_write_data(0x21);
    spi_write_command(ST75_GAMSET4P3);
    spi_write_data(0x23);
    spi_write_data(0x24);
    spi_write_data(0x26);
    spi_write_data(0x28);
    spi_write_command(ST75_GAMSET4P4);
    spi_write_data(0x2B);
    spi_write_data(0x2F);
    spi_write_data(0x34);
    spi_write_data(0x3f);

    //Gamma Set 4bpp Negative 1
    spi_write_command(ST75_GAMSET4N1);
    spi_write_data(0x00);
    spi_write_data(0x16);
    spi_write_data(0x1B);
    spi_write_data(0x1C);
    spi_write_command(ST75_GAMSET4N2);
    spi_write_data(0x1E);
    spi_write_data(0x1F);
    spi_write_data(0x20);
    spi_write_data(0x21);
    spi_write_command(ST75_GAMSET4N3);
    spi_write_data(0x23);
    spi_write_data(0x24);
    spi_write_data(0x26);
    spi_write_data(0x28);
    spi_write_command(ST75_GAMSET4N4);
    spi_write_data(0x2B);
    spi_write_data(0x2F);
    spi_write_data(0x34);
    spi_write_data(0x3F);

    //Sleep Out
    spi_write_command(ST75_SLPOUT);
    spi_write_data(0xA5);
#if 1 /* is set to ZERO by default !!!*/
    //Memory Address Control: Set about display data RAM.
    /* Select address incremental direction:
     * MV - 0 (Incremental column addr.)
     * Display data RAM page address:
     * MY - 0 (Normal)
     * Display data RAM column address
    *  MX - 0 (Normal) */
    spi_write_command(ST75_MADCTL);
    //sleep_ms(2);    //sleep is required by specyficatrion ST7511U
    spi_write_data(0x00);   //in spec is set to 0x01 [F57STIACDNN0]
    spi_write_data(0xA5);
    spi_write_data(0xA5);
    spi_write_data(0xA5);
#endif


    //BPP Select: Set data format (bit per pixel) BPP
    spi_write_command(ST75_BPPSEL);
    spi_write_data(0x00);   // 1bpp, (2 gray scale) 1 bit per pixel
    spi_write_data(0xA5);
    spi_write_data(0xA5);
    spi_write_data(0xA5);

    spi_write_command(0x25); //page address set
    spi_write_data(0x00); //start 0
    spi_write_data(0x29); //end 41
    spi_write_data(0x00);
    spi_write_data(0xa5);

    spi_write_command(0x26); //Collumn address set
    spi_write_data(0x00); //start 0
    spi_write_data(0x00);           //
    spi_write_data(0x01);   //end 479
    spi_write_data(0xdf);

//Display on
    spi_write_command(ST75_DISON);
    spi_write_data(0xA5);

    asm("NOP");

    CS_DISABLE;
}

And hear the function when I would like to clear whole display area:

void ST75_display_clr()
{
    UInt16_t i,j;

    //640/320
    ST75_set_window(0, 639, 0, 320);
    spi_write_command(ST75_WRRAM);

        for (i=0; i<30; i++) {
            for (j = 0; j<639; j++) {
                spi_write_data(0x00);
            }
        }
}

//640/320
static void ST75_set_window(UInt16_t s_x,UInt16_t e_x,UInt16_t s_y,UInt16_t e_y)
{
    //x, max = 640
    //CSA: Set column START addres
    spi_write_command(ST75_CASET);
    spi_write_data(s_x >> 8);
    spi_write_data((UInt8_t)s_x);   //max =
    //CEA: Set column END address
    spi_write_data(e_x >> 8);       //end 479
    spi_write_data((UInt8_t)e_x);

    //y, max  = 160
    spi_write_command(ST75_PASET);
    //PSA: Set page START address
    spi_write_data(s_y);   //x max = 
    //PEA: Set page END address
    spi_write_data(e_y);   //DEFAULT
    //FrmA: Set frame address - 00
    spi_write_data(0x00);   //DEFAULT
    spi_write_data(0xA5);
}


Br,
ToR

Outcomes