RA8876 Parallel Display Library Testing

the CS and RST were setup for another board. Fixed that and the 2D errors went away:) Correct me if I am wrong, but do we really need two example folders? I removed the examples folder in the Ra8876_t3 folder and I am able to run all examples in SPI and 8080 modes. Just have to define "USE_SPI" in the RA8876_Config.h file.
@KurtE - Just tried your DMS test from P#272. And it does not finish the transfer from SDRAM. Will have to check it out...
I think I know what is going on... I believe we need to split up the transfer into at least two parts.

If I print out the DMA Channel data for the first two of our dma output examples, I see:
Code:
*** MulBeatWR_nPrm_DMA ***
20002940 400e9000: SA:8000004a SO:-2 AT:12a (SM:0 SS:1 DM:5 DS:2) NB:80010020 SL:-487536 DA:401b071c DO: -4 CI:3b84 DL:0 CS:4a BI:3b85
SDRAM Wrote 243800 bytes in 278ss


Press anykey to continue
activeWindowXY(1, 1)
activeWindowWH(575, 424)
setPixelCursor(1, 1)


*** MulBeatWR_nPrm_DMA ***
20002940 400e9000: SA:6004c6ae SO:-2 AT:12a (SM:0 SS:1 DM:5 DS:2) NB:80010020 SL:-487536 DA:401b071c DO: -4 CI:3b84 DL:0 CS:4a BI:3b85
Wrote 243800 bytes in 245ss

If I output it from my test output I see:
Code:
*** MulBeatWR_nPrm_DMA ***
20002940 400e9000: SA:8000004a SO:-2 AT:12a (SM:0 SS:1 DM:5 DS:2) NB:80010020 SL:-1228736 DA:401b071c DO: -4 CI:97ff DL:0 CS:4a BI:9600
Press anykey to continue

The interesting things are the
1721939931530.png

CI/BI fields: which in the failing case is: CI:97ff
So for 16 bits, the HIGH bit is on which is actually the CITER-ELINK, which then cuts down CITER to 9 bits or 512...

So probably need 2 DMASettings...
 
I think I know what is going on... I believe we need to split up the transfer into at least two parts.

If I print out the DMA Channel data for the first two of our dma output examples, I see:
Code:
*** MulBeatWR_nPrm_DMA ***
20002940 400e9000: SA:8000004a SO:-2 AT:12a (SM:0 SS:1 DM:5 DS:2) NB:80010020 SL:-487536 DA:401b071c DO: -4 CI:3b84 DL:0 CS:4a BI:3b85
SDRAM Wrote 243800 bytes in 278ss


Press anykey to continue
activeWindowXY(1, 1)
activeWindowWH(575, 424)
setPixelCursor(1, 1)


*** MulBeatWR_nPrm_DMA ***
20002940 400e9000: SA:6004c6ae SO:-2 AT:12a (SM:0 SS:1 DM:5 DS:2) NB:80010020 SL:-487536 DA:401b071c DO: -4 CI:3b84 DL:0 CS:4a BI:3b85
Wrote 243800 bytes in 245ss

If I output it from my test output I see:
Code:
*** MulBeatWR_nPrm_DMA ***
20002940 400e9000: SA:8000004a SO:-2 AT:12a (SM:0 SS:1 DM:5 DS:2) NB:80010020 SL:-1228736 DA:401b071c DO: -4 CI:97ff DL:0 CS:4a BI:9600
Press anykey to continue

The interesting things are the
View attachment 35215
CI/BI fields: which in the failing case is: CI:97ff
So for 16 bits, the HIGH bit is on which is actually the CITER-ELINK, which then cuts down CITER to 9 bits or 512...

So probably need 2 DMASettings...
I think you are right. That was going to be my next test. Finding the largest single transfer. I have to go out for a bit but will test when I get back. Unless you beat me to it:D
 
I think you are right. That was going to be my next test. Finding the largest single transfer. I have to go out for a bit but will test when I get back. Unless you beat me to it:D
I think I have a version that is working now... Need to cleanup the debug stuff and will do a PR back to you to look at and test.
 
Last edited:
Another quick note. I find that I do not have to run an external 5V power supply or powered HUB when using USB C connector on my two desktop PC's with the Dev boards. The DB4.5 is running the SPI display and the DB5 is running the parallel display. They have been running for at least a week now without issue...
 
Another quick note. I find that I do not have to run an external 5V power supply or powered HUB when using USB C connector on my two desktop PC's with the Dev boards. The DB4.5 is running the SPI display and the DB5 is running the parallel display. They have been running for at least a week now without issue...
Been running the SPI version of the RA8876 on a T4.1 without issue, just as a note. Ran the Parallel version on the t41 without a problem as well. Kind of surprised me.
 
Been running the SPI version of the RA8876 on a T4.1 without issue, just as a note. Ran the Parallel version on the t41 without a problem as well. Kind of surprised me.
I ran into trouble when not using a powered HUB or external PS when I was working on DiskIO. I was running the display and on USBHost connector I was running a HUB, keyboard, mouse and up to three USB sticks. Things got a little unstable and hot...
 
So far I have not noticed any problems with the +5v coming over USB not being sufficient. I know that my first RA8875 was configured
for 3.3v and running that was problematic.
 
Examples: Maybe depends on final layout of library/libraries. Right now we have more or less 3 Arduino projects in the same Github project, which is fine, although I end up creating 3 links... Alternative could create one logical library, with maybe GFX as sub-directory...
Not sure what is best.
We could set it up to work like we did with Teensy_Camera? Is that what you had in mind.
 
We could set it up to work like we did with Teensy_Camera? Is that what you had in mind.
Maybe, sort of up to what @wwatson wants as it is his library.
If all in one, then maybe need/want to set archive type library as to minimize the chances that unused parts get carried into binary...

Also could be 3 libraries... Like the ILI948x stuff (2 directly in that case, but then there is the SPI version)
 
@KurtE @mjs513 - I have been experimenting with the library layout a little bit. So far I have eliminated the examples folder in RA8876_t3 and tested all of the examples in RA8876_t41_p. Both SPI and 8080 modes. So far so good. Just need to uncomment the "USE_SPI" define in RA8876_Config.h file to use in SPI mode. This file is in the GFX/src folder. I also created another branch for thrashing on the code:
https://github.com/wwatson4506/TeensyRA8876Combined/tree/SPI_8080_WIP. I am now keeping a copy of the latest on two PC's as backup That way I won't mess up your hard work :)
 
Maybe, sort of up to what @wwatson wants as it is his library.
If all in one, then maybe need/want to set archive type library as to minimize the chances that unused parts get carried into binary...

Also could be 3 libraries... Like the ILI948x stuff (2 directly in that case, but then there is the SPI version)
Maybe "RA8876_SPI" and "RA8876_Parallel" or "RA8876_8080"?

EDIT: And RA8876_GFX?
 
Last edited:
FInished setting up the three separate RA8876 libraries:

TeensyRA8876-GFX-Common
TeensyRA8876-8080
TeensyRA8876-SPI

TeensyRA8876-8080 and TeensyRA8876-SPI are now separate drivers that use TeensyRA8876-GFX-Common and they each have their own example folders. I modified the examples in each driver to only contain information specific to that driver type (SPI or 8080). Also created a config file specific to the driver type that contains most of the defines for the driver used in the examples. This really cleaned up the the examples.
8080 parallel:
Code:
/* RA8876_Config.h
 A file to place user defines and configs.
*/

#ifndef RA8876_CONFIG_H
#define RA8876_CONFIG_H

// Hardware defines
#define USE_8080_8_BIT_MODE 8
#define USE_8080_16_BIT_MODE 16

#define RA8876_8080_CS 11
#define RA8876_8080_DC 13
#define RA8876_8080_RESET 12

#define RA8876_WR 53
#define RA8876_RD 52
#define RA8876_D0 40

// DB5 Shield
//#define RA8876_8080_CS 11
//#define RA8876_8080_DC 13
//#define RA8876_8080_RESET 12

#define BUS_SPEED 20 //Available settings 2,4,8,12,20,24,30,40,60,120

//External backlight control connected to this Arduino pin
#define BACKLITE 5
// #define BACKLITE 29

// Uncomment to use FT5206 touch.
#define USE_FT5206_TOUCH

#endif // RA8876_CONFIG_H
SPI:
Code:
/* RA8876_Config.h
 A file to place user defines and configs.
*/

#ifndef RA8876_CONFIG_H
#define RA8876_CONFIG_H

// SPI hardware settings
#define USE_SPI // Needed for writeRect() in RA8876_GFX

#define RA8876_CS 10
#define RA8876_RESET 9
//#define RA8876_CS 30
//#define RA8876_RST 28

//Uncomment to to use 47MHz SPI clock. Default is 30MHz.
//#define USE_SPI_47000000

// Uncomment to use BL pin else wired to 3.3V
//#define BACKLITE 5 //External backlight control connected to this Arduino pin
//#define BACKLITE 29 // Kurt's DB5 shield

// Uncomment to use FT5206 touch.
#define USE_FT5206_TOUCH

#endif // RA8876_CONFIG_H
The 8080 library examples include the testCases folder complete. The SPI library does not contain the 8080 DMA test cases. This might also make the GFX library more adaptable to other MCU's?
Enough for today, it's late:sleep:
 
Realized I need to rename RA8876_Config.h to RA8876_Config_SPI.h and RA8876_Config_8080.h to avoid conflicts when both 8080 and SPI libraries are in the arduino/libraries folder together. That's what happens using two PC's to develop and keeping them synced:confused:
 
Just cloned and created links to these and was able to modify my picture viewer to run it on DB5 16 bit mode.
and on a T41 SPI mode and they both run :D
 
Ok, I just updated both TeensyRA8876_SPI and TeensyRA8876_8080 on GitHub. There should be no conflict if both libraries are in the same folder together. If anybody downloaded these check that the config files are named RA8876_Config_SPI and RA8876_Config_8080 respectively. Download them again if not:oops:
 
Ok, I just updated both TeensyRA8876_SPI and TeensyRA8876_8080 on GitHub. There should be no conflict if both libraries are in the same folder together. If anybody downloaded these check that the config files are named RA8876_Config_SPI and RA8876_Config_8080 respectively. Download them again if not:oops:
argh - just finished synching :) Just joking no problem
 
Dummy question here but will this display library be sort of a “unified” library that supports most variants? I think that’s a good idea. Having it support 8, 16 and even 24 but with 8080 and others. And then documentation on how to and what pins to use (default pins or suggested pins) for each variant.

What do you guys think?
 
Dummy question here but will this display library be sort of a “unified” library that supports most variants? I think that’s a good idea. Having it support 8, 16 and even 24 but with 8080 and others. And then documentation on how to and what pins to use (default pins or suggested pins) for each variant.

What do you guys think?
Have you looked at the libraries?
In particular the Readme file, which shows up when you open the project on github.com.
 
Have you looked at the libraries?
In particular the Readme file, which shows up when you open the project on github.com.
I took a peak, it does look very good and structured. Wonderful work!
So will 24 bit also be added later? We still don't have it working fully, the interrefence or whatever it is is still there. Once that's fixed then it could be added to this library I suppose?
 
I took a peak, it does look very good and structured. Wonderful work!
So will 24 bit also be added later? We still don't have it working fully, the interrefence or whatever it is is still there. Once that's fixed then it could be added to this library I suppose?
On the MCU interface side of the RA8876 supports 8/16-bit bus and on the TFT side it supports 8/16/24-bit bus. Internally 24-bit color is only available in 16-bit MCU mode. I personally have not tried using 24-bit mode on the RA8876. In the library I see this:
Code:
void RA8876_common::Select_Main_Window_8bpp(void) {
    /*
    Main Window Color Depth Setting
    00b: 8-bpp generic TFT, i.e. 256 colors.
    01b: 16-bpp generic TFT, i.e. 65K colors.
    1xb: 24-bpp generic TFT, i.e. 1.67M colors.
    */
    unsigned char temp;
    temp = lcdRegDataRead(RA8876_MPWCTR); // 0x10
    temp &= cClrb3;
    temp &= cClrb2;
    lcdRegDataWrite(RA8876_MPWCTR, temp);
}
void RA8876_common::Select_Main_Window_16bpp(void) {
    /*
    Main Window Color Depth Setting
    00b: 8-bpp generic TFT, i.e. 256 colors.
    01b: 16-bpp generic TFT, i.e. 65K colors.
    1xb: 24-bpp generic TFT, i.e. 1.67M colors.
    */
    unsigned char temp;
    temp = lcdRegDataRead(RA8876_MPWCTR); // 0x10
    temp &= cClrb3;
    temp |= cSetb2;
    lcdRegDataWrite(RA8876_MPWCTR, temp);
}
void RA8876_common::Select_Main_Window_24bpp(void) {
    /*
    Main Window Color Depth Setting
    00b: 8-bpp generic TFT, i.e. 256 colors.
    01b: 16-bpp generic TFT, i.e. 65K colors.
    1xb: 24-bpp generic TFT, i.e. 1.67M colors.
    */
    unsigned char temp;
    temp = lcdRegDataRead(RA8876_MPWCTR); // 0x10
    temp |= cSetb3;
    lcdRegDataWrite(RA8876_MPWCTR, temp);
}
Might be something to play with. The RA8876.pdf ref manual is fairly good at explaining how to use it. I assume with a 16-bit MCU bus you would need to do two 16-bit transfers to get 24 bits into video memory masking off the the upper 8 bits of the high word and also taking endianness into account...
 
@wwatson - @KurtE

Was curious about adapting some of the existing graphics libraries like @KrisKasprzak ILI9341_t3_controls library that allows drawing of graphs, bar charts etc, found here

Found an easy way to add additional displays without rewriting the code:
Code:
#if __has_include("ILI9341_t3.h")
#include <ILI9341_t3.h>
#elif __has_include("RA8876_t41_p.h")
#include <RA8876_t41_p.h>
#define ILI9341_t3 RA8876_t41_p
#endif

1722251083941.png
 
@wwatson - @KurtE

Was curious about adapting some of the existing graphics libraries like @KrisKasprzak ILI9341_t3_controls library that allows drawing of graphs, bar charts etc, found here

Found an easy way to add additional displays without rewriting the code:
Code:
#if __has_include("ILI9341_t3.h")
#include <ILI9341_t3.h>
#elif __has_include("RA8876_t41_p.h")
#include <RA8876_t41_p.h>
#define ILI9341_t3 RA8876_t41_p
#endif

View attachment 35256
That display you use looks like a 7"? That correct?
 
Back
Top