Announcement

Collapse
No announcement yet.

ST7775R driver

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

  • #16
    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
    Mark

    Comment


    • #17
      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.

      Comment


      • #18
        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

        Comment


        • #19
          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.

          Comment


          • #20
            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; 15th December 2017, 11:14 PM.

            Comment


            • #21
              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.
              Mark

              Comment


              • #22
                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?

                Comment


                • #23
                  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.
                  Mark

                  Comment


                  • #24
                    Hi,
                    Here I attach a zip file that contents an Eagle Library for Goldelox Graphic processor and the diode MBR0540T1G. These components are used in some 4DSystems products.

                    Attached Files

                    Comment

                    Working...
                    X