RA8875 from Buydisplay

Not open for further replies.


Well-known member
Hi all, My projects are running fine with a Teensy 3.6 but for better performance I like to use the Teensy 4, I use a RA8875 display from Buydisplay but when compiling I get a error. What can I do to get my programs to work with the new Teensy.


#include <SPI.h>
#include <Wire.h>
#include <RA8875.h>
void setup() {
// put your setup code here, to run once:
void loop() {
// put your main code here, to run repeatedly:

RA8875.cpp:476:11: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment csport = portOutputRegister(digitalPinToPort(_cs));//pinMode(_cs, OUTPUT);
Somebody else asked the same question over in the 1.47 announcement thread. You might want to watch that thread as well in terms of getting an answer:

That's a pitty because the RA8875 from Buydisplay are one of the best displays on the market today, in one or other way there is a solution... because I have many projects that are working perfectly on a 3.6 and need more speed ... I hope someone will help.

Hi all,

I changed a bit the RA8875.ccp and the RA8875.h and have no any errors when compiling..... connected my RA display but nothing on the screen. I noticed that the clock on 13 (LED) goes more bright so I think something is working?

I added the __IMXRT1062__ where is was needed in the .cpp ..... that's solve the errors for the Teensy4 what else can be wrong?

I tested this however without results, the _includes/RA8875_CPU_commons.h is not found.

@pd0lew - Johan

Did you test with the example: benchmarks.ino in the _teensy3/examples. Also did you delete the old library in the teensy library folder and replace it with the new directory in the zip.

Also, check the wiki for the buydisplay notes: https://github.com/sumotoy/RA8875/wiki

Hard to help without more details, like the sketch you are using?

Perhaps I am looking wrong I dowloaded the stuff from https://github.com/mjs513/RA8875/tree/RA8875_t4 when I look into files examples I also so no benchmarks.ino .

My test sketch is to simple:

#include <SPI.h>
#include <RA8875.h>
#include <Wire.h>

#define RA8875_RESET 255 //Not used
#define RA8875_CS 10
RA8875 tft = RA8875(RA8875_CS, RA8875_RESET, 11, 13, 12);

void setup(){



Are we having an issue compiling or things not showing up on the display?

The earlier compile issue was probably due to the registers associated with IO pins are 32 bits not 8 bits...

But assuming that is corrected, I did not have any luck with the RA8875 displays I have from BuyDisplay.com...

Again might help to know exactly which one you have and how you have it hooked up.
That is some of them you hook up to +5v as it has it's own VR on it (and one of the jumpers is not set...) On others it does NOT have VR on board and jumper is set and you must supply 3.3v.

I think I was at times able to get the one without VR to run on a T3.6, but when I tried on T4, I think it pulled too much 3.3v from it and would not run.

As suggested in the wiki that MJS513 pointed to, you probably need an external power supply to run these.

Also it recommended making hardware mods (like replace/remove) resistors... SO I punted for now...
Ok the link you gave me when to the master branch for the library - you need to download this branch: https://github.com/mjs513/RA8875/tree/0.79b11p10

I just compiled your sketch without a problem and checked the 0.79b11p10 branch and it has the benchmark.ino is in the teensy3 directory. Easiest thing to do is to place the downloaded directory in your Arduino libraries folder and delete the RA8875 folder in the ….\arduino-1.8.9\hardware\teensy\avr\libraries folder

EDIT: as @KurtE it would also be good to know which display you have buydisplay
First I run many displays from Buydisplay 4.3, 5 and 7" runs perfectly with a Teensy 3.6.

My test display is a RA8875 Buydisplay 4.3 " 800 x 480 pixels.

Connections CS 10, MOSI 11 an MISO 12 SCK 13, I connected the RA displays many time to the Teensy 3.6 without any issues.
The supply is 5V (measured 4.98V)

When there compile errors then there is no need to look to the hardware I suppose.

A bit desperate.... do you use for sure a RA8875 from Buydisplay?

In file included from /home/holstein/Arduino/libraries/RA8875-0.79b11p10/RA8875.h:149:0,
from /home/holstein/Arduino/libraries/RA8875-0.79b11p10/examples/_teensy3/benchmarks/benchmarks.ino:7:
/home/holstein/Arduino/libraries/RA8875-0.79b11p10/_includes/RA8875_CPU_commons.h:261:3: warning: #warning "Generic Arm detected, not sure if your board it's compatible!" [-Wcpp]
#warning "Generic Arm detected, not sure if your board it's compatible!"
In file included from /home/holstein/Arduino/libraries/RA8875-0.79b11p10/RA8875.h:149:0,
from /home/holstein/Arduino/libraries/RA8875-0.79b11p10/RA8875.cpp:24:
/home/holstein/Arduino/libraries/RA8875-0.79b11p10/_includes/RA8875_CPU_commons.h:261:3: warning: #warning "Generic Arm detected, not sure if your board it's compatible!" [-Wcpp]
#warning "Generic Arm detected, not sure if your board it's compatible!"
/home/holstein/Arduino/libraries/RA8875-0.79b11p10/RA8875.cpp: In member function 'void RA8875::begin(RA8875sizes, uint8_t)':
/home/holstein/Arduino/libraries/RA8875-0.79b11p10/RA8875.cpp:476:11: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment
csport = portOutputRegister(digitalPinToPort(_cs));//pinMode(_cs, OUTPUT);
Error compiling for board Teensy 4.0.
@mjs513 and @pd0lew - I confirmed it does not build...

Looks like in the last set of changes made to RA87875.h

There were several #include lines that changed from:
#include "_settings/xxx"
#include "_include/xxx"

I changed all of these lines to _settings and it does build. I do see some warnings about generic... SO not sure if this is right?

Or maybe new folder (_include) was created but uploaded?

Thanks for helping

Hi all,

Thanks for helping to get my beautiful RA8875 displays to work with the Teensy 4.

I am so happy!

Best regards,

Glad you got it working. Be interesting to see what you did to get it working. Whats that little board you have between the display and T4? Level shifter or a tristate buffer or something else?

Confused on what you changed - in which lib branch. There is _includes directory in the branch. It did compile for me but I don't have a BestBuy display to test with on the Adafruit RA8875 which I did test. Maybe I should pick one up

The tiny PCB is home made a AD7991 I2C 12 bits works also very nice with the T4.

I included the new library's, it compiles without errors and runs smoothly.
View attachment RA8875-0.79b11p10.zip

Horiz/Vert Lines 52594
Rectangles (outline) 265228
Rectangles (filled) 265744
Circles (filled) 146734
Circles (outline) 142973
Triangles (outline) 18195
Triangles (filled) 57626
Rounded rects (outline) 106239
Rounded rects (filled) 902372

screen:800x480 - rotation:0
Benchmark Time (microseconds)
Screen fill 16493
Test Pixel 29
Test Pixels 19419
Text 3543
Lines 85975
Horiz/Vert Lines 52590
Rectangles (outline) 265374
Rectangles (filled) 265748
Circles (filled) 146735
Circles (outline) 142968
Triangles (outline) 21212
Triangles (filled) 60805
Rounded rects (outline) 106215
Rounded rects (filled) 902479

screen:480x800 - rotation:1
Benchmark Time (microseconds)
Screen fill 16494
Test Pixel 29
Test Pixels 11659
Text 3544
Lines 85970
Horiz/Vert Lines 52595
Rectangles (outline) 265811
Rectangles (filled) 265677
Circles (filled) 146734
Circles (outline) 142972
Triangles (outline) 18195
Triangles (filled) 57858
Rounded rects (outline) 106183
Rounded rects (filled) 902410

Aha there must be changed one line too for the RA8875Usersettings.h this will speedup the thing/
//SPI transaction enabled library----------------------
#if defined(__MK20DX128__) || defined(__IMXRT1062__) //[Teensy 3.0 , 3.1 , 3.2]
const static uint32_t MAXSPISPEED = 23000000UL; //don't go higher than 22000000!;
#elif defined(__MKL26Z64__) //[Teensy LC] (12 or 24 Mhz max)
const static uint32_t MAXSPISPEED = 12000000UL; //default SPI main speed TeensyLC
const static uint32_t MAXSPISPEED2 = 22000000UL; //don't go higher than 22000000!;
#elif defined(___DUESTUFF) //[DUE]
const static uint32_t MAXSPISPEED = 15000000UL; // try experiment higher values but NOT over 22000000!
Bechmark: SPI 23MHz

screen:800x480 - rotation:0
Benchmark Time (microseconds)
Screen fill 16472
Test Pixel 19
Test Pixels 12367
Text 2729
Lines 82778
Horiz/Vert Lines 49437
Rectangles (outline) 264238
Rectangles (filled) 264507
Circles (filled) 137937
Circles (outline) 134157
Triangles (outline) 20217
Triangles (filled) 59578
Rounded rects (outline) 93816
Rounded rects (filled) 892219

screen:480x800 - rotation:1
Benchmark Time (microseconds)
Screen fill 16473
Test Pixel 19
Test Pixels 7392
Text 2726
Lines 82886
Horiz/Vert Lines 49472
Rectangles (outline) 264586
Rectangles (filled) 264485
Circles (filled) 137935
Circles (outline) 134151
Triangles (outline) 17231
Triangles (filled) 56533
Rounded rects (outline) 93934
Rounded rects (filled) 892104

screen:800x480 - rotation:2
Benchmark Time (microseconds)
Screen fill 16675
Test Pixel 18
Test Pixels 12367
Text 2720
Lines 82829
Horiz/Vert Lines 49440
Rectangles (outline) 264582
Rectangles (filled) 264364
Circles (filled) 137930
Circles (outline) 134154
Triangles (outline) 20190
Triangles (filled) 59713
Rounded rects (outline) 93865
Rounded rects (filled) 892278
Not open for further replies.