Recommendations for 10" TFT Display with touchscreen for Teensy 4.1

WWatson... Sorry missed that info. I have added it to my library and now get no issue during compile. Thanks for the help
No worries. I failed to put the need for installing the ILI9341_fonts library in when I was creating the docs :)
 
Hey @wwatson,
i'm learning with the RA8876, trying to test "tft.graphicMode();" false or true,
but it doesn't block when i write tft.fillRect(),and the graphic sketch works the same
even if i put to false ,so what is it exactly for ?
And "while (!Serial && millis() < 1000) {} " is it an obligation?
 
i'm learning with the RA8876, trying to test "tft.graphicMode();" false or true,
but it doesn't block when i write tft.fillRect(),and the graphic sketch works the same
even if i put to false ,so what is it exactly for ?

Most of the time this is used internally by the RA8876 driver and is not really meant for normal usage by the user. It is NOT blocking. If you look at the "fillRect()" code:
Code:
// Draw a filled rectangle. Note: damages text color register
void RA8876_common::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) {
    x += _originx;
    y += _originy;
    int16_t x_end = x + w - 1;
    int16_t y_end = y + h - 1;
    if ((x >= _displayclipx2) ||    // Clip right
        (y >= _displayclipy2) ||    // Clip bottom
        (x_end < _displayclipx1) || // Clip left
        (y_end < _displayclipy1))   // Clip top
    {
        // outside the clip rectangle
        return;
    }
    if (x < _displayclipx1)
        x = _displayclipx1;
    if (y < _displayclipy1)
        y = _displayclipy1;
    if (x_end > _displayclipx2)
        x_end = _displayclipx2;
    if (y_end > _displayclipy2)
        y_end = _displayclipy2;

    check2dBusy();
    graphicMode(true);       <------------------------ Switched to graphics mode ------------------------
    foreGroundColor16bpp(color);
    switch (_rotation) {
    case 1:
        swapvals(x, y);
        swapvals(x_end, y_end);
        break;
    case 2:
        x = _width - x;
        x_end = _width - x_end;
        ;
        break;
    case 3:
        rotateCCXY(x, y);
        rotateCCXY(x_end, y_end);
        break;
    }

    lcdRegDataWrite(RA8876_DLHSR0, x, false);                    // 68h
    lcdRegDataWrite(RA8876_DLHSR1, x >> 8, false);               // 69h
    lcdRegDataWrite(RA8876_DLVSR0, y, false);                    // 6ah
    lcdRegDataWrite(RA8876_DLVSR1, y >> 8, false);               // 6bh
    lcdRegDataWrite(RA8876_DLHER0, x_end, false);                // 6ch
    lcdRegDataWrite(RA8876_DLHER1, x_end >> 8, false);           // 6dh
    lcdRegDataWrite(RA8876_DLVER0, y_end, false);                // 6eh
    lcdRegDataWrite(RA8876_DLVER1, y_end >> 8, false);           // 6fh
    lcdRegDataWrite(RA8876_DCR1, RA8876_DRAW_SQUARE_FILL, true); // 76h,0xE0
}
In most cases text and graphics can be mixed on the same screen. "tft.graphicsMode()" is meant more for low level driver usage.
I think you need to download the user manual for RA8876 found here:
https://www.buydisplay.com/download/ic/RA8876.pdf

And "while (!Serial && millis() < 1000) {} " is it an obligation?
This waits for the PC your Teensy is connected to to being ready for serial communication up to a 1 second timeout. For more detailed information search the forum;)
 
Ok,thanks for infos,i was thinking "while (!Serial && millis() < 1000) {} " was necessary for the display to finish his setup,
so i don't need that.
For the "tft.graphicsMode()",i was hoping for a wiki,may be from your RA8876 library unless adafruit gfx?

EDIT:the colors you gave here,the 65k colors have the same definition as the others:

COLOR65K_RED 0xf800
RED 0xf800

Are they exactly the same?
 
Ok,thanks for infos,i was thinking "while (!Serial && millis() < 1000) {} " was necessary for the display to finish his setup,
so i don't need that.
For the "tft.graphicsMode()",i was hoping for a wiki,may be from your RA8876 library unless adafruit gfx?

EDIT:the colors you gave here,the 65k colors have the same definition as the others:

COLOR65K_RED 0xf800
RED 0xf800

Are they exactly the same?
Yes the colors are the same "0xf800". No wiki is planned at this time. Maybe later:) The library tries to follow other graphic libraries but there are certain things that are RA8876 based. This library is an expanded version of the original RA8876_lite library from RAIO. You can find the original users manual here:
https://www.raio.com.tw/data_raio/RA887677/Arduino/RA8876_Lite_UserGuide_v1.0_Eng.pdf.
 
Very interesting to read,do you think i can plug my buy display 10" RA8876 directly with an arduino due safely?
 
Because in the pdf they are talking about arduino due wich have a 20 pins connector and is strong enough to handle
such a display
 
Because in the pdf they are talking about arduino due wich have a 20 pins connector and is strong enough to handle
such a display
You don't have to use the Due to try the the examples. Use the Teensy. I think it's best if you stick with the examples in my library and try to understand how they work :)
 
Of course i know your examples are for teensy,but they are also arduino examples,that's what i was pointed to.
Do you know what are the relations between touch points and coordonnates to make a touch paint
in rotation(2), that fit X & Y on the same circle,i'm a little bit lost because the paint examples are for rotation(0)?
 
Of course i know your examples are for teensy,but they are also arduino examples,that's what i was pointed to.
Do you know what are the relations between touch points and coordonnates to make a touch paint
in rotation(2), that fit X & Y on the same circle,i'm a little bit lost because the paint examples are for rotation(0)?
You will not be able to use the Teensy library on the Arduino Due.
 
You don't have to use the Due to try the the examples. Use the Teensy. I think it's best if you stick with the examples in my library and try to understand how they work :)
WWatson and MJS513 are correct stick with the Teensy. I bought one of the 10" Buydisplay with the DUE and the shield and one set up for parallel interface. using the DUE and shield only one of the RA8876 lite sketches would compile with Arduino IDE 2. I had to load the older 1.8 IDE and only a couple more would compile, the rest would not. You will also quickly run out of memory. Most of the sketches that would compile were using about 60 - 70% of the memory. Not a lot of room to do other things. The Due shields Buydisplay are selling use the SPI communication and not parallel. As I said already the code has not been kept up to date... Stick with the Teensy, Only way to go. The DUE sits on the shelf till I get ready to use a second display. I'll strip off the DUE and use a Teensy4.1.
 
@DJETH
It's good to have an experience return from others users,i forgot that my arduino connector due was for parrallel display,and my 10" display
is a 4 wires spi,i've been using due with a SSD1963 parrallel and i'm sure,as all you're intended to say,it's limited for memory.
It was only a question of curiosity,i also have a due that stay on my shelf with some arduino mega that i also used with SSD1963 parrallel
but unless some graphic examples,there is not enough room for anything else.
Of course, i stay with teensy,the teensy 4.1 can permit you to do a lot of things at the same time,and most of the best is that
teensy is a community of knowledge with people searching and sharing :)
 
So great with all help and information in this thread! I cant wait to start a small hobby project with the 10" touch pad and see how responsive it is in parallel mode with the Teensy 4.1 board. :)
 
I stay on this thread concerning the RA8876,but with another direction,
i wish to print the result of a midi sysex message on the screen,like the monitor shows:
Code:
SysEx Message: F0 7F 7F 04 01 00 04 F7 (end)
but the way tft.print.() with printBytes(data, length) seems not accepted,here is the function:
Code:
void mySystemExclusiveChunk(const byte *data, uint16_t length, bool last) {
  Serial.print("SysEx Message: ");
  printBytes(data, length);

      tft.setTextColor(WHITE);     
      tft.setFontSize(1,true);
      tft.setFont(CourierNew_20);     

      tft.setCursor(0, 135);tft.print("SysEx Message:");     
      tft.setCursor(0, 165);tft.print(???);     

 
  if (last) {
    Serial.println(" (end)");
  } else {
    Serial.println(" (to be continued)");
  }
}

Maybe somebody's using midi messages and TFT knows the way to do that :unsure:
 
I think the following bit of code is incorrect

Code:
tft.print(???);

I susepct it needs to loop through the data, converting the data bytes to a hex string, append that to result string and then display the result string.

What have you tried?
 
Hi,@Turby
I tried and succes to print data -> 240 and length -> 8,but this doesn't help me,
of course
Code:
tft.print(???);
is a kind of joke,a fake.
But do you mean i can do:
Code:
tft.print(data,HEX);
could be the trick?
 
I stay on this thread concerning the RA8876,but with another direction,
i wish to print the result of a midi sysex message on the screen,like the monitor shows:
Code:
SysEx Message: F0 7F 7F 04 01 00 04 F7 (end)
but the way tft.print.() with printBytes(data, length) seems not accepted,here is the function:
Code:
void mySystemExclusiveChunk(const byte *data, uint16_t length, bool last) {
  Serial.print("SysEx Message: ");
  printBytes(data, length);

      tft.setTextColor(WHITE);    
      tft.setFontSize(1,true);
      tft.setFont(CourierNew_20);    

      tft.setCursor(0, 135);tft.print("SysEx Message:");    
      tft.setCursor(0, 165);tft.print(???);    

 
  if (last) {
    Serial.println(" (end)");
  } else {
    Serial.println(" (to be continued)");
  }
}

Maybe somebody's using midi messages and TFT knows the way to do that :unsure:
The printByte() function is not part of the RA8876 library but here is a test sketch that shows one way of implementing it in your sketch:

Code:
// testing.ino
#include <font_CourierNew.h>
#include "RA8876_Config_8080.h"
#include <RA8876_t41_p.h>

// RA8876_8080_DC, RA8876_8080_CS and RA8876_8080_RESET are defined in
// src/RA8876_Config_8080.h.
RA8876_t41_p tft = RA8876_t41_p(RA8876_8080_DC,RA8876_8080_CS,RA8876_8080_RESET);

//**************************************************************************
// *************    Simple printByte() function.   ************************
//**************************************************************************
void printBytes(uint8_t *data, uint16_t length) {
  for(int i = 0; i < length; i++) {
    tft.print(data[i] < 16 ? "0" : "");
    tft.print(data[i], HEX);
    tft.print(" ");
  }
//    tft.println();
}
//**************************************************************************

void setup() {
//**************************************************************************
// For Testing printByte() we will setup data and length.
//**************************************************************************
uint8_t data[] = { 0xF0, 0x7F, 0x7F, 0x04, 0x01, 0x00, 0x04, 0xF7}; // An array
uint16_t length = sizeof(data); // Get number of elements in the array.
//**************************************************************************

  while (!Serial && millis() < 3000) {} //wait for Serial Monitor
  Serial.printf("%c RA8876 printByte() Example\n\n",12);

 
  // Set 8/16bit bus mode. Default is 8bit bus mode.
  tft.setBusWidth(RA8876_8080_BUS_WIDTH); // RA8876_8080_BUS_WIDTH is defined in
                                          // src/RA8876_Config_8080.h.
  tft.begin(BUS_SPEED); // RA8876_8080_BUS_WIDTH is defined in
                        // src/RA8876_Config_8080.h. Default is 20MHz.

  Serial.print("Bus speed: ");
  Serial.print(BUS_SPEED,DEC);
  Serial.println(" MHZ");
  Serial.print("Bus Width: ");
  Serial.print(tft.getBusWidth(),DEC);
  Serial.println("-bits");

//**************************************************************************
  tft.setTextColor(WHITE);     
  tft.setFontSize(1,true);
  tft.setFont(CourierNew_20);     
  tft.setCursor(0, 135);tft.print("SysEx Message: ");     
  printBytes(data, length); // Call printByte() functio.
  tft.println("(end)");
//**************************************************************************

}

void loop() {
  waitforInput(); // Wait for input from serial cconsole.

}

void waitforInput()
{
  Serial.println("Press anykey to continue");
  while (Serial.read() == -1) ;
  while (Serial.read() != -1) ;
}

Result should look like this:
Test_printByte_function.jpg


Good luck ;)
 
@wwatson,
Thank you for the arrangement,it's amazing,but what can i do if i want to see also the result in the serial monitor,
because your printByte fonction override the original from the midi library,with gives a serial monitor result?
 
I forgot to show my adaptation,because my RA8876 is 4 wires SPI:

Code:
#include <USBHost_t36.h>
USBHost myusb;
USBHub hub1(myusb);
USBHub hub2(myusb);
MIDIDevice midi1(myusb);
#include <font_CourierNew.h>
#include "Arduino.h"
#include "RA8876_Config_SPI.h"
#include <RA8876_t3.h>
#include <SPI.h>
#include <math.h>

RA8876_t3 tft = RA8876_t3(RA8876_CS, RA8876_RESET); //Using standard SPI pins//CS=30 & RST = 28


void printBytes(const byte *data, uint16_t length) {
  for(int i = 0; i < length; i++) {
    tft.print(data[i] < 16 ? "0" : "");
    tft.print(data[i], HEX);
    tft.print(" ");
  }
//    tft.println();
}
//**************************************************************************

void setup() {
  Serial.begin(115000);
//**************************************************************************



  while (!Serial && millis() < 3000) {} //wait for Serial Monitor
  Serial.printf("%c RA8876 printByte() Example\n\n",12);

 
  #if defined(USE_SPI_47000000)
  tft.begin(47000000); // Max is 47000000 MHz (using short 3" wires)
#else
  tft.begin(); // default SPI clock speed is 30000000 MHz
#endif

  tft.setRotation(2);
  tft.graphicMode(true);
 
  tft.fillScreen(BLACK);  
  tft.setFontSize(1, true);//toujours -> true pour eviter le BLUE d'origine!!

/*
//**************************************************************************
  tft.setTextColor(WHITE);    
  tft.setFontSize(1,true);
  tft.setFont(CourierNew_20);    
  tft.setCursor(0, 135);tft.print("SysEx Message: ");    
  printBytes(data, length); // Call printByte() functio.
  tft.println("(end)");
//**************************************************************************
*/
myusb.begin();

 
  midi1.setHandleSystemExclusive(mySystemExclusiveChunk);
 

}

void loop() {
  // The handler functions are called when midi1 reads data.  They
  // will not be called automatically.  You must call midi1.read()
  // regularly from loop() for midi1 to actually read incoming
  // data and run the handler functions as messages arrive.
  myusb.Task();
  midi1.read();
 

}

void mySystemExclusiveChunk(const byte *data, uint16_t length, bool last) {
  //uint16_t length = sizeof(data);
  Serial.print("SysEx Message: ");
  tft.fillRect(0,165,500,20,BLACK);
 
    //**************************************************************************
  tft.setTextColor(WHITE);    
  tft.setFontSize(1,true);
  tft.setFont(CourierNew_20);    
  tft.setCursor(0, 135);tft.print("SysEx Message: ");
  tft.setCursor(0, 165);    
  printBytes(data, length); // Call printByte() function.
  tft.println("(end)");
//**************************************************************************
 
  if (last) {
    Serial.println(" (end)");
  } else {
    Serial.println(" (to be continued)");
  }
}
 
@wwatson,
Thank you for the arrangement,it's amazing,but what can i do if i want to see also the result in the serial monitor,
because your printByte fonction override the original from the midi library,with gives a serial monitor result?
How about renaming the new function? Do you know how to do that?
 
Is there's a way to speed up the touch process with goodix and RA8876?
I have nearly 300ms after i touched a tft button and slower my midi machine control.
 
Last edited:
Is there's a way to speed up the touch process with goodix and RA8876?
I have nearly 300ms after i touched a tft button and slower my midi machine control.
Not that I know of. But I do know that it does NOT take 300ms to get a response from the goodix controller.You have not provided enough information about what you are doing with the touch after it is received...
 
Back
Top