RA8876LiteTeensy For Teensy T36 and T40

wwatson

Well-known member
My RA8876 software driver for the BuyDisplay ER-TFTM101-1 10.1 inch tft display w/touch lcd module for use with the T36/T40.
Found here:
https://github.com/wwatson4506/Ra8876LiteTeensy

Touch Screen only tested on the T36 using a slightly modified version of the XPT2046.cpp Teensy driver. Sharing
SPI ports did not work out well so on the T36 with TallDog's breakout board I was using two SPI ports. One for the
display and one for the touch screen.
When a preassembled T40 breakout board (that I don't have to solder) with more than one available SPI port becomes
available I will test on the T40 and add the XPT2046 files to the repository. To shackey to solder anymore:(

WIP, Lot's to do yet functional.

See README.txt and files in the repository for more information.
The RA8876 does have the MISO tristate issue as the RA8875 has as well.

This display is not cheap but works for what I wanted, To be able to see and read the thing:)
Gives a lot more real estate than smaller displays, (1024x640) with 16MB of RAM.
TechToys board uses 32MB of RAM. I think.
 
Last edited:
I see the 10.1" display has a dot pitch of 0.2175(W)x0.2088(H)mm. Do you have any problem drawing a circle ? Does it look round ?

I had loads of problems with non square pixels trying to draw circle and boxes.
 
@wwatson - Wondering how much different is this than the RA8875 boards? i.e. wondering if it makes sense to add support for this board into the RA8875 library code that we forked from Sumotoy?

As you mentioned looks like it has same tri-state issue as their other boards.
 
I see the 10.1" display has a dot pitch of 0.2175(W)x0.2088(H)mm. Do you have any problem drawing a circle ? Does it look round ?

I had loads of problems with non square pixels trying to draw circle and boxes.

I haven't found that information yet, but when I draw a rectangle and use a magnifier glass pixels look round. My eyes are not that good.
There is definitely gaps between the pixels on the horizontal axis which could indicate round pixels. On the vertical axis it is not that pronounced.
I gave the wrong specs on the resolution of the screen with this driver. It is actually 1024x600 not 1024x640.
 
I see the 10.1" display has a dot pitch of 0.2175(W)x0.2088(H)mm. Do you have any problem drawing a circle ? Does it look round ?

I had loads of problems with non square pixels trying to draw circle and boxes.

@Kurte - I was actually thinking the same thing. But the RA8876 controller is quite a bit different than the RA8875 in a lot of ways.
This is why I think Sumotoy started this GitHub site. https://github.com/sumotoy/RA8876 But sadly at this point has not been able to finish it.
I want to research the commonality of the two chips as my time allows. One of the main differences are the amount display memory available and the way it is used.
Trying to find the RA8875 reference manual in all my files:)
Maybe you know but I think the display buffer size for the RA8875 is about 768k and the ER-TFTM101-1 has 16M available which with the RA8876 leads to several display page buffers.
I use this in my RA8876 driver for virtual screens. Some of the basic graphic display engine function are close to the same. User defined characters, rotation, font scaling, mirroring, BTE engine functions and the two PIP windows are different. Maybe through emulation, not sure at this point.
I would like to see a common driver for both display controllers, but that is probably beyond my skill level:)
Sorry @kurte - Replied to the wrong post. Got pulled away again by hungry grand kids.
 
Last edited:
@skpang - Just did another test with the circle command and used a line thickness of 50. In other words the outer radius was 100 and it repeated the circle 50 times reducing the radius by 1.
From what I can see with a resolution of 1024X600, the pixels look square. Used white foreground and black background. Obviously with this resolution it left black squares in the solid white circle.
They are square pixels.
 
@skpang - Just did another test with the circle command and used a line thickness of 50. In other words the outer radius was 100 and it repeated the circle 50 times reducing the radius by 1.
From what I can see with a resolution of 1024X600, the pixels look square. Used white foreground and black background. Obviously with this resolution it left black squares in the solid white circle.
They are square pixels.

I'm not talking about whether the pixel are square or round. I've used some large LCD, when I draw a circle, its not 100% round. It's an oval shape.
 
@kurte - I have a couple of questions about the RA8875 display driver from Sumotoy. Has anybody got this working for the T36 and T4?
If so do you know the links to the latest versions?
The latest posts about this that I was able to find was this:
https://forum.pjrc.com/threads/58337-Bigger-LCD-is-it-possible
But I am not clear if anybody has actually tried it on BuyDisplay's or Adafruit's RA8875 displays.

Sorry if this redundant. Can't keep up with you guy's:)
 
@wwatson, @KurtE, @defragster and others
Started a restricting project on @wwatson's lib to try and make it feel and act like our other display libraries. Changes so far seem to work with the graphics.ino. Some of the things I am working on is making function calls similar:
Code:
tft_cls -> fillScreen
getGwidth -> width
getGheight -> height
etc. This project is just starting and a lot more to be done. But so far so good.

I put it up on a branch in my fork of the project: https://github.com/mjs513/Ra8876LiteTeensy/tree/RA8876-redo.
 
That's awesome @mjs513:) I'm glad to see somebody is trying to standardize the mess I made. I'll be glad to try and answer any questions you might have about it. And I will certainly do testing.

Thanks
 
Cool - no word on my DHL ship/delivery.

github shows :: ER-TFTM101-1 is 1024x600 dots 10.1 "color tft lcd display with RA8876

on the way here is :: ER-TFTM070-6 is 1024x600 dots 7 "color tft lcd module display with RA8876 : $50.05 before shipping { 7", 4 wire SPI, Cap Touch for 5V power, no Font Chip)

BuyDisplay shipping notes are still DHL only - and closed May 1 to 6th:
We temporarily canceled the shipment service of ePacket,EMS,China Post because overbooked.These shipping methods need at least 4-5 weeks longer than before,the reason is that many airlines are canceled due to COVID -19. Only DHL is available now. We'll recover these shipping methods once waiting time is bearable.
 
Cool - no word on my DHL ship/delivery.

github shows :: ER-TFTM101-1 is 1024x600 dots 10.1 "color tft lcd display with RA8876

on the way here is :: ER-TFTM070-6 is 1024x600 dots 7 "color tft lcd module display with RA8876 : $50.05 before shipping { 7", 4 wire SPI, Cap Touch for 5V power, no Font Chip)

BuyDisplay shipping notes are still DHL only - and closed May 1 to 6th:

Yeah = the readme is probably going to be the last thing I am going to update :) But it does work with the 7" version as well.

@wwatson - thanks will definitely ask questions if I get stuck. Right now I think I sorted out what you did and trying to simplify things. Did get print and println working so no more of the craziness of have to convert things to strings :) That will be in the next push I make.
 
That's great. The RA8876 chip has some good possibilities but can be tricky to use. Understanding the RA8876 manual is the other thing that took me some time. The terminology can be tough to decipher. This last weekend I played with display rotation. It is a little disappointing in the fact that you are limited to a 180 text screen flip or a left rotation of 90 degrees of a character font. Full rotation of the graphic screen should be possible but I did not have time to mess with it. You can rotate 270 degrees and I think with the mirror function you might be able to get full rotation.
 
Well just pushed another set of changes as well as updating the examples. So far the only 2 examples not working are scroll.ino and userdefinedfonts.ino. Getting too late now - guess that's the project for tomorrow. Didn't do anything with the vt100 piece though.

@wwatson - cool about the screen rotation. That was on the list of things to do. Sounds like the problem I was having when I was playing with TechToys HDMI adapter which uses the RA8876 as well.
 
Yes, Me too. I Just go my 3" Male/Female jumper wires from Adafruit. This weekend I am going wire up the ER-TFTM101-1 display to the T4.0 and see if I can increase the SPI Speed. Not sure if I have the SPI interface configured right but the RA8876 SPI speed is rated at 50 MHz. The Best I can get is 34 MHz.
 
Morning
Resolved issue with external fonts and scroll up and down. Pushed the change and the updated sketches to the branch if anyone whats to give it a try.
 
Ok - just made another update as well as updating the ReadMe :)

Also, tested with my OpenGL library. Display looks great but some sort of frame buffering needs to be incorporated. So guess that's next.
 
Wow! Thankyou!

I just recently got some RA8876 displays (every different size that BuyDisplay sells) and I was dismayed to see that the RA8876 libraries are much less advanced than the popular Sumotoy library. I've been using that for many years on RA8875 displays. I was going to start this project today, but now I see you've already done it.

My goal is to ultimately make the two libraries compatible so that older RA8875 code can be plugged into an RA8876 with minimal changes. That means maintaining #define's for color constants like RA8875_RED that will work on the newer chip. Obviously code that takes advantage of the RA8876 features like the larger memory won't fit on an RA8875 but simple stuff should be able to port back the opposite direction.
 
Looks like you are making good progress

Maybe there will be some left to do if/when mine arrives :D

Frame buffer - Wondering about how the concept of the RA8875 Layers translates here. I get the impression you can setup your own pages, which can use up the extra memory of the display.

I believe the library has/had the idea of this where there are something like 10 pages defined... Not sure if it works or not.
 
Looks like you are making good progress

Maybe there will be some left to do if/when mine arrives :D

Frame buffer - Wondering about how the concept of the RA8875 Layers translates here. I get the impression you can setup your own pages, which can use up the extra memory of the display.

Not to worry there will be a lot still left to do - honest not sure where to go from here. :)

Frame buffer - Layers don't seem to apply since it looks like you can use the pages but to be honest have no idea how to use them. Manual is totally useless in this regard.
 
@mjs513 - @KurtE The RA8876 uses screen memory in this way:

Code:
/*Page(image buffer) configure*/
/*The maximum number of pages is based on SDRAM capacity and color depth and width and height of one page*/
/*For example we used W9812G6JH SDRAM that capacity =  16Mbyte = 16777216 bytes*/
/*The SDRAM is divided into several image buffers and the maximum number of image buffers is limited by the 
memory size. For example : page_size = 1024*600*2byte(16bpp) = 1228800byte, maximum number = 16/1.2288 */
/*vertical multi page application*/
#define PAGE1_START_ADDR  0
#define PAGE2_START_ADDR  1024*600*2   // 1228800 bytes
#define PAGE3_START_ADDR  1024*600*2*2 // 2457600 bytes
#define PAGE4_START_ADDR  1024*600*2*3
#define PAGE5_START_ADDR  1024*600*2*4
#define PAGE6_START_ADDR  1024*600*2*5
#define PAGE7_START_ADDR  1024*600*2*6
#define PAGE8_START_ADDR  1024*600*2*7
#define PAGE9_START_ADDR  1024*600*2*8
#define PAGE10_START_ADDR  1024*600*2*9

#define PATTERN1_RAM_START_ADDR 1024*600*2*10
#define PATTERN2_RAM_START_ADDR (1024*600*2*10)+(16*16*2)
#define PATTERN3_RAM_START_ADDR (1024*600*2*10)+(16*16*2)+(16*16*2)

This gives ~13 pages of (1024x600) at 16bpp. This obviously changes with larger or smaller color depths. When you are setting the active screen you are using one of the above starting page address for that screen buffer that will be displayed.
Here is part of the selectScreen() function that does that:
Code:
	// Setup params to rebuild selected screen
	pageOffset = screenPage;
	currentPage = screenPage;
	displayImageStartAddress(currentPage);
	displayImageWidth(SCREEN_WIDTH);
	displayWindowStartXY(0,0);
	canvasImageStartAddress(currentPage);
	canvasImageWidth(SCREEN_WIDTH);
	activeWindowXY(0,0);
	activeWindowWH(SCREEN_WIDTH,600); 
	setTextCursor(_cursorX, _cursorY);
	textColor(_TXTForeColor,_TXTBackColor);
	// Rebuild the display
	buildTextScreen();

In the RA8876.pdf starting at page 48 11.2 it kinda explains this.
There are two modes of addressing available. Memory_XY_Mode and Memory_Linear_Mode.
The RA8876 uses the Block Transfer Engine (BTE) in the Memory_XY_Mode to copy, move etc...
Then there is the Memory_Linear_Mode which I have played around with very little. But is very slow when passing data between T.x and the RA8876 at 34MHz.
I have not figured out yet whether using DMA would help or not. At 1228800 bytes per screen page more T.x memory would be needed.

Hopefully I have not confused the issue here:)
 
Back
Top