Announcement

Collapse
No announcement yet.

ST7775R driver

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • vellamy
    started a topic ST7775R driver

    ST7775R driver

    Hi,

    Do you have an example code for the driver ST7775R for using with Designer?

    I have the code for ST7735R, do you know if the drivers are too different?

    Thanks

  • ESPsupport
    replied
    media_Video will use the 'Frame Delay' set in GC or Workshop, so ensure that is 1

    No, your calculations are fine.

    The class speeds on uSD cards applies only when the cards are used in SD mode (and then there are more variables again)

    In SPI mode, which Goldelox uses, all cards are pretty much the same speed. You will find a slight variation, but it is quite possible you will see a class 4 faster than a class 10, so it's not worth hunting around.

    Leave a comment:


  • vellamy
    replied
    I am using the functions the following functions to display GIFs:
    media_SetSector(0x0000, 0xC84C);
    media_Video(0,0);
    Is there a better way to play videos?

    My TFT has the resolution 176x220=38.720pixels, so if I want to show 10 frames per seconds, Has Goldelox need to render 387,200 pixels? Surely I am wrong...

    Is there very much difference between using a class 4 orclass 10 in the speed of the videos?

    Leave a comment:


  • ESPsupport
    replied
    What functions are you using to drive the video and how are they 'controlled'?

    In general the 'setup' for the driver will have very little impact on the image speed.

    The speed will be influenced mostly by the speed of reading off the uSD card, which is pretty much constant for any uSD card.

    Goldelox can render roughly 210,000 pixels per second from uSD, so do some calculations to see how close you are to that.

    Ensure 'Frame Delay' is set to 1 in the process you use to setup your 'video' and/or pokeB 0 into IMAGE_DELAY. The poking will only be effective after the first frame is displayed when using media_VideoFrame() and you will not be able to effectively change it when using other methods. But really setting it to 1 in the source will be easiest and 1 will not effectively slow things down in practise.

    Leave a comment:


  • vellamy
    replied
    Hi,
    Here you have part of the code for the driver ST7775R:
    Code:
    #platform "GOLDELOX"
    #inherit "4DGL_16bitColours.fnc"
    
    //=============================================
    //=============================================
    // 4D Systems
    // GOLDELOX-GFX2
    // display specifics for ST7775R
    // Version 1.0
    // 30/11/2017
    //=============================================
    //=============================================
    #constant _DISPLAY_X_MAX       175  //width
    #constant _DISPLAY_Y_MAX       219  //heigth
    
    //=============================================
    // write device state machine constants
    // The values are fixed, do not change.
    // used in GRAM state machine tables
    //=============================================
    #CONST
        WRITE_CONTROL_CONSTANT     0
        WRITE_DATA_CONSTANT        1
        WRITE_CONTROL_BYTE         2
        WRITE_DATA_BYTE            3
        WRITE_EXIT                 0xFF
    #END
    
    //=============================================
    // GRAM rectangle control register addresses
    // the values represent the addresses of the
    // internal register address holding register
    // and are fixed.
    //=============================================
    #CONST
        _VX1                     0x80//Horizontal Address Start Position
        _VY1                     0x81//Vertical Address Start Position
        _VX2                     0x82//Horizontal Address End Position
        _VY2                     0x83//Vertical Address End Position
    #END
    
    //=============================================
    // ST7775R  Registers
    //=============================================
    #CONST
        // ST7775R LCD Controller Commands
        ST7775_DRAM_H       0x20//Horizontal DRAM Address set
        ST7775_DRAM_V       0x21//Vertical DRAM Address set
        ST7775_GRAM         0x22//Write\read data to\from GRAM
        ST7775_NVM_ID       0xD2//NVM ID Code
        ST7775_NVM_CTRL     0xD9//NVM Control Status
        ST7775_NVM          0xDF//NVM Write Command
        ST7775_SOFT_RES     0x28//Software Reset
        ST7775_DRAM_HSTART  0x37//Horizontal start address
        ST7775_DRAM_HEND    0x36//Horizontal end address
        ST7775_DRAM_VSTART  0x39//Vertical start address
        ST7775_DRAM_VEND    0x38//Vertical end address
    #END
    //=============================================
    // end
    //=============================================
    
    
    //===========================================================
    // GRAM state machine for ST7775R
    //===========================================================
    #DATA
    byte GRAM_sm
        WRITE_CONTROL_CONSTANT, ST7775_DRAM_HSTART, // 0x37
        WRITE_DATA_BYTE, 0x00,
        WRITE_CONTROL_CONSTANT, ST7775_DRAM_HEND, // 0x36
        WRITE_DATA_BYTE, 0xaf,
        WRITE_CONTROL_CONSTANT, ST7775_DRAM_VSTART, // 0x39
        WRITE_DATA_BYTE, 0x00,
        WRITE_CONTROL_CONSTANT, ST7775_DRAM_VEND, // 0x38
        WRITE_DATA_BYTE, 0xdb,
        WRITE_CONTROL_CONSTANT, ST7775_DRAM_H,
        WRITE_DATA_BYTE, _VX1,
        WRITE_DATA_BYTE, _VX2,
        WRITE_CONTROL_CONSTANT, ST7775_DRAM_V,
        WRITE_DATA_BYTE, _VY1,
        WRITE_DATA_BYTE, _VY2,
        WRITE_CONTROL_CONSTANT, ST7775_GRAM,
        WRITE_EXIT
    #END
    
    //===========================================================
    // initialization for the ST7775R
    // using 33 bytes
    //===========================================================
    #DATA
        byte INIT_tbl
        // first 4 bytes of table hold
        // display access information
        _DISPLAY_X_MAX,                        // width:  176-1
        _DISPLAY_Y_MAX,                        // height: 220-1
        ST7775_GRAM,                           // write access register  0x22=GRAM Read/Write Port
        ST7775_GRAM,                           // read access register
        // now the display initialization table
        //2,0x28,     0x00,0xCE,//Software reset
        //---------------Display Control Setting------------------//
        2,0x01,     0x00,0x1C,//Driver Output Control
        2,0x02,     0x01,0x00,//LCD Driving Control
        2,0x03,     0x10,0x10,//Entry Mode
        2,0x08,     0x0E,0x0E,//Display Control 2
        2,0x0C,     0x00,0x00,//RGB Display Interface Control 1
        2,0x0F,     0x00,0x01,//Frame Market Position
        2,0x20,     0x00,0x00,//Horizontal DRAM Address set
        2,0x21,     0x00,0x00,//Vertical DRAM Address set
        //----------------End Display Control setting-------------//
        //----------------Power Control Registers Initial --------//
        2,0x10,     0x00,0x00,//Power Control 1   -->0x00,0x00 segun truly
        2,0x11,     0x10,0x00,//Power Control 2   -->0x10,0x00
        //2,0xFF,     0x00,0x03,//NVM Commamd Enable
        //----------------End Power Control Registers Initial ----//
        INIT_TABLE_DELAY,          50,//0xFE, delay 100ms  //segĂșn Truly
        //----------------Display Windows 176 X 220---------------//
        2,0x30,     0x00,0x00,//Gate Scan Control
        2,0x31,     0x00,0xdb,//Vertical Scroll Control 1
        2,0x32,     0x00,0x00,//Vertical Scroll Control 2
        2,0x33,     0x00,0x00,//Vertical Scroll Control 3
        2,0x34,     0x00,0xdb,//Partial Driving Control 1
        2,0x35,     0x00,0x00,//Partial Driving Control 2
        //----------------End Display Windows --------------------//
        //set NVM
        2,0xff,     0x00,0x03,//NVM Commamd Enable
        //----------------Vcom Setting----------------------------//
        // vcom set
        2,0xB0,     0x17,0x01,//Power Control 3     VCOM=-1V
        //set AVDD
        2,0xB2,     0x06,0x16,//Power Control 5      AVDD=5.1V AVCL=-5.1V
        //----------------Gamma Cluster Setting-------------------//
        2,0x50,     0x05,0x07,//Gamma Control 1      0x02,0x03
        2,0x51,     0x09,0x0a,//Gamma Control 2      0x00,0x09
        2,0x52,     0x02,0x07,//Gamma Control 3      0x00,0x05
        2,0x53,     0x19,0x41,//Gamma Control 4      0x10,0x21
        2,0x54,     0x07,0x05,//Gamma Control 5      0x06,0x02
        2,0x55,     0x06,0x07,//Gamma Control 6      0x00,0x03
        2,0x56,     0x07,0x08,//Gamma Control 7      0x07,0x03
        2,0x57,     0x02,0x07,//Gamma Control 8      0x05,0x07
        2,0x58,     0x19,0x41,//Gamma Control 9      0x10,0x21
        2,0x59,     0x06,0x05,//Gamma Control 10
        //----------------End Gamma Setting-----------------------//
        //window size set
        2,0x36,     0x00,0xaf,//Horizontal Address End Position  --->0x00,0x085 segun truly
        2,0x37,     0x00,0x00,//Horizontal Address Start Position
        2,0x38,     0x00,0xdb,//Vertical Address End Position
        2,0x39,     0x00,0x00,//Vertical Address Start Position
        INIT_TABLE_DELAY,          10,//0xFE, delay 50ms
        //frame rate set
        2,0x0B,     0x00,0x04,//
        //2,0xB1,     0x02,0x02,//Power Control 4
    
        //----------------End Vcom Setting-------------------------//
        //2,0xff,     0x00,0x00,//NVM Commamd Enable
        2,0x07,     0x10,0x17,//Display Control 1
        INIT_TABLE_DELAY,          50,//0xFE, delay 50ms
        INIT_TABLE_END                // 0xFF,dont forget this !
    #END
    
    var combuf[10];
    
    func main()
    var value:=49;
      setbaud(BAUD_9600);
      com_Init(combuf,7,0);
      disp_Init(INIT_tbl, GRAM_sm);   // initialize the display
      while(!media_Init())            // initialize the SD Card
            putstr("Drive not mounted...");
            pause(1000);
            gfx_Cls();
            pause(100);
      wend
      // Image "fumar causa cancer"  5
      media_SetSector(0x0002, 0x0170);
      media_Image(2,1);
      pause(2000);
      // Video Porche 41
      media_SetSector(0x0007, 0x4234);
      media_Video(0,0);
    https://drive.google.com/open?id=1Hc...9E08B3N5RJlYe1


    I need to improve the frame rate, or the speed of image refresh, I mean, How can I increase the speed of the video??
    Modifiying the frames of the gif, the params of the TFT or the params of Goldelox?
    Attached Files
    Last edited by vellamy; 16th December 2017, 12:14 AM.

    Leave a comment:


  • vellamy
    replied
    Hello,

    Something I've achived.
    Click image for larger version

Name:	IMG_20171205_131241.jpg
Views:	1
Size:	875.5 KB
ID:	60870
    After this, I will create a Github place with examples of drivers for Goldelox. I will post here the direction in a week.
    Thank you very much!!!!!!!!!!!!!!!!!
    Now, I have to put the correct register in order to play the video well.

    Leave a comment:


  • vellamy
    replied
    So, tu sum up.
    I load the pmmc
    and then I change de gram part and add the "INIT_TABLE_16BIT_INDEX_REG_MODE.
    The code looks like:
    Code:
    #platform "GOLDELOX"
    #inherit "4DGL_16bitColours.fnc"
    
    //=============================================
    //=============================================
    // 4D Systems
    // GOLDELOX-GFX2
    // display specifics for ST7775R
    // Version 1.0
    // 30/11/2017
    //=============================================
    //=============================================
    #constant _DISPLAY_X_MAX        175  //width
    #constant _DISPLAY_Y_MAX        219  //heigTh
    #constant _256_COLOURS          0x34
    #constant _65K_COLOURS          0x74
    #constant _262K_COLOURS         0xB4
    //=============================================
    // write device state machine constants
    // The values are fixed, do not change.
    // used in GRAM state machine tables
    //=============================================
    #CONST
        WRITE_CONTROL_CONSTANT     0
        WRITE_DATA_CONSTANT        1
        WRITE_CONTROL_BYTE         2
        WRITE_DATA_BYTE            3
        WRITE_EXIT                 0xFF
    #END
    
    //=============================================
    // GRAM rectangle control register addresses
    // the values represent the addresses of the
    // internal register address holding register
    // and are fixed.
    //=============================================
    #CONST
        _VX1                     0x80
        _VY1                     0x81
        _VX2                     0x82
        _VY2                     0x83
    #END
    
    //=============================================
    // ST7775R  Registers
    //=============================================
    #CONST
        // ST7775R LCD Controller Commands
        ST7775_DRAM_H       0x20//Horizontal DRAM Address set
        ST7775_DRAM_V       0x21//Vertical DRAM Address set
        ST7775_GRAM         0x22//Write\read data to\from GRAM
        ST7775_NVM_ID       0xD2//NVM ID Code
        ST7775_NVM_CTRL     0xD9//NVM Control Status
        ST7775_NVM          0xDF//NVM Write Command
        ST7775_SOFT_RES     0x28//Software Reset
        ST7775_DRAM_HSTART  0x37//Horizontal start address
        ST7775_RAM_HEND     0x36//Horizontal end address
        ST7775_DRAM_VSTART  0x39//Vertical start address
        ST7775_DRAM_VEND    0x38//Vertical end address
    #END
    //=============================================
    // end
    //=============================================
    
    //===========================================================
    // GRAM state machine for ST7775R
    //===========================================================
    #DATA
    byte GRAM_sm
    
        WRITE_CONTROL_CONSTANT, ST7775_RAM_HEND, // 0x36
        WRITE_DATA_BYTE, _VX2,
        WRITE_CONTROL_CONSTANT, ST7775_DRAM_HSTART, // 0x37
        WRITE_DATA_BYTE, _VX1,
        WRITE_CONTROL_CONSTANT, ST7775_DRAM_VEND, // 0x38
        WRITE_DATA_BYTE, _VY2,
        WRITE_CONTROL_CONSTANT, ST7775_DRAM_VSTART, // 0x39
        WRITE_DATA_BYTE, _VY1,
        //WRITE_CONTROL_CONSTANT, ST7775_DRAM_H, //Note, these may not be needed
        //WRITE_DATA_BYTE, _VX1,
        //WRITE_CONTROL_CONSTANT, ST7775_DRAM_V,
        //WRITE_DATA_BYTE, _VY1,
        WRITE_EXIT
    #END
    
    //===========================================================
    // initialization for the ST7775R
    // using 33 bytes
    //===========================================================
    #DATA
        byte INIT_tbl
        _DISPLAY_X_MAX,                        // width:  176-1
        _DISPLAY_Y_MAX,                        // height: 220-1
        ST7775_GRAM,                           // write access register  0x22=GRAM Read/Write Port
        ST7775_GRAM,                           // read access register
        INIT_TABLE_16BIT_INDEX_REG_MODE,
        // now the display initialization table
        2,0x01,     0x01,0x1C,//Driver Output Control
        2,0x02,     0x01,0x00,//LCD Driving Control
        2,0x03,     0x00,0x30,//Entry Mode
        2,0x08,     0x08,0x08,//Display Control 2
        2,0x0C,     0x00,0x00,//RGB Display Interface Control 1
        2,0x0F,     0x0E,0x01,//Frame Market Position
    
        2,0x10,     0x00,0x00,//Power Control 1
        2,0x11,     0x10,0x00,//Power Control 2
        2,0xFF,     0x00,0x03,//NVM Commamd Enable
        2,0xB0,     0x14,0x11,
        2,0xB1,     0x02,0x02,
        2,0xB2,     0x03,0x13,
    
        2,0x30,     0x00,0x00,//Gate Scan Control
        2,0x31,     0x00,0xdb,//Vertical Scroll Control 1
        2,0x32,     0x00,0x00,//Vertical Scroll Control 2
        2,0x33,     0x00,0x00,//Vertical Scroll Control 3
        2,0x34,     0x00,0xdb,//Partial Driving Control 1
        2,0x35,     0x00,0x00,//Partial Driving Control 2
        2,0x36,     0x00,0xaf,//Horizontal Address End Position  --->0x00,0x085 segun truly
        2,0x37,     0x00,0x00,//Horizontal Address Start Position
        2,0x38,     0x00,0xdb,//Vertical Address End Position
        2,0x39,     0x00,0x00,//Vertical Address Start Position
    
        2,0xFF,     0x00,0x03,//NVM Commamd Enable
        2,0x50,     0x00,0x00,//Gamma Control 1      0x02,0x03
        2,0x51,     0x03,0x0,//Gamma Control 2      0x00,0x09
        2,0x52,     0x01,0x03,//Gamma Control 3      0x00,0x05
        2,0x53,     0x20,0x11,//Gamma Control 4      0x10,0x21
        2,0x54,     0x07,0x03,//Gamma Control 5      0x06,0x02
        2,0x55,     0x00,0x00,//Gamma Control 6      0x00,0x03
        2,0x56,     0x04,0x00,//Gamma Control 7      0x07,0x03
        2,0x57,     0x01,0x07,//Gamma Control 8      0x05,0x07
        2,0x58,     0x20,0x11,//Gamma Control 9      0x10,0x21
        2,0x59,     0x07,0x03,//Gamma Control 10
        2,0x20,     0x00,0x00,//Horizontal DRAM Address set
        2,0x21,     0x00,0x00,//Vertical DRAM Address set
        2,0x07,     0x10,0x17,//Display Control 1
        INIT_TABLE_END                // 0xFF,dont forget this !
    #END
    
    
    func main()
      disp_Init(INIT_tbl, GRAM_sm);   // initialize the display
      while(!media_Init())            // initialize the SD Card
            putstr("Drive not mounted...");
            pause(1000);
            gfx_Cls();
            pause(100);
      wend
      repeat
      print("hello");
      pause(2000);
      media_SetSector(0x0000, 0x0000);
      media_Video(2,1);
      pause(2000);
      forever
    endfunc
    I am assuming that the board it is well soldered by the manufacturer. I am doubting if the pins do good contact because it is being very diffucult to work with this TFT

    Leave a comment:


  • vellamy
    replied
    Hi Mark,

    Thank you very much for helping me!

    I will try to put 0's everywhere.


    "In post #7 and other places you say "the screen it still is white", in post #13 you say "It looks like the displays is initializated but some params must be wrong because it only displays with color." The display being white tends to indicate it is not being initialized at all, it's just the backlight coming on. Whe you say 'displays with color' what exactly do you mean?"
    Sorry, there I wanted to write " it only displays with white", I wrote the incorrect word.


    P.S. Why the torture changing displays all the time?
    Yes it is but it is not my decision.

    Leave a comment:


  • ESPsupport
    replied
    OK, please try the attached PmmC

    There are a few other things to do as well.

    The last lot of init stuff should be ok, but you need to add "INIT_TABLE_16BIT_INDEX_REG_MODE" in there, as the first entry of the init table.

    The gram should be more like, note you don't need any 0x00's

    Code:
    #DATA
    byte GRAM_sm
    //  WRITE_CONTROL_CONSTANT, ST7775_DRAM_H, Note, these may not be needed
    //  WRITE_DATA_BYTE, _VX1,
    //  WRITE_CONTROL_CONSTANT, ST7775_DRAM_V,
    //  WRITE_DATA_BYTE, _VY1,
        WRITE_CONTROL_CONSTANT, ST7775_RAM_HEND, // 0x36
        WRITE_DATA_BYTE, _VX2,
        WRITE_CONTROL_CONSTANT, ST7775_DRAM_HSTART, // 0x37
        WRITE_DATA_BYTE, _VX1,
        WRITE_CONTROL_CONSTANT, ST7775_DRAM_VEND, // 0x38
        WRITE_DATA_BYTE, _VY2,
        WRITE_CONTROL_CONSTANT, ST7775_DRAM_VSTART, // 0x39
        WRITE_DATA_BYTE, _VY1,
        WRITE_EXIT
    #END
    Attached Files

    Leave a comment:


  • ESPsupport
    replied
    Err, trying again whilst looking at the correct datasheet

    It seems this chip needs 16bit transfers for everything, so you will need to put extra 0s everywhere.

    Not just the state machine but even the init codes. (and what you have is closer, but still inadequate)

    But that isn't really feasible as the init codes assume the first byte is the command code, not the first two bytes.

    What a waste of 'data', so you have to wonder if the datasheet is NQR

    In post #7 and other places you say "the screen it still is white", in post #13 you say "It looks like the displays is initializated but some params must be wrong because it only displays with color." The display being white tends to indicate it is not being initialized at all, it's just the backlight coming on. Whe you say 'displays with color' what exactly do you mean?

    Let me look into this further

    P.S. Why the torture changing displays all the time?

    Leave a comment:


  • vellamy
    replied
    According to this code for ST7775R:
    Code:
    void Display::setWindow(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2) {
            writeWr(0x37, x1);
            writeWr(0x36, x2);
            writeWr(0x39, y1);
            writeWr(0x38, y2);
            writeWr(0x20, x1);
            writeWr(0x21, y1);
        }
    
        void Display::drawPixel(int16_t x, int16_t y, uint16_t color) {
            setWindow(x, y, x, y);
            writeWr(0x22, color);
        }
    
        void Display::begin() {
            writeWr(0x01, 0x011C);
            writeWr(0x02, 0x0100);
            writeWr(0x03, 0x1030);
            writeWr(0x08, 0x0808);
            writeWr(0x0C, 0x0000);
            writeWr(0x0F, 0x0E01);
    
            writeWr(0x10, 0x0A00);
            writeWr(0x11, 0x1038);
            writeWr(0xFF, 0x0003);
            writeWr(0xB0, 0x1411);
            writeWr(0xB1, 0x0202);
            writeWr(0xB2, 0x0313);
    
            writeWr(0x30, 0x0000);
            writeWr(0x31, 0x00db);
            writeWr(0x32, 0x0000);
            writeWr(0x33, 0x0000);
            writeWr(0x34, 0x00db);
            writeWr(0x35, 0x0000);
            writeWr(0x36, 0x00AF);
            writeWr(0x37, 0x0000);
            writeWr(0x38, 0x00DB);
            writeWr(0x39, 0x0000);
    
            writeWr(0xFF, 0x0003);
            writeWr(0x50, 0x0000);
            writeWr(0x51, 0x0300);
            writeWr(0x52, 0x0103);
            writeWr(0x53, 0x2011);
            writeWr(0x54, 0x0703);
            writeWr(0x55, 0x0000);
            writeWr(0x56, 0x0400);
            writeWr(0x57, 0x0107);
            writeWr(0x58, 0x2011);
            writeWr(0x59, 0x0703);
            writeWr(0x20, 0x0000);
            writeWr(0x21, 0x0000);
            writeWr(0x07, 0x1017);
    }
    My GRAM part should be like this:

    Code:
    #DATA
    byte GRAM_sm
    WRITE_CONTROL_CONSTANT, _VX1,
    WRITE_DATA_BYTE, 0x00,
    WRITE_CONTROL_CONSTANT, _VX2,
    WRITE_DATA_BYTE, 0xAF,
    WRITE_CONTROL_CONSTANT, _VY1,
    WRITE_DATA_BYTE, 0x00,
    WRITE_CONTROL_CONSTANT, _VY2,
    WRITE_DATA_BYTE, 0xDB,
    WRITE_CONTROL_CONSTANT, ST7775_DRAM_H,
    WRITE_DATA_BYTE, 0x00,
    WRITE_CONTROL_CONSTANT, ST7775_DRAM_V,
    WRITE_DATA_BYTE, 0x00,
    WRITE_CONTROL_CONSTANT, ST7775_GRAM,
    WRITE_EXIT
    #END
    However, it still doesn't work...

    Leave a comment:


  • vellamy
    replied
    Hi
    My configuration is 8080-8bits because de document said:
    Click image for larger version

Name:	IM03.png
Views:	2
Size:	57.0 KB
ID:	60832
    The squematic in the previous doc is not my circuit. It looks like the displays is initializated but some params must be wrong because it only displays with color.
    Click image for larger version

Name:	displayST7775.png
Views:	1
Size:	103.3 KB
ID:	60830
    Click image for larger version

Name:	GOldelox.png
Views:	1
Size:	80.7 KB
ID:	60833
    Attached Files

    Leave a comment:


  • ESPsupport
    replied
    What have you got the IMx bits set to on the hardware?

    The app note you have attached shows an SPI configuration (because IM2=gnd), it needs to be configured for 80 series 8bit parallel.

    Leave a comment:


  • vellamy
    replied
    Hi,
    I have tested many combinations, and I don't know what do....
    I am using the platforn "GOLDELOX" but I have using the GOLDELOX-GFX2" pmmc file... If I triend to write /#platform "GOLDELOX-GFX2", the compilation fails

    A similar code I have tried before:
    Code:
    #platform "GOLDELOX"   
    //#platform "GOLDELOX-GFX2"
    #inherit "4DGL_16bitColours.fnc"
    
    //=============================================
    //=============================================
    // 4D Systems
    // GOLDELOX-GFX2
    // display specifics for ST7775R
    // Version 1.0
    // 30/11/2017
    //=============================================
    //=============================================
    #constant _DISPLAY_X_MAX 175 //width
    #constant _DISPLAY_Y_MAX 219//heigTh
    
    //=============================================
    // write device state machine constants
    // The values are fixed, do not change.
    // used in GRAM state machine tables
    //=============================================
    #CONST
        WRITE_CONTROL_CONSTANT  0
        WRITE_DATA_CONSTANT     1
        WRITE_CONTROL_BYTE      2
        WRITE_DATA_BYTE         3
        WRITE_EXIT              0xFF
    #END
    
    
    //=============================================
    // GRAM rectangle control register addresses
    // the values represent the addresses of the
    // internal register address holding register
    // and are fixed.
    
    //=============================================
    #CONST
        _VX1                    0x80//rizontal Address Start Position
        _VY1                    0x81//rtical Address Start Position
        _VX2                    0x82//rizontal Address End Position
        _VY2                    0x83//rtical Address End Position
    #END
    
    //=============================================
    // ST7775R Registers
    //=============================================
    #CONST
        // ST7775R LCD Controller Commands
        ST7775_DRAM_H             0x20//Horizontal DRAM Address set    ,Datasheet said: 0x0020
        ST7775_DRAM_V             0x21//Vertical DRAM Address set      ,Datasheet said: 0x0021
        ST7775_GRAM               0x22//Write\read data to\from GRAM   ,Datasheet said: 0x0022
    #END
    //=============================================
    // fin
    //=============================================
    
    
    //===========================================================
    // GRAM state machine for ST7775R
    // using 13 bytes
    //===========================================================
    #DATA
    byte GRAM_sm
        WRITE_CONTROL_CONSTANT, ST7775_DRAM_H,
        WRITE_DATA_BYTE, 0x00,
        WRITE_DATA_BYTE, _VX1,
        WRITE_DATA_BYTE, 0x00,
        WRITE_DATA_BYTE, _VX2,
        WRITE_CONTROL_CONSTANT, ST7775_DRAM_V,
        WRITE_DATA_BYTE, 0x00,
        WRITE_DATA_BYTE, _VY1,
        WRITE_DATA_BYTE, 0x00,
        WRITE_DATA_BYTE, _VY2,
        WRITE_EXIT
    #END
    //===========================================================
    // initialization for the ST7775R
    // using 33 bytes
    //===========================================================
    #DATA
    byte INIT_tbl
    // first 4 bytes of table hold
    // display access information
    _DISPLAY_X_MAX, // width: 137-1
    _DISPLAY_Y_MAX, // height: 220-1
    ST7775_GRAM, // write access register 0x0022=GRAM Read/Write Port
    ST7775_GRAM, // read access register
    // now the display initialization table
    INIT_TABLE_DELAY, 10,//0xFE, delay 10ms
    2,0x01,     0x01,0x1C,//Driver Output Control
    //DOT inversion
    2,0x02,     0x01,0x00,//LCD Driving Control
    2,0x03,     0x10,0x30,//Entry Mode
    2,0x08,     0x08,0x08,//Display Control 2
    //RGB interface control
    2,0x0C,     0x00,0x00,//RGB Display Interface Control 1
    //Oscillator on/off
    2,0x0F,     0x00,0x01,//Oscillator control
    //AC pointer set
    2,0x20,     0x00,0x00,//Horizontal DRAM Address set
    2,0x21,     0x00,0x00,//Vertical DRAM Address set
    INIT_TABLE_DELAY, 10,//0xFE, delay 10ms
    //step up circuit
    2,0x10,     0x00,0x00,//Power Control 1
    2,0x11,     0x10,0x00,//Power Control 2
    INIT_TABLE_DELAY, 50,//0xFE, delay 10ms
    //display control
    2,0x30,     0x00,0x00,//Gate Scan Control
    2,0x31,     0x00,0xdb,//Vertical Scroll Control 1
    2,0x32,     0x00,0x00,//Vertical Scroll Control 2
    2,0x33,     0x00,0x00,//Vertical Scroll Control 3
    2,0x34,     0x00,0xdb,//Partial Driving Control 1
    2,0x35,     0x00,0x00,//Partial Driving Control 2
    //set NVM
    2,0xFA,     0x00,0x40,//NVM Enable
    2,0xFF,     0x00,0x03,//NVM Commamd Enable
    2,0xD9,     0x00,0x40,//NVM Commamd Enable
    //vcom set
    2,0xB0,     0x17,0x01,//Power Control 3 //VCOM=-1
    //set AVDD
    2,0xB2,     0x06,0x16,//Power Control 5 //AVSS=5.1v AVLC=-5,1V
    //set gamma
    2,0x50,     0x05,0x07,//Gamma Control 1
    2,0x51,     0x09,0x0a,//Gamma Control 2
    2,0x52,     0x02,0x07,//Gamma Control 3
    2,0x53,     0x19,0x41,//Gamma Control 4
    2,0x54,     0x07,0x05,//Gamma Control 5
    2,0x55,     0x06,0x07,//Gamma Control 6
    2,0x56,     0x07,0x08,//Gamma Control 7
    2,0x57,     0x02,0x07,//Gamma Control 8
    2,0x58,     0x19,0x41,//Gamma Control 9
    2,0x59,     0x06,0x05,//Gamma Control 10
    //windows size set
    2,0x36,     0x00,0xaf,//Horizontal Address End Position
    2,0x37,     0x00,0x00,//Horizontal Address Start Position
    2,0x38,     0x00,0xdb,//Vertical Address End Position
    2,0x39,     0x00,0x00,//Vertical Address Start Position
    INIT_TABLE_DELAY, 10,//0xFE, delay 10ms
    //frame rate set
    2,0x0b,     0x00,0x04,//Frame cycle control
    //display on
    2,0x07,     0x10,0x17,//Display Control 1
    INIT_TABLE_DELAY, 50,//0xFE, delay 10ms
    INIT_TABLE_END // 0xFF,dont forget this !
    #END
    
    func main()
        com_Init(combuf,7,0);
        disp_Init(INIT_tbl, GRAM_sm); // initialize the display
    My displays blinks with the delays and frame refresh, but the screen is white....
    I attach another document that TRULY provides me. The initialization table is clear to me but some byte must be wrong....
    Attached Files

    Leave a comment:


  • ESPsupport
    replied
    Sorry, I'm traveling atm, so you will need to hand on for a few more days before I can have a proper look.

    But since you thing the sm is the issue, here's a typical one for the ST7735 (I think)

    Code:
    #DATA
    byte GRAM_sm
        WRITE_CONTROL_CONSTANT, CASET,
        WRITE_DATA_CONSTANT,     0,
        WRITE_DATA_BYTE, _VX1,
        WRITE_DATA_CONSTANT,     0,
        WRITE_DATA_BYTE, _VX2,
        WRITE_CONTROL_CONSTANT, RASET,
        WRITE_DATA_CONSTANT,     0,
        WRITE_DATA_BYTE, _VY1,
        WRITE_DATA_CONSTANT,     0,
        WRITE_DATA_BYTE, _VY2,
        WRITE_EXIT
    #END

    Leave a comment:

Working...
X