RA8875 and 4.1 with SPI

Status
Not open for further replies.

rmills

Active member
I'm having a heck of a time getting anything out of a BuyDisplay 5" EVE RA8875, no touch on a teensy 4.1. Link: https://www.buydisplay.com/5-inch-tft-lcd-module-800x480-display-controller-i2c-serial-spi

SPI pin header, 4-wire, 3.3V. Tried every library I can find, nothing seems to turn on the backlight consistently, randomly I can get garbage out. I scoped the SPI bus, I can see it writing and reading, current goes up, acts like everything is working... sometimes, other times its just a dead fish. If it does it's just garbage on the screen if the backlight even works. Seems totally random, I can unplug and plug it and sometimes it will throw up some garbage like the buffer is getting over run or something. I tried two screens, two different 4.1's. Testing on a breadboard, grounded all the GND pins on the teensy, 10k pull up resistors on the data pins, screen is powered by a bench supply, tried cutting the pad and powering everything off the bench, no change. Then pulled an awesome move and drove one of the screens at 13.3V and smoked it. I tried running the screen in 3 wire mode and 4 wire mode (switching the jumpers), no change. Nothing else is on the bus or connected. Adafruit lib will kind of work in the sense I can poll and wait for the screen to respond and display some junk. I'm getting nothing out of the sumotoy and its branches and recent updates. I saw Paul's example and it looks like most people are using the parallel bus pins and using the reset and interrupt pins. I tried adding those pins and the reset seemed to get junk more often but not constantly. Odds are I damaged both screen seems unlikely, I had checked everything 20 times by the time I hooked up the 2nd screen and teensy, but at this point I feel like I'm out of ideas.

Does anyone have a working example with that screen on a 4.1. Will it work with the SPI Pin header? Is there a library that works I might have missed?

Paul I was a bit confused by the Teensyduino, I'm using VSCode so I can't install it. I saw your post that you had updated libraries in it for RA8875 but the github for it does not have a RA8875 package. Where might I go to just get the packages?

PIN OUT ON THE SPI PINS
4.1 -> LCD
GND -> 1-2
3.3 -> 3-4
CS 10 -> 5 CS
MISO 12 -> 6 SDO
MOSI 11 -> 7 SDI
SCK 13 -> 8 SCLK
 
Paul I was a bit confused by the Teensyduino, I'm using VSCode so I can't install it. I saw your post that you had updated libraries in it for RA8875 but the github for it does not have a RA8875 package. Where might I go to just get the packages?
This one is easy: https://github.com/PaulStoffregen/RA8875. This is based on Sumotoys library by the way but with additional enhancements.

The other thing. How are you driving the display. If from the 3.3v pin of the T4.1 you may not have enough power to drive the display but that is a guess. I have the -5 version of the display which allows you to drive it from the 5v so works better for me. You also may need to hook up the backlite to 3.3v or tie it to a pin and drive it high on startup.

You can also check out this thread on the development of the library.
 
This one is easy: https://github.com/PaulStoffregen/RA8875. This is based on Sumotoys library by the way but with additional enhancements.

The other thing. How are you driving the display. If from the 3.3v pin of the T4.1 you may not have enough power to drive the display but that is a guess. I have the -5 version of the display which allows you to drive it from the 5v so works better for me. You also may need to hook up the backlite to 3.3v or tie it to a pin and drive it high on startup.

You can also check out this thread on the development of the library.

I did see that Lib but he had mention in another thread he had updated the version for Teensyduino recently but that one has not been updated in 6-7 years, I tried the "v4" version but had no luck.

I am powering in on both the VCC and GND pins on the SPI header. Tomorrow I will try putting something more beefy on it.
 
I did see that Lib but he had mention in another thread he had updated the version for Teensyduino recently but that one has not been updated in 6-7 years, I tried the "v4" version but had no luck.

I am powering in on both the VCC and GND pins on the SPI header. Tomorrow I will try putting something more beefy on it.

You needed to change to the T4 branch - forgot to mention but heres the direct link: https://github.com/PaulStoffregen/RA8875/tree/RA8875_t4
 
You needed to change to the T4 branch - forgot to mention but heres the direct link: https://github.com/PaulStoffregen/RA8875/tree/RA8875_t4

I was admittedly very frustrated yesterday after about 10 hours of just trying to get that screen to turn on. Went back to it today with fresh eyes. I still can't see anything wrong and its not a very complex setup. I have been using the t4 version, none of the examples seem to work for me. I made a slightly more involved script based on a number of forum posts I saw to try and connect with various configurations in case something needed to be explicitly turned on. While my scope is decoding the serial, I dropped the SPI speed to be safe. I'm trying a basic tft.print("test") and checking tft.readStatus(). If I understand correct that should write "test" on the screen and status should return 1 however nothing is written in the docs for what readStatus() should return. Disconnected I get 0 on the status, connected I get 255, and nothing on the screen. This morning I soldered heaver gauge wire directly to the pins in case its a current issue. Before I was able to plug and unplug it, if the script was running to connect I could sometimes get it to display garbage if I plugged it in while the script was trying to connect. It does not seem to do anything when the screen is already powered up and running. I double check and metered the soldered jumper config, looks to be correct for 4-wire SPI. I had tested it in 3 wire SPI as well with no change. Its worth noting I can see the current draw change with each call, however its super low, ~150ma driving both the 4.1 and the screen, when the backlight randomly turned on it goes up anywhere from 400ma to 700ma. At this point I assume hardware failure but I just don't know how I could have. If anyone has suggestions or spots something I missed please let me know.

Configuration: 4-Wire SPI Pin Header, 3.3V, No Touch, ER3300-1 Fontchip, No EXT SD reader
Screen Details: https://www.buydisplay.com/5-inch-tft-lcd-module-800x480-display-controller-i2c-serial-spi
Screen Datasheet: https://www.buydisplay.com/download/manual/ER-TFTM050-3_Datasheet.pdf

Note: Teensy 4.1 is running on bench power not USB, pad is cut. Bench supply is at 3.4V, low but it seems to be working just fine.


PIN OUT Teensy 4.1 to Display
4.1 -> LCD
GND -> 1-2
3.3V -> 3-4
CS 10 -> 5 CS
MISO 12 -> 6 SDO
MOSI 11 -> 7 SDI
SCK 13 -> 8 SCLK

RA8875 Lib: https://github.com/PaulStoffregen/RA8875/tree/RA8875_t4
Code:
#include <SPI.h>
#include <RA8875.h>

//RA8875(CS,RST,MOSI,SCLK,MISO);
RA8875 tft = RA8875(10,255,11,13,12);


void setup()
{
  Serial.begin(9600);
  
}  

void loop()
{
  //  begin display: Choose from: RA8875_480x272, RA8875_800x480, RA8875_800x480ALT, Adafruit_480x272, Adafruit_800x480
  // Low Speed: 4000000UL
    uint32_t SPISPEED = 4000000UL;
    uint8_t COLOR = 16;

    Serial.println("RA8875_800x480");
    tft.begin(RA8875_800x480, COLOR, SPISPEED, SPISPEED);
    tft.displayOn(true);
    tft.GPIOX(true);
    tft.PWMout(1, 255);
    delay(100);
    tft.print("test1");
    delay(100);
    Serial.println(tft.readStatus());
    delay(3000);

    Serial.println("RA8875_800x480ALT");
    tft.begin(RA8875_800x480ALT, COLOR, SPISPEED, SPISPEED);
    tft.displayOn(true);
    tft.GPIOX(true);
    tft.PWMout(1, 255);
    delay(100);
    tft.print("test2");
    delay(100);
    Serial.println(tft.readStatus());
    delay(3000);

    Serial.println("Adafruit_800x480");
    tft.begin(Adafruit_800x480, COLOR, SPISPEED, SPISPEED);
    tft.displayOn(true);
    tft.GPIOX(true);
    tft.PWMout(1, 255);
    delay(100);
    tft.print("test3");
    delay(100);
    Serial.println(tft.readStatus());
    delay(3000);
}


 
Last edited:
If I am looking correctly at your display:
screenshot.jpg

I believe it is configured for an external BL pin (Page 13 on the datasheet)

I believe that with this configuration you probably need to hook up signal to I think pin 14 on the other connector...

Alternative is to change those two jumpers and which case you can turn on the backlight

It has been awhile, but it may have to do with some of the stuff like:
//tft.GPIOX(true); // Enable TFT - display enable tied to GPIOX
//tft.PWM1config(true, RA8875_PWM_CLK_DIV1024); // PWM output for backlight
//tft.PWM1out(255);
 
If I am looking correctly at your display:
View attachment 27844

I believe it is configured for an external BL pin (Page 13 on the datasheet)

I believe that with this configuration you probably need to hook up signal to I think pin 14 on the other connector...

Alternative is to change those two jumpers and which case you can turn on the backlight

It has been awhile, but it may have to do with some of the stuff like:
//tft.GPIOX(true); // Enable TFT - display enable tied to GPIOX
//tft.PWM1config(true, RA8875_PWM_CLK_DIV1024); // PWM output for backlight
//tft.PWM1out(255);

I did see that, thou I think it is configured for the internal not external. It's why I was throwing every command related at it. J15 open, J16 short, is internal. That said, I did not try switch to external, I know its PWM but I assume if I just short that to the 3.3 rail it will max it. At this point I have nothing to loose and I will give that a try.
 
@rmills

Have a couple of suggestions.
1. Hook up RST to pin 8, From Sumotoy's wiki.
Capture.PNG

2. Start with the benchmark example (good test) to start (I usually try that sketch first to make sure of my connections (examples -> RA8875_t4 -> Teensy 3 -> benchmarks

3. 40Mhz may be a bit fast - believe default is about 18Mhz - would start with the default begin, The SPI Speed in the begin is for the SPISpeed and SPIReadSpeed. The default value is 6Mhz. The notes we put in for both is don't go higher than 22Mhz. But definitely start at 18Mhz

Code:
tft.begin(RA8875_800x480);

4. Recheck your connections is still not working - personally I use male-female connectors between the breadboard and the display.

5. I usually don't use pullups on SPI when just testing a display but...

Hope this helps
 
@rmills

Have a couple of suggestions.
1. Hook up RST to pin 8, From Sumotoy's wiki.
View attachment 27845

2. Start with the benchmark example (good test) to start (I usually try that sketch first to make sure of my connections (examples -> RA8875_t4 -> Teensy 3 -> benchmarks

3. 40Mhz may be a bit fast - believe default is about 18Mhz - would start with the default begin, The SPI Speed in the begin is for the SPISpeed and SPIReadSpeed. The default value is 6Mhz. The notes we put in for both is don't go higher than 22Mhz. But definitely start at 18Mhz

Code:
tft.begin(RA8875_800x480);

4. Recheck your connections is still not working - personally I use male-female connectors between the breadboard and the display.

5. I usually don't use pullups on SPI when just testing a display but...

Hope this helps

The plot thickens. I noticed when running my test script it was getting different status from time to time after hooking up the RST pin. I guess the library does not work with the internal reset on that specific display? Ran the default benchmarks as written and I'm getting results out, however, nothing shows up on the screen? Set the PWM backlight to a modest 80 so I can see the screen but nothing draws. Going to start testing other examples but should I be seeing something on the display?

Benchmarks:

screen:800x480 - rotation:0
Benchmark Time (microseconds)
Screen fill 46
Test Pixel 18
Test Pixels 12292
Text 2306
7927
Horiz/Vert Lines 30046
Rectangles (outline) 2977
Rectangles (filled) 2976
Circles (filled) 6005711
Circles (outline) 6996943
Triangles (outline) 273192
Triangles (filled) 167972
Rounded rects (outline) 75705
Rounded rects (filled) 113457
--------------------------------

screen:480x800 - rotation:1
Benchmark Time (microseconds)
Screen fill 46
Test Pixel 19
Test Pixels 7369
Text 2288
Lines 7720
Horiz/Vert Lines 9393
Rectangles (outline) 2886
Rectangles (filled) 3011
Circles (filled) 7680875
Circles (outline) 8817489
Triangles (outline) 251461
Triangles (filled) 232360
Rounded rects (outline) 37826
Rounded rects (filled) 65747
--------------------------------

41
Test Pixel 19
Test Pixels 12287
Text 2345
Lines 7887
Horiz/Vert Lines 9487
Rectangles (outline) 2962
Rectangles (filled) 2812
Circles (filled) 7147851
Circles (outline) 7453397
Triangles (outline) 251931
Triangles (filled) 335436
Rounded rects (outline) 36069
Rounded rects (filled) 84630
--------------------------------

screen:480x800 - rotation:3
Benchmark Time (microseconds)
Screen fill 42
Test Pixel 18
Test Pixels 7369
Text 2296
Lines 7776
Horiz/Vert Lines 9101
Rectangles (outline) 2977
Rectangles (filled) 3015
Circles (filled) 7069338
Circles (outline) 9956746
Triangles (outline) 293937
Triangles (filled) 292363
Rounded rects (outline) 65208
Rounded rects (filled) 164764
--------------------------------

screen:800x480 - rotation:0
Benchmark Time (microseconds)
Screen fill 42
Test Pixel 18
Test Pixels 12287
Text 2336
Lines 7841
Horiz/Vert Lines 9492
Rectangles (outline) 2957
Rectangles (filled) 2960
Circles (filled) 7071589
Circles (outline) 8667411
Triangles (outline) 335432
Triangles (filled) 356013
Rounded rects (outline) 99827
Rounded rects (filled) 103976
--------------------------------

screen:480x800 - rotation:1
Benchmark Time (microseconds)
Screen fill 46
Test Pixel 19
Test Pixels 7369
Text 2299
Lines 7724
Horiz/Vert Lines 9141
Rectangles (outline) 2836
Rectangles (filled) 2969
Circles (filled) 7676969
Circles (outline) 8967638
Triangles (outline) 293877
Triangles (filled) 335807
Rounded rects (outline) 75768
Rounded rects (filled) 126149
--------------------------------

screen:800x480 - rotation:2
Benchmark Time (microseconds)
Screen fill 46
Test Pixel 19
Test Pixels 12287
Text 2312
Lines 7896
Horiz/Vert Lines 9448
Rectangles (outline) 2952
Rectangles (filled) 2894
Circles (filled) 7144898
Circles (outline) 7071565
Triangles (outline) 252367
Triangles (filled) 251582
Rounded rects (outline) 53736
Rounded rects (filled) 92539
--------------------------------

screen:480x800 - rotation:3
Benchmark Time (microseconds)
Screen fill 46
Test Pixel 19
Test Pixels 7369
Text 2359
Lines 7906
Horiz/Vert Lines 9312
Rectangles (outline) 2861
Rectangles (filled) 2959
Circles (filled) 6922137
Circles (outline) 9653550
Triangles (outline) 273318
Triangles (filled) 356028
Rounded rects (outline) 55088
Rounded rects (filled) 219000
--------------------------------

screen:800x480 - rotation:0
Benchmark Time (microseconds)
Screen fill 57
Test Pixel 19
Test Pixels 12287
Text 2239
Lines 7796
Horiz/Vert Lines 9322
Rectangles (outline) 2892
Rectangles (filled) 2945
Circles (filled) 8132992
Circles (outline) 7073290
Triangles (outline) 230647
Triangles (filled) 335480
Rounded rects (outline) 55349
Rounded rects (filled) 82799
--------------------------------

screen:480x800 - rotation:1
Benchmark Time (microseconds)
Screen fill 46
Test Pixel 19
Test Pixels 7369
Text 2292
Lines 7760
Horiz/Vert Lines 9384
Rectangles (outline) 2952
Rectangles (filled) 2980
Circles (filled) 6010035
Circles (outline) 11324542
Triangles (outline) 252157
Triangles (filled) 294327
Rounded rects (outline) 33799
Rounded rects (filled) 119721
--------------------------------

screen:800x480 - rotation:2
Benchmark Time (microseconds)
Screen fill 42
Test Pixel 19
Test Pixels 12287
Text Lines 7851
Horiz/Vert Lines 9477
Rectangles (outline) 2922
Rectangles (filled) 2941
Circles (filled) 7829362
Circles (outline) 6089003
Triangles (outline) 230702
Triangles (filled) 334289
Rounded rects (outline) 75744
Rounded rects (filled) 81443
--------------------------------

screen:480x800 - rotation:3
Benchmark Time (microseconds)
Screen fill 42
Test Pixel 18
Test Pixels 7368
Text 2279
Lines 7750
Horiz/Vert Lines 9454
Rectangles (outline) 2972
Rectangles (filled) 2967
Circles (filled) 6162038
Circles (outline) 9273815
Triangles (outline) 273011
Triangles (filled) 355993
Rounded rects (outline) 53419
Rounded rects (filled) 110214
--------------------------------
 
I tried a number of examples, nothing draws correctly on the screen, but the serial seems to be working in both directions. The serial output acts like its working but when you try to draw anything its just wrong, like if I try a basic text example i get a single line thru the middle, another example with fills drew a small square in the wrong color. I must have damaged this display somehow. I can't think of anything else that would matter.
 
It has been a long time since I tried their 5".... Sitting in box... Mostly been playing with the 4.3" version
 
It has been a long time since I tried their 5".... Sitting in box... Mostly been playing with the 4.3" version

I think I'm going to try a NewHaven screen instead, US based with meaningful support. Costs more, but seems like a better product all the way around on a better chipset and a dedicated SPI chip. Examples for MCU's like Arduinos that are current, and they were smart enough to put all the pins on the same header and NOT put it 2mm away from the mounting holes (look at spi header my photo, wtf?). Some other useful stuff built in like fonts and drawing for shapes like gauges. BuyDisplay only has examples for an MCU I cant even find. I emailed a really basic question and they were more concerned with making sure I had placed an order first :rolleyes:, and even thou I had they could not find the order and I gave up after 3 emails of back and forth in auto-translated English. Vendor support matters and some company's are doing it really poorly. I'm happy to support Paul after I saw an exchange with him and another company where he was basically offering to troubleshoot/fix their product for free and they would not even send him a $40 board to test or even respond in a reasonable time it seemed. Something that was really on par with my experiences with them and why I avoid them unless I have too, they claim one level of support and just don't even try. I'm on a really short deadline for this one, I probably rushed too much and I'm sure this was my fault and I broke it but getting to this point was way too much work and its been nearly all community supported with nothing coming from BuyDisplay in years. BuyDisplay seems like the choice if know them and their limitations but I guess I need a little more. This is the NewHaven alternative I'm looking at if you ever want to try something else: https://www.newhavendisplay.com/nhd50800480ftctxlt-p-9574.html
 
I just pulled out my 5 inch ER-RFTM050-2 display (5v)

It looks like it has the same BL configuration as yours as well as the same pinouts

Code:
J15Open,J16Short:SelectBacklightControlSignalwithRA8875'PWM’

It seems to work without setting the BL. Of course I am using RST connected the T4.

I would check you wiring and not use BL.

EDIT: Just as a double check. Make sure you have the 3.3v version and not the 5v version. Look for J8. If its open then its the 5v version, if shorted then its 3.3v.
 
I just pulled out my 5 inch ER-RFTM050-2 display (5v)

It looks like it has the same BL configuration as yours as well as the same pinouts

Code:
J15Open,J16Short:SelectBacklightControlSignalwithRA8875'PWM’

It seems to work without setting the BL. Of course I am using RST connected the T4.

I would check you wiring and not use BL.

Were you using your on the 8 pin header or the 40 pin? Did you need the reset? Pretty sure I damaged mine some how but it would not do anything without the RESET, at least not with the t4 lib.
 
All connections were using the 8pin headers except for RST which is on the 40 pin header. I have rst attached to pin 8 but could use any digital pin. Never tried it withou using rst or setting rst 255? May try that in the morning.

So are you saying it’s now working? Just want to make sure
 
All connections were using the 8pin headers except for RST which is on the 40 pin header. I have rst attached to pin 8 but could use any digital pin. Never tried it withou using rst or setting rst 255? May try that in the morning.

So are you saying it’s now working? Just want to make sure

Mine is not, well it acts like it but does not display anything correctly or meaningful. But I think I damaged it somehow. Mine is hooked up as described above except that now I have the reset pin connect on the 40 pin header. Without it, i was getting nothing.
 
I know at one point my first one was finacy and improved when I converted to 5v… ordered vr from them…
 
I know at one point my first one was finacy and improved when I converted to 5v… ordered vr from them…

I wondered if it had something to do with current spiking for milliseconds and maybe causing a brown out on the RA8875 because of breadboard wiring. There is not much capacitance on the board outside of some decoupling around the chip given how much draw it has for the backlight, maybe the 5v just gives the extra it needs.
 
I wondered if it had something to do with current spiking for milliseconds and maybe causing a brown out on the RA8875 because of breadboard wiring. There is not much capacitance on the board outside of some decoupling around the chip given how much draw it has for the backlight, maybe the 5v just gives the extra it needs.

You might try hacking up some external 3.3v connection and see if it helps.

Should also mention that in the past I had issues with some of them working consistently when I hooked them up with jumper wires. Which is why built a quick and dirty board, which helped.

You might also try reducing the SPI speed to something lower and see if it helps. Like:

tft.begin(12000000);
 
Status
Not open for further replies.
Back
Top