Forum Rule: Always post complete source code & details to reproduce any issue!
Page 11 of 14 FirstFirst ... 9 10 11 12 13 ... LastLast
Results 251 to 275 of 326

Thread: RA8876LiteTeensy For Teensy T36 and T40

  1. #251
    Senior Member
    Join Date
    Aug 2017
    Posts
    306
    @mjs513, @Kurte - I just got back to Ra8876LiteTeensy today. I have been going through all of the work that you guy's did trying to reorient myself to the changes. Did not realize all of the work you put into it. WOW! Been going through the examples one by one and as @manu stated there are things to be fixed in my examples. One example sketch I am having problems with now is MemoryTransfer.ino. Not sure why yet. It was working. Sometimes it will work and other times it won't. Just get a random pattern on the screen that slowly fades to white. I have to power cycle t get any other sketch to work.

    I have not looked at my branch for some time. I now see the pull request. Can someone tell me how to backup the master branch before I do the PR? Most of my programs are not yet compatible with the new Ra8876LiteTeensy branch. And haven't had enough time yet to convert them. Been trying to get MSC updated. Need a break from it

    Edit: Never mind about backing up the master branch I just figured it out. I did the PR.
    Last edited by wwatson; 07-03-2020 at 07:54 PM.

  2. #252
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,556
    Quote Originally Posted by wwatson View Post
    @mjs513, @Kurte - I just got back to Ra8876LiteTeensy today. I have been going through all of the work that you guy's did trying to reorient myself to the changes. Did not realize all of the work you put into it. WOW! Been going through the examples one by one and as @manu stated there are things to be fixed in my examples. One example sketch I am having problems with now is MemoryTransfer.ino. Not sure why yet. It was working. Sometimes it will work and other times it won't. Just get a random pattern on the screen that slowly fades to white. I have to power cycle t get any other sketch to work.

    I have not looked at my branch for some time. I now see the pull request. Can someone tell me how to backup the master branch before I do the PR? Most of my programs are not yet compatible with the new Ra8876LiteTeensy branch. And haven't had enough time yet to convert them. Been trying to get MSC updated. Need a break from it

    Edit: Never mind about backing up the master branch I just figured it out.
    Think that is one of the things we never got around too was checking all the examples sketches to see if they still worked. The lib was kind of overhauled. All the memory stuff was done by @morganS. Same thing for the Readme.

  3. #253
    Senior Member
    Join Date
    Aug 2017
    Posts
    306
    I did the PR and am playing with the example sketches right now. It blows me away the way you guy's redid the library. It is going to be fun working with a quality library. I did not realize you had the rotation working completely. I thought you were not going to be able to do the 90 degree rotation but when I ran the RA8876Rotate sketch I was really blown away

  4. #254
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,472
    @mjs513 did the majority of the work... Especially while I waited for about 6 weeks for my board to arrive.

    Warning: with rotations, I don't believe we ever got the built in system fonts to work in any orientation other than the default...
    Unless someone figured it out after I punted!...

    Was fun!

  5. #255
    Senior Member
    Join Date
    Aug 2017
    Posts
    306
    Quote Originally Posted by KurtE View Post
    @mjs513 did the majority of the work... Especially while I waited for about 6 weeks for my board to arrive.

    Warning: with rotations, I don't believe we ever got the built in system fonts to work in any orientation other than the default...
    Unless someone figured it out after I punted!...

    Was fun!
    Got it. That was the difference. Completely missed the fact that you were using graphic fonts. Right now I am working with piptest.ino. Discovered a conflict between drawRect() and printStatusLine(). Eliminating all but drawBoarder() and printStatusLine() I have found that getFontHeight() loses 24 pixels after using printStatusLine(). Working on a sketch to demonstrate the issue. I already have done several tests but only if I eliminate printStatusLine() or writeStatusLine() is the issue resolved.

    I will post the test sketch later. Gotta make dinner now.

    Thanks for all your hard work on this library

  6. #256
    Senior Member
    Join Date
    Jan 2015
    Location
    France
    Posts
    115
    @KurtE :
    5V work well too here. Thank for thr head up.

    @All :
    It should be good to state which library will be the official one ;-)

  7. #257
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,472
    @Manu - Official ? As with everything Github the one you are using...

    Hopefully they are all pretty much in sync right now. That is I believe all of the stuff we were working on is now merged into the original one:
    https://github.com/wwatson4506/Ra8876LiteTeensy

    Currently I don't have anything I am doing on it, not sure for @mjs513, but if/when I start playing with it again, will look to see if I should go off of master and/or if there is some feature that a few of us may be trying to make work and then maybe work off which ever branch the one who started that feature created...

    @wwatson - Will be interesting to see what is busted. For the most part I never tried anything with status line, other than to maybe fix a few things with the rotation test stuff. But depending on what is happening, may have to plug my RA8876 back into the adapter board.

  8. #258
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,556
    @KurtE and @Manu
    As far as I can see both libs are in sync. The master in my fork was updated with all the changes in the branch where @KurtE and I did all the updates. @KurtE thanks for the compliment but you deserve a lot of the credit as well for getting all the rotations and fixing the graphics fonts.

    As @KurtE said I haven't really done anything else with it since we did the baseline to get the everything in sync. Really need to get back to at some point to fix up all the examples as you and @wwatson pointed out.

    @wwatson - looked at the system fonts but couldn't break the code on getting it work - don't think its possible to be honest. As for the 24pixels that may because I missed a spot when using printstatusline or writeStatusLine since 24 pixels were kind of reserved for status line. Guess i missed something. Example sketch would be good.

  9. #259
    Hi all,


    So ive got the 1280x400 bar-style IPS display and with the help of two people on here caiannello and fe0925 i manage to get it working.
    Ive currently got it running with this library https://github.com/caiannello/ER-TFTM0784-1 and got it running well on a teency 3.6

    Click image for larger version. 

Name:	20200704_152813.jpg 
Views:	9 
Size:	178.6 KB 
ID:	20852

    So after following mjs513 advice i thought i would try this library. I thought i would try the example graphics.ino.
    As your displays dont have a SSD2828 i moved the code from Craigs library and put it so it would init the SSD2828 chip as it does in the library above.
    Then in the following file of this library RA8876 i changed the following to correct for the resolution of my display.


    Code:
    #define PAGE1_START_ADDR  0
    #define PAGE2_START_ADDR  400*1280*2 // 1024*600*2   // 1228800 bytes
    #define PAGE3_START_ADDR  400*1280*2*2 // 1024*600*2*2 // 2457600 
    #define PAGE4_START_ADDR  400*1280*2*3 // 1024*600*2*3
    #define PAGE5_START_ADDR  400*1280*2*4 // 1024*600*2*4
    #define PAGE6_START_ADDR  400*1280*2*5 // 1024*600*2*5
    #define PAGE7_START_ADDR  400*1280*2*6 // 1024*600*2*6
    #define PAGE8_START_ADDR  400*1280*2*7 // 1024*600*2*7
    #define PAGE9_START_ADDR  400*1280*2*8 // 1024*600*2*8
    #define PAGE10_START_ADDR  400*1280*2*9 // 1024*600*2*9
    
    #define PATTERN1_RAM_START_ADDR 400*1280*2*10 // 1024*600*2*10
    #define PATTERN2_RAM_START_ADDR (400*1280*2*10)+(16*16*2) // (1024*600*2*10)+(16*16*2)
    #define PATTERN3_RAM_START_ADDR (400*1280*2*10)+(16*16*2)+(16*16*2) // (1024*600*2*10)+(16*16*2)+(16*16*2)
    
    /*DMA picture data start address*/
    #define WP1_ADDR  0
    #define WP2_ADDR  400*1280*2 // 1024*600*2
    #define WP3_ADDR  400*1280*2*2 // 1024*600*2*2
    #define WP4_ADDR  400*1280*2*3 // 1024*600*2*3
    #define WP5_ADDR  400*1280*2*4 // 1024*600*2*4
    #define WP6_ADDR  400*1280*2*5 // 1024*600*2*5

    Code:
    /* Screen Page Addresses */
    #define SCREEN_1  0
    #define SCREEN_2  400*1280*2 //1024*600*2
    #define SCREEN_3  400*1280*2*2 //1024*600*2*2
    #define SCREEN_4  400*1280*2*3 //1024*600*2*3
    #define SCREEN_5  400*1280*2*4 //1024*600*2*4
    #define SCREEN_6  400*1280*2*5 //1024*600*2*5
    #define SCREEN_7  400*1280*2*6 //1024*600*2*6
    #define SCREEN_8  400*1280*2*7 //1024*600*2*7
    #define SCREEN_9  400*1280*2*8 //1024*600*2*8

    and in RA8876_t3.cpp

    Code:
    	
    int16_t HDW = 400; //1024;
    int16_t VDH = 1280; //600;

    I checked the pin assignments are correct and match the code i got working above and my back light is externally powered. But when i run the graphics example the display just stays black (with the back light on)
    Ive tried running the teency at different speeds and setting the sip i different speeds, but nothing seems to make any difference.

    Does anyone have any ideas of anything simple ive overlooked?

    Thanks in advance

    Trev

  10. #260
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,556
    @gotty101

    You may have to change the display timing settings in the registers.h file. Or just a quick look at your lib looks like may be something with vsynch or vsynch functions that i dont see in our lib. I

    Code:
    /*TFT timing configure*/
    #define TFT_MODE   0  //0:SYNC_mode(SYNC+DE mode), 1: DE mode  //if sync only mode do not connect DE signal or XDE_INV = 1
    #define XHSYNC_INV  1 // 0:no inversion, 1:inversion 
    #define XVSYNC_INV  1 // 0:no inversion, 1:inversion 
    #define XDE_INV     0 // 0:no inversion, 1:inversion 
    #define XPCLK_INV  1  // 0:no inversion, 1:inversion 
    #define HPW       70   //
    #define HND       160
    //#define HDW       1024
    #define HST       160
    #define VPW       10
    #define VND       23
    //#define VDH       600
    #define VST       12

  11. #261
    Senior Member
    Join Date
    Aug 2017
    Posts
    306
    @mjs513 - Here is a sketch to demonstrate the issue with drawRect() and printStatusLine().

    Code:
    #include "Arduino.h"
    #include "RA8876_t3.h"
    
    #include <math.h>
    
    #define RA8876_CS 10
    #define RA8876_RESET 8
    #define BACKLITE 7 //External backlight control connected to this Arduino pin
    RA8876_t3 tft = RA8876_t3(RA8876_CS, RA8876_RESET); //Using standard SPI pins
    
    // Array of RA8876 Basic Colors
    PROGMEM uint16_t myColors[] = {
    	0x0000,
    	0xffff,
    	0xf800,
    	0xfc10,
    	0x8000,
    	0x07e0,
    	0x87f0,
    	0x0400,
    	0x001f,
    	0x051f,
    	0x841f,
    	0x0010,
    	0xffe0,
    	0xfff0,
    	0x8400,
    	0x07ff,
    	0x87ff,
    	0x0410,
    	0xf81f,
    	0xfc1f,
    	0x8010,
    	0xA145
    };
    
    uint16_t x = 0;
    uint16_t y = 0;
    uint16_t w = 0;
    uint16_t h = 0;
    uint8_t fw = 0;
    uint8_t fh = 0;
    
    const PROGMEM char *title ="Ra8876 Testing\n";
    uint8_t len = 0;
    uint16_t thickness = 10; // drawRect() line thickness (Brush Size)
    
    // Draw a border for the text window
    void drawBorder(void) {
    	uint64_t color = 0;
    	fw = tft.getFontWidth();
    	fh = tft.getFontHeight();
    	x = (10*fw)-thickness;
    	y = (2*fh)-thickness;
    	w = tft.width()-(20*fw) + 2*thickness;
    	h = tft.height()-(4*fh) + 2*thickness;
    	color = random(0,65535) | 0x5555;
    Serial.printf("h = %d, fh = %d\n",h,fh);
    	for(int i = 1; i <= thickness; i++) {
    		tft.drawRect(x, y, w, h, color);
    		x+=1;
    		y+=1;
    		w-=2;
    		h-=2;
    	}
    }
    
    void wait_for_keyboard() {
      Serial.println("Wait for any key to continue");
      while (Serial.read() == -1);
      while (Serial.read() != -1);
    }
    
    char STR1[256];
    void setup() {
      //I'm guessing most copies of this display are using external PWM
      //backlight control instead of the internal RA8876 PWM.
      //Connect a Teensy pin to pin 14 on the display.
      //Can use analogWrite() but I suggest you increase the PWM frequency first so it doesn't sing.
      pinMode(BACKLITE, OUTPUT);
      digitalWrite(BACKLITE, HIGH);
      
      tft.begin();
    	//initVT100();
    	tft.setFontSize(2,false);
    	tft.setCursor(0,0);
    	tft.fillScreen(myColors[11]);
    	len = strlen(title);
    	tft.setTextColor(myColors[6],myColors[11]);
    	tft.setCursor((tft.width()/2) - (len/2)*tft.getFontWidth(),0);
    	tft.println(title);
    	tft.setTextColor(myColors[1],myColors[11]);
    	tft.setFontSize(1,true);
    	tft.setTMargins(10, 2, 10, 2); //Setup a text window
      delay(500);
      wait_for_keyboard();
      drawBorder();
      wait_for_keyboard();
      tft.printStatusLine(0,myColors[13],myColors[11],"Testing drawRect() and printStatusLine()");
      wait_for_keyboard();
      drawBorder();
    }
    
    void loop() {
      delay(1000);
    }
    This is the output:

    Code:
    Wait for any key to continue
    h = 524, fh = 24
    Wait for any key to continue
    Wait for any key to continue
    h = 500, fh = 24
    If I comment out printStatusLine() I get this:
    Code:
    Wait for any key to continue
    h = 524, fh = 24
    Wait for any key to continue
    Wait for any key to continue
    h = 524, fh = 24
    I'll try and see if I can locate the problem. It seems that printStatusLine() or writeStatusLine() may be altering something.

    Edit: I figured out what the problem was. In the writeStatusLine() function at the beginning this line appears:
    Code:
    	_height = SCREEN_HEIGHT-STATUS_LINE_HEIGHT;
    This changes the _height variable to 576 from 600. It was never changed back to 600 before leaving the function. I made and assigned a temporary variable to preserve the original value of _height then reassigned _height before leaving the function.

    This took care of the loss of 24 pixel lines.

    Here is the modified writeStausLine() function:
    Code:
    //**************************************************************//
    /* Write a string to status line using a constant 8x16 font     */
    /* x0 is starting position of string                            */
    /* fgcolr is foreground color                                   */
    /* bgcolor is background color                                  */
    /* str is a pointer to a text string                            */
    //**************************************************************//
    void  RA8876_t3::writeStatusLine(ru16 x0, uint16_t fgcolor, uint16_t bgcolor, const char *str)
    {
    	uint16_t tempX = _cursorX;
    	uint16_t tempY = _cursorY;
    	uint16_t tempBGColor = _TXTBackColor;
    	uint16_t tempFGColor = _TXTForeColor;
    	uint8_t tempScaleX = _scaleX;
    	uint8_t tempScaleY = _scaleY;
    	uint8_t tempFontWidth = _FNTwidth;
    	uint8_t tempFontHeight = _FNTheight;
    	uint16_t temp_height = _height;
    	_height = SCREEN_HEIGHT-STATUS_LINE_HEIGHT;
    
    	// Set fontsize to a constant value
    	if(UDFont) {
    		_scaleX = _scaleY = 1;
    		_FNTwidth = 8;
    		_FNTheight = 16;
    	}// else {
    //		_FNTwidth = 12;
    //		_FNTheight = 24;
    //	}
    
    	buildTextScreen();
    	textMode(true);
    	setTextCursor(x0, _height);
    	textColor(fgcolor,bgcolor);
    	if(!UDFont) {
    		ramAccessPrepare();
    		while(*str != '\0')
    		{
    			checkWriteFifoNotFull();  
    			lcdDataWrite(*str);
    			++str; 
    		} 
    		check2dBusy();
    	}
    	if(UDFont) {
    		_scaleX = _scaleY = 1;
    		while(*str != '\0')
    		{
    			CGRAM_Start_address(PATTERN1_RAM_START_ADDR);
    			ramAccessPrepare();
    			checkWriteFifoNotFull();  
    			lcdDataWrite(*str>>8);
    			checkWriteFifoNotFull();  
    			lcdDataWrite(*str);
    			++str; 
    			x0+=_FNTwidth*_scaleX;
    		} 
    		check2dBusy();
    	}
    	_scaleX = tempScaleX;
    	_scaleY = tempScaleY;
    	_FNTwidth = tempFontWidth;
    	_FNTheight = tempFontHeight;
    	_height = temp_height;
    	buildTextScreen();
    	textMode(false);
    	setTextCursor(tempX,tempY);
    	textColor(tempFGColor,tempBGColor);
    }
    Last edited by wwatson; 07-04-2020 at 05:37 PM. Reason: Fixed I think.

  12. #262
    Senior Member
    Join Date
    Aug 2017
    Posts
    306
    @All - Worked on several example sketches today. piptest.ino, scroll.ino and MemoryTransfer.ino. These are working now. MemoryTransfer.ino was just a problem with setup(). Had to do with Serial initialization.
    Here is the changes I made for my display:
    Code:
    void setup() {
      unsigned long startTime, endTime, end2Time;
    //  Serial.begin(9600);
      while (!Serial && millis() < 1500) {} //wait for Serial Monitor
      Serial.println("LCD Memory Transfer test starting!");
      Serial.print("Compiled ");
      Serial.print(__DATE__);
      Serial.print(" at ");
      Serial.println(__TIME__);
      Serial.print("SPI transfer speed ");
    //  Serial.print((float)tft.SPIspeed / 1000000, 1);
      Serial.print((float)SPIspeed / 1000000, 1);
      Serial.print("MHz");
      Serial.println("\n");
    
      //I'm guessing most copies of this display are using external PWM
      //backlight control instead of the internal RA8876 PWM.
      //Connect a Teensy pin to pin 14 on the display.
      //Can use analogWrite() but I suggest you increase the PWM frequency first so it doesn't sing.
      pinMode(BACKLITE, OUTPUT);
    //  analogWriteFrequency(BACKLITE, 1000000);
      digitalWrite(BACKLITE, HIGH);
    //  analogWrite(BACKLITE, 256);
    
      bool result = tft.begin();
    Worked as expected.

    piptest.ino:
    Code:
    // piptest.ino
    // This example demonstrates some of the different capabilities
    // of the RA8876. Formost, the two available PIP windows. PIP
    // window 1 will always be on top of PIP window 2. It uses the
    // setTMargins() function to create a window with a border that
    // has adjustable thickness and cycle the colors of that border.
    // It will repeatedly print the internal character set scrolling
    // the window up as it prints. The window is basically a terminal
    // window processing most ASCII control codes.
    // There is a built in status line at the bottom of the screen that
    // is 16 pixels in height with functions to support it.
    // guages.ino
    #include "Arduino.h"
    //#include "Ra8876_Lite.h"
    #include "RA8876_t3.h"
    
    //#include "vt100.h"
    #include <math.h>
    
    #define RA8876_CS 10
    #define RA8876_RESET 8
    #define BACKLITE 7 //External backlight control connected to this Arduino pin
    RA8876_t3 tft = RA8876_t3(RA8876_CS, RA8876_RESET); //Using standard SPI pins
    
    // Array of RA8876 Basic Colors
    PROGMEM uint16_t myColors[] = {
    	0x0000,
    	0xffff,
    	0xf800,
    	0xfc10,
    	0x8000,
    	0x07e0,
    	0x87f0,
    	0x0400,
    	0x001f,
    	0x051f,
    	0x841f,
    	0x0010,
    	0xffe0,
    	0xfff0,
    	0x8400,
    	0x07ff,
    	0x87ff,
    	0x0410,
    	0xf81f,
    	0xfc1f,
    	0x8010,
    	0xA145
    };
    
    uint8_t onOff = 1; // Enable PIP
    uint8_t pipNo = 1; // PIP number 1
    uint16_t xp = 0;   // x coord. (source), for PIP
    uint16_t yp = 0;   // y coord. (source), for PIP
    uint16_t xd = 0;   // x coord. of displayed PIP window
    uint16_t yd = 40;  // y coord. of displayed PIP window
    uint16_t xw = 320; // x width of displayed window
    uint16_t yh = 240; // y height of displayed window
    const PROGMEM char *title ="PIP+ DEMO\n";
    const PROGMEM char *pip1 ="PIP WINDOW #1";
    const PROGMEM char *pip2 ="PIP WINDOW #2";
    uint8_t len = 0;
    uint8_t c = 32;
    
    int pipDelay = 0; // delayMicroseconds(pipDelay) Set to 0 for as fast as it gets
    		    // or tone it down?
    uint16_t thickness = 10; // drawRect() line thickness (Brush Size)
    uint16_t x = 0;
    uint16_t y = 0;
    uint16_t w = 0;
    uint16_t h = 0;
    uint8_t fw = 0;
    uint8_t fh = 0;
    
    // Draw a border for the text window
    void drawBorder(void) {
    	uint64_t color = 0;
    	fw = tft.getFontWidth();
    	fh = tft.getFontHeight();
    	x = (10*fw)-thickness;
    	y = (2*fh)-thickness;
    	w = tft.width()-(20*fw) + 2*thickness;
    	h = tft.height()-(4*fh) + 2*thickness;
    	color = random(0,65535) | 0x5555;
    	for(int i = 1; i <= thickness; i++) {
    		tft.drawRect(x, y, w, h, color);
    		x+=1;
    		y+=1;
    		w-=2;
    		h-=2;
    	}
    }
    
    // Put it all together
    void setup() {
      //I'm guessing most copies of this display are using external PWM
      //backlight control instead of the internal RA8876 PWM.
      //Connect a Teensy pin to pin 14 on the display.
      //Can use analogWrite() but I suggest you increase the PWM frequency first so it doesn't sing.
      pinMode(BACKLITE, OUTPUT);
      digitalWrite(BACKLITE, HIGH);
      
      tft.begin();
    	//initVT100();
    	tft.setFontSize(2,false);
    	tft.setCursor(0,0);
    	tft.fillScreen(myColors[11]);
    	len = strlen(title);
    	tft.setTextColor(myColors[6],myColors[11]);
    	tft.setCursor((tft.width()/2) - (len/2)*tft.getFontWidth(),0);
    	tft.println(title);
    	tft.setTextColor(myColors[1],myColors[11]);
    	tft.setFontSize(1,true);
    	tft.setTMargins(10, 2, 10, 2); //Setup a text window
    	
    	// Setup PIP window #1 on screen page #4
    	tft.setTextColor(myColors[1],myColors[11]);
    	tft.selectScreen(SCREEN_4); // Select screen page 4
    	tft.fillScreen(myColors[13]);
    	tft.setFontSize(1,true); // Set 12x24 font size
    	tft.setCursor(0,0);
    	tft.setTextColor(myColors[0],myColors[13]);
    	tft.println(pip1);
    	tft.fillCircle(xw / 2, yh / 2, 100, myColors[2]);
    
    	// Setup PIP window #2 on screen page #5
    	tft.setTextColor(myColors[1],myColors[11]);
    	tft.selectScreen(SCREEN_5); // Select screen page 5
    	tft.fillScreen(myColors[6]);
    	tft.setFontSize(2,true); // Set 16x32 font size
    	tft.setCursor(0,0);
    	tft.setTextColor(myColors[0],myColors[6]);
    	tft.println(pip2);
    	tft.fillRect(xw - 300, yh - 200 , 100, 100, myColors[15]);
    	// Set screen page #1 as the active screen page
    	tft.selectScreen(SCREEN_1); // Select home page
    }
    
    void loop() {
    	char STR1[256];
    	uint32_t start = millis();
    	uint32_t finished = 0;
    	onOff = 1; // Enable PIP's
    
    	pipNo = 1; // Select and enable PIP #1
    	tft.PIP(onOff,pipNo,SCREEN_4,xp,yp,tft.width(),xd,yd,xw,yh);
    	pipNo = 2; //Select and enable PIP #2
    	tft.PIP(onOff,pipNo,SCREEN_5,xp,yp,tft.width(),xd+700,yd+215,xw,yh);
    	pipNo = 1; // Select and move PIP #1
    	drawBorder();
    	for(int i=0; i <= 700; i++) {
    		tft.PIP(onOff,pipNo,SCREEN_4,xp,yp,tft.width(),xd+i,yd,xw,yh);
    		delayMicroseconds(pipDelay);
    		tft.setTextColor(myColors[i % 22],myColors[11]);
    		tft.write(c); // Print character set in text window
    		c++;
    		if(c == 255)
    			c = 32;
    	}
    	drawBorder();
    	pipNo = 2; // Select and move PIP #2
    	for(int i=700; i >= 0; i--) {
    		tft.PIP(onOff,pipNo,SCREEN_5,xp,yp,tft.width(),xd+i,yd+215,xw,yh);
    		delayMicroseconds(pipDelay);
    		tft.setTextColor(myColors[i % 22],myColors[11]);
    		tft.print(c); // Print character set in text window
    		c++;
    		if(c == 255)
    			c = 32;
    	}
    	finished = millis()-start;
    	// Print some stats to the status line
    	sprintf(STR1,"pipDelay: %lu uS, Loop Cycle Time: %lu ms, Use pipDelay=0 for fastest Loop time.",(unsigned long)pipDelay, (unsigned long)finished);
    	tft.printStatusLine(0,myColors[13],myColors[11],STR1);
    }
    Working.

    scroll.ino:
    Code:
    // scroll.ino
    // Simple example of Scrolling text down and up
    // on the RA8876. The method used is kind of slow
    // and needs to be optimized.
    #include "Arduino.h"
    #include "RA8876_t3.h"
    #include "font8x16.h"
    
    //#include "vt100.h"
    //#include <math.h>
    
    #define RA8876_CS 10
    #define RA8876_RESET 8
    #define BACKLITE 7 //External backlight control connected to this Arduino pin
    RA8876_t3 tft = RA8876_t3(RA8876_CS, RA8876_RESET); //Using standard SPI pins
    
    
    // Array of RA8876 Basic Colors
    PROGMEM uint16_t myColors[] = {
    	0x0000,
    	0xffff,
    	0xf800,
    	0xfc10,
    	0x8000,
    	0x07e0,
    	0x87f0,
    	0x0400,
    	0x001f,
    	0x051f,
    	0x841f,
    	0x0010,
    	0xffe0,
    	0xfff0,
    	0x8400,
    	0x07ff,
    	0x87ff,
    	0x0410,
    	0xf81f,
    	0xfc1f,
    	0x8010,
    	0xA145
    };
    
    int i = 0, j = 0;
    int color = 1;
    void setup() {
     //I'm guessing most copies of this display are using external PWM
      //backlight control instead of the internal RA8876 PWM.
      //Connect a Teensy pin to pin 14 on the display.
      //Can use analogWrite() but I suggest you increase the PWM frequency first so it doesn't sing.
      pinMode(BACKLITE, OUTPUT);
      digitalWrite(BACKLITE, HIGH);
      
      tft.begin();
      tft.fontLoadMEM((char *)font8x16);
      tft.fillScreen(myColors[11]);
      tft.fillStatusLine(myColors[11]);
      tft.setFontSize(1,false);
      tft.setTMargins(0, 0, 0, 1); //so scroll doesn't erase the status bar
      tft.setCursor(0,0);
      tft.printStatusLine(0,myColors[13],myColors[11],"scroll_down(), scroll_up()");
    }
    
    void loop() {
    	tft.setFontSource(0);
    	tft.setFontSize(1,true);
    	tft.setCursor(0,0);
    	for(i = 32; i < 256; i++) {
    		if(color == 22) color = 1;
    		tft.setTextColor(myColors[color++] , myColors[11]);
    		tft.write(i);
    	}
    	tft.setTextColor(myColors[1] , myColors[11]);
    	while(j++ < 10) {
    		for(i = 0; i < 21; i++) {
    			tft.scrollDown();
    		}
    		for(i = 0; i < 21; i++) {
    			tft.scrollUp();
    		}
    	}
    	j = 0;
    	delay(2000);
    }
    Working.

    You guy's have zoomed ahead of me with this library
    I have a lot of catching up to do and I can see that there are a ton of things I need to learn about and try to understand. There are text functions that might be better served moved into a separate terminal class. Not sure if user defined fonts are really needed with all of the font work put into this library.

    Just thinking out loud.

    Have a safe 4th.

  13. #263
    Hi guys, just thought i would update and share the changes so hopefully it may help someone else with this display


    Thanks to mjs513's tip i gave his suggestion a try and it works

    As before i init the SSD2828 chip as i said above in the previous post.


    Click image for larger version. 

Name:	20200705_170625.jpg 
Views:	14 
Size:	170.6 KB 
ID:	20865

    So in case anyone else needs these are where ive made changes

    in RA8876_t3.cpp

    Code:
    	
    int16_t HDW = 400; //1024;
    int16_t VDH = 1280; //600;

    in RA8876Registers

    Code:
    #define XPCLK_INV  0 //1 // 0:no inversion, 1:inversion 
    #define HPW       24 // 70   //
    Code:
    #define VPW       2 // 10
    #define VND       10 //23
    Code:
    #define PAGE2_START_ADDR  400*1280*2 //1024*600*2   // 1228800 bytes
    #define PAGE3_START_ADDR  400*1280*2*2 //1024*600*2*2 // 2457600 
    #define PAGE4_START_ADDR  400*1280*2*3 //1024*600*2*3
    #define PAGE5_START_ADDR  400*1280*2*4 //1024*600*2*4
    #define PAGE6_START_ADDR  400*1280*2*5 //1024*600*2*5
    #define PAGE7_START_ADDR  400*1280*2*6 //1024*600*2*6
    #define PAGE8_START_ADDR  400*1280*2*7 //1024*600*2*7
    #define PAGE9_START_ADDR  400*1280*2*8 //1024*600*2*8
    #define PAGE10_START_ADDR  400*1280*2*9 //1024*600*2*9
    
    #define PATTERN1_RAM_START_ADDR 400*1280*2*10 //1024*600*2*10
    #define PATTERN2_RAM_START_ADDR (400*1280*2*10)+(16*16*2) //(1024*600*2*10)+(16*16*2)
    #define PATTERN3_RAM_START_ADDR (400*1280*2*10)+(16*16*2)+(16*16*2) //(1024*600*2*10)+(16*16*2)+(16*16*2)
    
    /*DMA picture data start address*/
    #define WP1_ADDR  0
    #define WP2_ADDR  400*1280*2 //1024*600*2
    #define WP3_ADDR  400*1280*2*2 //1024*600*2*2
    #define WP4_ADDR  400*1280*2*3 //1024*600*2*3
    #define WP5_ADDR  400*1280*2*4 //1024*600*2*4
    #define WP6_ADDR  400*1280*2*5 //1024*600*2*5
    Code:
    #define SCREEN_2  400*1280*2 //1024*600*2
    #define SCREEN_3  400*1280*2*2 //1024*600*2*2
    #define SCREEN_4  400*1280*2*3 //1024*600*2*3
    #define SCREEN_5  400*1280*2*4 //1024*600*2*4
    #define SCREEN_6  400*1280*2*5 //1024*600*2*5
    #define SCREEN_7  400*1280*2*6 //1024*600*2*6
    #define SCREEN_8  400*1280*2*7 //1024*600*2*7
    #define SCREEN_9  400*1280*2*8 //1024*600*2*8
    //#define SCREEN_10  400*1280*2*9 // Used for CGRAM at this time //1024*600*2*9 // Used for CGRAM at this time

    Im sometimes getting a few artefacts where the test on the display seems to shift one pixel left and right, or the display doesn't initialise right and its just like a colourful smudge across the display.
    Click image for larger version. 

Name:	20200705_184321.jpg 
Views:	10 
Size:	220.7 KB 
ID:	20866
    Im putting that down to it being on a breadboard with SPI wires almost 30cm long , ive set the tft.begin(18000000) but it doesn't make alot of difference. I think ill try shorter wires, and then look to do Paul S's fix for the RA8875 spi issue on this and see if i can make the RA8876 and SSD2828 share the same buss.

    Thanks again for all your help

    Trev

  14. #264
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,556
    @gotty101 - glad you got it working - looks good in the photos.

  15. #265
    Hi Guys, just thought I would update you on the slight issue I was having in the photo posted above. Basically the image was distorting and sometimes the screen would not initialise right. After messing with the timing things (should not have bothered) I tried my other spare display (same model ect) and it was perfect. What ive found out there is a small ffc cable and when touched it got rid of the issues. So I changed it today and all is good. The one that came with the display had a sharp bend in and i wonder if that's damaged it. Just thought it may help if someone else has the same issue.

  16. #266
    Senior Member blackketter's Avatar
    Join Date
    May 2015
    Location
    San Francisco
    Posts
    289
    Thanks for the excellent work on this library all! I've gotten an ER-TFTM0784 working well here and am impressed by the speed and quality of the software and hardware combo. Really digging the widescreen!

    I'd like to work on a patch that would allow either display resolution to be built into the driver. Does anybody have any issue or suggestions for how to proceed without stepping on the work of the rest of you all?

  17. #267
    Senior Member blackketter's Avatar
    Join Date
    May 2015
    Location
    San Francisco
    Posts
    289
    While I'm working on support for the ER-TFTM0784 can somebody summarize for me which examples should be working? I'd like to test as much as I can...

  18. #268
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,556
    Quote Originally Posted by blackketter View Post
    While I'm working on support for the ER-TFTM0784 can somebody summarize for me which examples should be working? I'd like to test as much as I can...
    Ok taxing my memory - really have to get back to this once of these days. Know that the following work:
    1. gauges
    2. graphics
    3. ILI_ADA_fonttest4
    4. ILI_GFX_fonttest
    5. think memorytransfer should work without rotation
    6. rotate
    7. piptest
    8. dont remember about scroll after all the changes we made for screen rotation
    9. don't think remaining sketches were ever tested with the new lib.

  19. #269
    Member MorganS's Avatar
    Join Date
    Apr 2015
    Location
    Northern Nevada
    Posts
    63
    Quote Originally Posted by blackketter View Post
    I'd like to work on a patch that would allow either display resolution to be built into the driver. Does anybody have any issue or suggestions for how to proceed without stepping on the work of the rest of you all?
    For me the gold standard is Sumotoy's RA8875 library. A fork of that is included in the standard Teensy distribution so you should probably already have it.

    Look at how the .begin() method takes a parameter which sets up the screen resolution and a few other parameters which change between different screens.

  20. #270
    Senior Member
    Join Date
    Aug 2017
    Posts
    306
    Quote Originally Posted by mjs513 View Post
    Ok taxing my memory - really have to get back to this once of these days. Know that the following work:
    1. gauges
    2. graphics
    3. ILI_ADA_fonttest4
    4. ILI_GFX_fonttest
    5. think memorytransfer should work without rotation
    6. rotate
    7. piptest
    8. dont remember about scroll after all the changes we made for screen rotation
    9. don't think remaining sketches were ever tested with the new lib.
    @mjs513 - I have other than the VT100 sketch working + others on my setup. Can't test the touch screen because mine is not cap touch. I had to make a few changes to make all of the sketches work and will push the changes to github.

    @MorganS - I agree, Sumotoy's library is a good reference. It would be nice if there was some way to detect which display is being used and setup the driver for that display. Kinda like Plug N' Play. Don't know of there is any unique identifiers available for each type of display. Have not really checked that out.

  21. #271
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,556
    @wwatson
    Can you post you post your examples to your RA8876 library so we can keep things updated?

  22. #272
    Senior Member
    Join Date
    Aug 2017
    Posts
    306
    Quote Originally Posted by mjs513 View Post
    @wwatson
    Can you post you post your examples to your RA8876 library so we can keep things updated?
    I have updated my GitHub repository. Hope it works with your displays.

    Headed for work now

  23. #273
    Member MorganS's Avatar
    Join Date
    Apr 2015
    Location
    Northern Nevada
    Posts
    63
    Quote Originally Posted by wwatson View Post
    @MorganS - I agree, Sumotoy's library is a good reference. It would be nice if there was some way to detect which display is being used and setup the driver for that display. Kinda like Plug N' Play. Don't know of there is any unique identifiers available for each type of display. Have not really checked that out.
    It comes down to details like the frequency that the display requires. The RA8875/6 is almost infinitely programmable to work with a wide range of displays and the only way of detecting if the parameters are right for the display is for a human to look at it. In fact, I think there is no data at all which can pass from the LCD to the driver chip. It's a one-way interface. (Touchscreen is a separate interface and has nothing to do with the LCD layer.)

    Even on the other side of the RA8875/6, I don't think there's any way of it telling the Teensy "I'm the chip that you soldered onto the 800x480 carrier board." The registers which hold the display resolution and other parameters don't survive when the power is turned off.

  24. #274
    Senior Member blackketter's Avatar
    Join Date
    May 2015
    Location
    San Francisco
    Posts
    289
    I've submitted a patch to get started on the ER-TFT074 support. It's here: https://github.com/wwatson4506/Ra8876LiteTeensy/pull/5

    Comment:

    Here's a patch for adding support for the ER-TFT0784, including configuration of the SSD2828 MIPI bridge. It's in its own header with its own class. I couldn't find any other displays that wouldn't be covered by either the ER-TFT0784_t3 or RA8876_t3 classes.

    This required factoring out hard constants for screen dimensions. The only API change is for selectScreen() to take a screen number rather than address pointer. There are also added methods for calculating display RAM addresses, which may be needed instead of the hard constants for PAGEn_START_ADDR, PATTERNn_RAM_START_ADDR and WPn_ADDR.

    The only example I've updated here is graphics.ino. Will do the others once we're good with the changes.

    Please give me lots of feedback!

    p.s. Arial wasn't in the library, but comic sans was, so I changed to that.

  25. #275
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,556
    @blackketter
    Just quick question - have you tested this with any other RA8876 displays besides the ER-TFT074?

    Also, don't think the default examples should be set up for the ER-TFT074 as most people will probably have the non-ER-TFT074 displays. But more on that later.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •