5" RA8875 Display not working w/ Teensy 4.1

Emans

Member
Hi everyone, I'm sorry to bring this topic up once again, but even after reading every possible thread on the web about the subject, I still can't manage to make my display work.
The display itself is a EastRising (BuyDisplay) ER-TFT-050-6, 5V, 40pin Header, no Touchscreen version, with ER3304-1 font chip.
The library I'm using is the RA8875_t4 branch from mjs513's GitHub (that I believe is forked from sumotoy's one?). and the code compiled with Arduino IDE 2.3.2 (latest) paired with Teensyduino 1.59.
The only electrical connection are the SPI ones written in the code (apart from power lines: 5V and ground, both Teensy and display are connected to an external 9V to 5V breadboard shield), namely:
Teensy 4.1 | LCD
Pin 10 (CS0) --------- Pin 5
Pin 11 (MOSI0) --- Pin 6
Pin 13 (SCK0) ------ Pin 8

(will attach the display datasheet)
I tried some examples, but only the Benchmark works, then I tried to write the simplest code I could, here's what I came up with:

C++:
#include <SPI.h>
#include <RA8875.h>

#define RA8875_CS 10
#define RA8875_MOSI 11
#define RA8875_SCK 13
#define RA8875_RST 255
RA8875 tft = RA8875(RA8875_CS, RA8875_RST, RA8875_MOSI, RA8875_SCK);
void setup() {
    tft.begin(RA8875_800x480);
    tft.drawLine(50, 50, 100, 50, RA8875_WHITE);
}
void loop(){
    
}
The symptoms of the screen are: absolutely no response, it stays and remains pitch black no matter what. I even tried the command tft.displayOn(true) to no avail. I can't even adjust the backlight (I suppose), on the jumpers it says that it's using the internal PWM but the line tft.brightness() or how it was spelled (going by memory on this) does nothing.
Everything seems just dead. Being the first time using this controller (and a Teensy) it's probably some stupid newbie mistake (I used to tinker with Arduino years ago, but forgot a lot about programming), but I would be happy to be at least able to confirm that it's cooked, if it is, so that I can send it back and stop wasting my time...
 

Attachments

  • ER-TFT050-6-4268_Datasheet.pdf
    1.4 MB · Views: 24
I tried some examples, but only the Benchmark works, then I tried to write the simplest code I could, here's what I came up with:
A little confuse - you said benchmark works but others dont. If benchmark works what pins do you use and second you should hook us RST (pin 36 on the display) and BL needs to be hooked to either 3.3v or a pin which you need to specify:
Code:
#define RA8875_INT 19//any pin
#define RA8875_CS  10//restriction for Teensy3 and CS
#define RA8875_RST 8//any pin
/*
Teensy 3.x can use: 2,6,9,10,15,20,21,22,23
*/

RA8875 tft = RA8875(RA8875_CS, RA8875_RST);

This assumes BL is hooked to 3.3v. And you dont need a int pin to get it to work.
 
A little confuse - you said benchmark works but others dont. If benchmark works what pins do you use and second you should hook us RST (pin 36 on the display) and BL needs to be hooked to either 3.3v or a pin which you need to specify:
It worked, but in quite a strange fashion... I loaded the benchmark code with the same pins I used in the block above, and I got results on the Serial Monitor. Then I decided to rip all the SPI connections, leaving them declared in the code, and I got other results that were in line with the previous ones (some units off in some cases, but everything else was consistent). I really have no idea what happened there. Also, isn't the pin 36 CTP_/RST referred to the touchscreen reset function?
This assumes BL is hooked to 3.3v. And you dont need a int pin to get it to work.
Alright, so I need to supply external positive voltage hooked up to BL_CONTROL (pin 14)? Isn't it a floating pin by default with internal PWM?
 
Alright, so I need to supply external positive voltage hooked up to BL_CONTROL (pin 14)? Isn't it a floating pin by default with internal PWM?

Sorry meant pin 11 for RST. As for BLC not that I am aware of. If you want to use PWM control you have to hook it up to a pin and do something like this:
Code:
pinMode(pin, OUTPUT);
digitalWrite(pin, HIGH);
backlight(true);

the RA8875 lib for the teensy is a modification of Sumotoys library - reading his wiki may help: https://github.com/sumotoy/RA8875/wiki
 
Sorry meant pin 11 for RST. As for BLC not that I am aware of. If you want to use PWM control you have to hook it up to a pin and do something like this:
No worries, I just tried with the pin connected, and added this line of code to make sure the pin stays in the HIGH state... (on the datasheet, RST pin11 is referred to as Active Low).
C++:
void setup(){
    pinMode(RA8875_RST, OUTPUT);
    digitalWrite(RA8875_RST, HIGH);
    //rest of the code
}

In the datasheet under Pin14 this is the description:
Backlight control signal input. When using the internal PWM signal this pin floating.
And according to the jumpers chart, if J15 is open and J16 short (verified on my display)
Select Backlight Control Signal with RA8875 'PWM’
About the wiki: I've spent the entirety of yesterday trying variations of the code using the guidelines written on that page, except for desoldering R1, R2 and R3, as I'm not confident enough in my SMT desoldering skills. Needless to say, it didn't work out for me.
 
@Emans:

Now that you have the RA8875_RST signal defined and initialized (& you have it connected), you might try using it to actually perform a RESET on the display to see if that has any positive benefit as such:

Code:
   pinMode(RA8875_RST, OUTPUT);
   digitalWrite(RA8875_RST, LOW);

   unsigned long check_time = millis();
   while ((millis() - check_time) <= 100);

   digitalWrite(RA8875_RST, HIGH);

Mark J Culross
KD5RXT

P.S. In my first-hand use of the TFTM070-5 (slightly different than yours, but still uses the RA8875 controller) as the display for the latest version of my TeensyMIDIPolySynth (TMPS) project, I have not had to load any external libraries . . . full RA8875-based display support is provided directly by the default libraries loaded with TD1.59. MJC
 
No worries, I just tried with the pin connected, and added this line of code to make sure the pin stays in the HIGH state... (on the datasheet, RST pin11 is referred to as Active Low).
Personally I just hook it up to 3.3v, found by accident that if you don't I just get a black screen .
 
@kd5rxt-mark
Thanks for the reply, now my code looks something like this, but I still have no output on it
Code:
#include <SPI.h>
#include <RA8875.h>

#define RA8875_CS 10
#define RA8875_MOSI 11
#define RA8875_SCK 13
#define RA8875_RST 9
RA8875 tft = RA8875(RA8875_CS, RA8875_RST, RA8875_MOSI, RA8875_SCK);
void setup() {
  pinMode(9, OUTPUT);
  tft.begin(RA8875_800x480);
  tft.drawLine(50, 50, 100, 50, RA8875_WHITE);
}

void loop() {
  digitalWrite(RA8875_RST, LOW);
  unsigned long check_time = millis();
  while ((millis() - check_time) <= 100);
  digitalWrite(RA8875_RST, HIGH);
}
About the library: I found that after I installed mjs's library, as information was quite scattered...
 
@Emans:

Sorry, I wasn't very clear at all. That RESET code should be in the setup() function (to be executed once) rather than the loop() function (which gets executed repeatedly) !!

Mark J Culross
KD5RXT
 
Sorry, I wasn't very clear at all. That RESET code should be in the setup() function (to be executed once) rather than the loop() function (which gets executed repeatedly) !!
I thought there was something strange about placing it in the loop section, didn't think it through lol
Line of code this far, including @mjs513 suggestion:
Code:
#include <SPI.h>
#include <RA8875.h>

#define RA8875_CS 10
#define RA8875_RST 8
RA8875 tft = RA8875(RA8875_CS, RA8875_RST);

void setup() {
  pinMode(RA8875_RST, OUTPUT);
  digitalWrite(RA8875_RST, LOW);
  unsigned long check_time = millis();
  while ((millis() - check_time) <= 100);
  digitalWrite(RA8875_RST, HIGH);
  tft.begin(RA8875_800x480);
  tft.drawLine(50, 50, 100, 50, RA8875_WHITE);
}

void loop() {

}
Unfortunately, still no luck and a blank black screen. Checked with my multimeter some values: there is regular 5V voltage on the display, and the Reset code works as intended (0V immediately after startup, then drives to 3.3V and keeps there). Checked the current on the display, and I got 3uA... my hypotesis is that the RA8875 fails to comunicate with the Teensy, but I don't understand why
 
You might want to take a picture of the back of your board and post it, showing the jumpers and the resistors...

1719946789527.png

For Example, my first one I ordered came wired as 3-wire serial not 4 wire.
Also check for backlight settings.

You said benchmark works, have you tried,
tft.begin(Adafruit_800x480);

Which it uses.

Note: I did/do have one of these that just did not work well. When playing with the RA8875 I have mostly later played with their 4.3" version.
But it has been a few years.

Have you tried passing in a lower speed for SPI?
In a picture view program I have:
Code:
#define TFT_RA8875_BEGIN_MODE RA8875_800x480
#define TFT_RA8875_BEGIN_COLORS_BPP 16
#define TFT_RA8875_BEGIN_SPI_SPEED 12000000


    tft.begin(TFT_RA8875_BEGIN_MODE, TFT_RA8875_BEGIN_COLORS_BPP, TFT_RA8875_BEGIN_SPI_SPEED);
    tft.backlight(true);

    tft.fillScreen(RED);
    delay(500);
    tft.fillScreen(GREEN);
    delay(500);
    tft.fillScreen(BLUE);
    delay(500);
 
You might want to take a picture of the back of your board and post it, showing the jumpers and the resistors...
Thought about doing so, forgot to do it. Here it is.
1719951321324.jpeg

Checking the jumpers, it seems to be wired for 4-way SPI, but trying to connect and initialize all the wires, MISO included, changed nothing on the outcome: same black screen.
Also check for backlight settings.
I honestly have no idea how to check those: on the datasheet there is no usable information - at least not that I'm aware of - about how to check or change it. According to the pdf, it's just controlled by the RA8875 PWM module... with no instructions about how to comunicate with it.
You said benchmark works, have you tried,
tft.begin(Adafruit_800x480);
No I haven't, I thought this would be reserved for adafruit displays only. Will try in a couple of minutes, I'll add the outcome in an edit section in this post.
Have you tried passing in a lower speed for SPI?
In a picture view program I have:
Code:
#define TFT_RA8875_BEGIN_MODE RA8875_800x480
#define TFT_RA8875_BEGIN_COLORS_BPP 16
#define TFT_RA8875_BEGIN_SPI_SPEED 12000000


    tft.begin(TFT_RA8875_BEGIN_MODE, TFT_RA8875_BEGIN_COLORS_BPP, TFT_RA8875_BEGIN_SPI_SPEED);
    tft.backlight(true);

    tft.fillScreen(RED);
    delay(500);
    tft.fillScreen(GREEN);
    delay(500);
    tft.fillScreen(BLUE);
    delay(500);
Thought about it, but didn't know how to safely do it. Will try in a moment. This code is in in the void setup() section I suppose, right?
 
Thought about doing so, forgot to do it. Here it is.
View attachment 34887
Checking the jumpers, it seems to be wired for 4-way SPI, but trying to connect and initialize all the wires, MISO included, changed nothing on the outcome: same black screen.

I honestly have no idea how to check those: on the datasheet there is no usable information - at least not that I'm aware of - about how to check or change it. According to the pdf, it's just controlled by the RA8875 PWM module... with no instructions about how to comunicate with it.

No I haven't, I thought this would be reserved for adafruit displays only. Will try in a couple of minutes, I'll add the outcome in an edit section in this post.

Thought about it, but didn't know how to safely do it. Will try in a moment. This code is in in the void setup() section I suppose, right?
Again it has been awhile since I played with one of these... 15 Open 116 closed so BL pin is not used but instead you need to configure
the internal PWM... Been awhile.
Got to run

1719964184603.png
 
From the RA8875 library which is installed by TD1.59, the following functions are listed in the RA8875.h file:

Code:
    void         backlight(boolean on);
    void        displayOn(boolean on);//turn display on/off
    void        sleep(boolean sleep);//put display in sleep or not
    void         brightness(uint8_t val);//ok

Again, with the liberal understanding that I have the 7" display using the RA8875 controller (whereas, you have the 5" display), I define my display object as follows (the specifics don't really matter for what you are after . . . this is just to show how the display object is declared):

Code:
// when used w/ Audio Adapter, must use an alternate CS pin for the display
const int RA8875_CHIP_SELECT     =  38;       // Teensy 38 (A14) -to- RA8875 05
const int RA8875_RESET           =   3;       // Teensy 03 (D03) -to -RA8875 11
const int RA8875_MISO            =  39;       // Teensy 39 (A15) -to- RA8875 06
const int RA8875_MOSI            =  26;       // Teensy 26 (A12) -to- RA8875 07
const int RA8875_SCLK            =  27;       // Teensy 27 (A13) -to- RA8875 08
const int RA8875_TS_INT          =   2;       // Teensy 02 (D02) -to- RA8875 33

RA8875 tft = RA8875(RA8875_CHIP_SELECT, RA8875_RESET, RA8875_MOSI, RA8875_SCLK, RA8875_MISO);

Now, combining this declaration with the library functions listed above, I make the following function call to set the display brightness:

Code:
                  tft.brightness(brightnessValue);

You mention trying to call this function in your OP, but it is not clear from your post whether you actually passed it a value in the range: 0...255 ??

Hope that helps . . .

Mark J Culross
KD5RXT
 
Again it has been awhile since I played with one of these... 15 Open 116 closed so BL pin is not used but instead you need to configure
the internal PWM... Been awhile.
Got to run
(Also response to @kd5rxt-mark )
Yes, I believe this is the way it's supposed to work, but I don't understand how to configure the internal PWM, declaring a tft.brightness(value from 0 to 255) seems to do nothing.
I am currently trying to perform all the modifications you guys kindly suggested, will make another post in a couple of minutes with the results
 
From the RA8875 library which is installed by TD1.59, the following functions are listed in the RA8875.h file:

Code:
    void         backlight(boolean on);
    void        displayOn(boolean on);//turn display on/off
    void        sleep(boolean sleep);//put display in sleep or not
    void         brightness(uint8_t val);//ok
I have a question about this: do I need to call the void function before using the display ones? In my previous attempts I omitted it
 
Results: with the following code, still no sign of life from the display, I feel to be running out of options here...
Code:
#include <SPI.h>
#include <RA8875.h>

#define RA8875_CS 10
#define RA8875_RST 8
#define RA8875_SPIS 8000000
RA8875 tft = RA8875(RA8875_CS, RA8875_RST);

void setup() {
  tft.displayOn(true);
  tft.backlight(true);
  tft.brightness(255);
  pinMode(RA8875_RST, OUTPUT);
  digitalWrite(RA8875_RST, HIGH);
  tft.begin(RA8875_800x480, 16, RA8875_SPIS);
}

void loop() {
  tft.fillScreen(RA8875_RED);
  delay(1000);
  tft.fillScreen(RA8875_GREEN);
  delay(1000);
  tft.fillScreen(RA8875_BLUE);
  delay(1000);
  tft.drawLine(50, 50, 150, 50, RA8875_WHITE);
  tft.drawLine(150, 200, 250, 200, RA8875_WHITE);
}
Could it be some kind of error in the SPI protocol/library? I really can't understand what I'm missing in the code. All the pins except for MISO are wired according to the datasheet, as connecting it did not change a thing.
 
If it were me, I would probably change the two jumpers I showed (J15/J16)
Solder closed J15, unsolder J16.
This puts backlight control under the control of pin on the connector... Connect it up to 3.3v or to IO pin you set high
and see if your display works.

Double check your wiring. I found them very temperamental with jumper wires. ...

Looks like it is SPI4... If that does not work try some of the other RA8875_ settings on it like 480x272 to make sure that they did not send
the wrong one...

Sorry can only throw darts...
 
If it were me, I would probably change the two jumpers I showed (J15/J16)
Solder closed J15, unsolder J16.
This puts backlight control under the control of pin on the connector... Connect it up to 3.3v or to IO pin you set high
and see if your display works.

Double check your wiring. I found them very temperamental with jumper wires. ...

Looks like it is SPI4... If that does not work try some of the other RA8875_ settings on it like 480x272 to make sure that they did not send
the wrong one...

Sorry can only throw darts...
Don' t worry, I do appreciate everyone's help, I know it's a strange situation with few clues to identify the problem...
Will try to use RA8875_480x272 since I've got nothing to lose.
Also will change the jumpers and blast 3.3V on the BL_Control pin, can you point me out with some code to use PWM signal from the Teensy to later control it (if everything works)? I've never used PWM signals...
Also, I've read about jumper wires being tricky for this kind of application, but how can I minimize electrical noise? I don't think soldering wires directly on the PCB's THT could help
 
If it were me, I would probably change the two jumpers I showed (J15/J16)
Solder closed J15, unsolder J16.
This puts backlight control under the control of pin on the connector... Connect it up to 3.3v or to IO pin you set high
and see if your display works.

Double check your wiring. I found them very temperamental with jumper wires. ...

Looks like it is SPI4... If that does not work try some of the other RA8875_ settings on it like 480x272 to make sure that they did not send
the wrong one...

Sorry can only throw darts...
Update: tried to use the RA8875_480x272 setting, but it did not change the outcome. Same story with the lower SPI speed (8MHz).
I'm still unsure about changing the J15/J16 jumpers, since after closer inspection on the datasheet, it is pointed out that the combination of J15 short / J16 open is exclusive to the parallel interface (8080 amd 6800), in SPI interface mode they should stay the way they are.
About the other 3wire/4wire jumper, I honestly don't really think it matters... Connecting and configuring the Teensy in 4 wire SPI mode did not change a thing.
Could it be the wiring? If so how can I shield the jumper cables from disturbance?
 
Update #2: after finally managing to fix the jumper connections (as @KurtE suggested, now it's connected in 3 Wire-SPI mode and with external backlight) I finally get some signs of life, albeit aforementioned signs being a dim white light leaking from the sides... at least I can safely say that the backlight works connected to a 3.3VDC supply. When connected to a PWM pin using analogWrite() it behaves strangely, sometimes lighting up and sometimes not...
Unfortunately, still no luck with the code itself, it seems to do pretty much nothing... Could it be a supply problem now? I see the battery is at 7.33 Volts (it's a 9V battery) .
On a last note, I see this strange horizontal line running across the screen, I really do hope it's not a broken line of pixels...
Backlight_Dim.jpg
 
Update #2: after finally managing to fix the jumper connections (as @KurtE suggested, now it's connected in 3 Wire-SPI mode and with external backlight) I finally get some signs of life, albeit aforementioned signs being a dim white light leaking from the sides... at least I can safely say that the backlight works connected to a 3.3VDC supply. When connected to a PWM pin using analogWrite() it behaves strangely, sometimes lighting up and sometimes not...
Unfortunately, still no luck with the code itself, it seems to do pretty much nothing... Could it be a supply problem now? I see the battery is at 7.33 Volts (it's a 9V battery) .
On a last note, I see this strange horizontal line running across the screen, I really do hope it's not a broken line of pixels...
View attachment 35027
Note: I would guess that this won't work with a simple 9v battery like that. Let alone usually the wires that connect them probably don't carry very much current. But I could be proven wrong...
 
Back
Top