mjs513
Senior Member+
Yes it is. We got it from buydisplay. This is the link: https://www.buydisplay.com/spi-7-inch-tft-lcd-dislay-module-1024x600-ra8876-optl-touch-screen-panelThat display you use looks like a 7"? That correct?
Yes it is. We got it from buydisplay. This is the link: https://www.buydisplay.com/spi-7-inch-tft-lcd-dislay-module-1024x600-ra8876-optl-touch-screen-panelThat display you use looks like a 7"? That correct?
// RA8876_8080_testing.ino
//#include "images.h"
//#include "Teensy41_Cardlike.h"
//#include "flexio_teensy_mm.c"
//#include "teensy41.c"
#include <RA8876_t41_p.h>
uint8_t dc = 13;
uint8_t cs = 11;
uint8_t rst = 12;
#define BACKLITE 5 //External backlight control connected to this Arduino pin
RA8876_t41_p tft = RA8876_t41_p(dc,cs,rst); //(dc, cs, rst)
uint32_t start = 0;
uint32_t end = 0;
uint8_t busSpeed = 12;
uint8_t rData = 0;
uint16_t rslt = 0;
uint32_t rslt32 = 0;
void setup() {
while (!Serial && millis() < 3000) {} //wait for Serial Monitor
Serial.printf("%c MicroMod Board and RA8876 parallel 8080 mode testing (8Bit/DMA)\n\n",12);
// Serial.print(CrashReport);
// pinMode(WINT, INPUT); // For XnWAIT signal if connected and used.
// Set 16bit mode
tft.setBusWidth(16);
// DB5.0 WR pin, RD pin, D0 pin.
tft.setFlexIOPins(53,52,40);
tft.begin(busSpeed);// 20 is working in 8bit and 16bit mode on T41
delay(100);
Serial.print("Bus speed: ");
Serial.print(busSpeed,DEC);
Serial.println(" MHZ");
Serial.print("Bus Width: ");
Serial.print(tft.getBusWidth(),DEC);
Serial.println("-bits");
tft.Select_Main_Window_24bpp();
tft.drawSquareFill24(0,0,1023,599,0x000000);
tft.setFontSize(2);
tft.drawSquareFill24(10,10,100,100,0xFF0000);
tft.setTextColor24(RED);
tft.textxy(0,4);
tft.print("24-BIT RED");
tft.drawSquareFill24(210,210,300,300,0x00FF00);
tft.setTextColor24(GREEN);
tft.textxy(10,10);
tft.print("24-BIT GREEN");
tft.drawSquareFill24(410,410,500,500,0x0000FF);
tft.setTextColor24(BLUE);
tft.textxy(23,16);
tft.print("24-BIT BLUE");
}
void loop() {
waitforInput();
}
void waitforInput()
{
Serial.println("Press anykey to continue");
while (Serial.read() == -1) ;
while (Serial.read() != -1) ;
}
//**************************************************************//
//**************************************************************//
void RA8876_common::foreGroundColor16bpp(ru16 color, bool finalize) {
lcdRegDataWrite(RA8876_FGCR, color >> 8, false); // d2h
lcdRegDataWrite(RA8876_FGCG, color >> 3, false); // d3h
lcdRegDataWrite(RA8876_FGCB, color << 3, finalize); // d4h
}
//**************************************************************//
// Set 24-bit foreground color.
//**************************************************************//
void RA8876_common::foreGroundColor24bpp(ru32 color, bool finalize) {
lcdRegDataWrite(RA8876_FGCR, color >> 16, false); // d2h
lcdRegDataWrite(RA8876_FGCG, color >> 8, false); // d3h
lcdRegDataWrite(RA8876_FGCB, color << 0, finalize); // d4h
}
lcdRegWrite(RA8876_MACR); // 02h
// lcdDataWrite(RA8876_DIRECT_WRITE << 6 | RA8876_READ_MEMORY_LRTB << 4 | RA8876_WRITE_MEMORY_LRTB << 1);
lcdDataWrite(RA8876_MASK_HIGH_BYTE_EVEN_DATA << 6 | RA8876_READ_MEMORY_LRTB << 4 | RA8876_WRITE_MEMORY_LRTB << 1);
lcdRegWrite(RA8876_ICR); // 03h
lcdDataWrite(RA8877_LVDS_FORMAT << 3 | RA8876_GRAPHIC_MODE << 2 | RA8876_MEMORY_SELECT_IMAGE);
lcdRegWrite(RA8876_MPWCTR); // 10h
// lcdDataWrite(RA8876_PIP1_WINDOW_DISABLE << 7 | RA8876_PIP2_WINDOW_DISABLE << 6 | RA8876_SELECT_CONFIG_PIP1 << 4 | RA8876_IMAGE_COLOCR_DEPTH_16BPP << 2 | TFT_MODE);
lcdDataWrite(RA8876_PIP1_WINDOW_DISABLE << 7 | RA8876_PIP2_WINDOW_DISABLE << 6 | RA8876_SELECT_CONFIG_PIP1 << 4 | RA8876_IMAGE_COLOCR_DEPTH_24BPP << 2 | TFT_MODE);
lcdRegWrite(RA8876_PIPCDEP); // 11h
// lcdDataWrite(RA8876_PIP1_COLOR_DEPTH_16BPP << 2 | RA8876_PIP2_COLOR_DEPTH_16BPP);
lcdDataWrite(RA8876_PIP1_COLOR_DEPTH_24BPP << 2 | RA8876_PIP2_COLOR_DEPTH_24BPP);
lcdRegWrite(RA8876_AW_COLOR); // 5Eh
// lcdDataWrite(RA8876_CANVAS_BLOCK_MODE << 2 | RA8876_CANVAS_COLOR_DEPTH_16BPP);
lcdDataWrite(RA8876_CANVAS_BLOCK_MODE << 2 | RA8876_CANVAS_COLOR_DEPTH_24BPP);
// RA8876_BTE_COLR - 92h
// lcdRegDataWrite(RA8876_BTE_COLR, RA8876_S0_COLOR_DEPTH_16BPP << 5 | RA8876_S1_COLOR_DEPTH_16BPP << 2 | RA8876_S0_COLOR_DEPTH_16BPP); // 92h
lcdRegDataWrite(RA8876_BTE_COLR, RA8876_S0_COLOR_DEPTH_24BPP << 5 | RA8876_S1_COLOR_DEPTH_24BPP << 2 | RA8876_S0_COLOR_DEPTH_24BPP); // 92h
Would definitely go with the later approach. Will be cleaner and easier to debug if any issues crop up.Unfortunately everything in this library is based on 16-bit color so most all of the code will have to be changed. Again, do I double the code in this same library or create another copy of the library modify it and name it "RA8876Teensy_32bit_GFX_common"? I am leaning towards the latter. either way it's going to be a lot of work...
@KurtE - Did the PR. But I am still having troubles with ILI_ADA_FontTest4 and OpenSans24. With SPI I'm getting this. Second keystroke after boot:
It's kind of odd as it is displaying the the characters in the correct size right now using what I have setup for 24-bit color. Just inconsistent color which is a hardware setup issue I think...Yep - I saw that, which is why I added the print to know which font it was... Still have not looked at it to fix it...
Not sure if library issue or font issue...
@mjs513 I am sort-of foggy on this. I believe that this is one of the few instances of Anti-aliased fonts which there is special processing for.It's kind of odd as it is displaying the the characters in the correct size right now using what I have setup for 24-bit color. Just inconsistent color which is a hardware setup issue I think...
What I remember is that it was a pr to one of the libs that we then propagated through the other libs as we went.@mjs513 I am sort-of foggy on this. I believe that this is one of the few instances of Anti-aliased fonts which there is special processing for.
Do you remember much
void RA8876_common::drawPixel(ru16 x, ru16 y, ru16 color) {
graphicMode(true);
setPixelCursor(x, y);
ramAccessPrepare();
//lcdDataWrite16(color);
lcdDataWrite(color);
lcdDataWrite(color >> 8);
//#if defined(use_lcdDataWrite16bbp)
// lcdDataWrite16bbp(color);
//#endif
}
void RA8876_common::drawPixel(ru16 x, ru16 y, ru16 color) {
graphicMode(true);
setPixelCursor(x, y);
ramAccessPrepare();
lcdDataWrite16(color);
// lcdDataWrite(color);
// lcdDataWrite(color >> 8);
//#if defined(use_lcdDataWrite16bbp)
// lcdDataWrite16bbp(color);
//#endif
}
I to would probably make that one virtual and each library...Your choice on how you want to differentiate.
EDIT: Maybe be simpler to move drawPixel into each lib instead of gfx?
Awesome I'll test here and change the repo...Ok found the problem rather quickly to be honest. The issue is with draw pixel in common.
For SPI it has to be:
Rich (BB code):void RA8876_common::drawPixel(ru16 x, ru16 y, ru16 color) { graphicMode(true); setPixelCursor(x, y); ramAccessPrepare(); //lcdDataWrite16(color); lcdDataWrite(color); lcdDataWrite(color >> 8); //#if defined(use_lcdDataWrite16bbp) // lcdDataWrite16bbp(color); //#endif }
vs
Rich (BB code):void RA8876_common::drawPixel(ru16 x, ru16 y, ru16 color) { graphicMode(true); setPixelCursor(x, y); ramAccessPrepare(); lcdDataWrite16(color); // lcdDataWrite(color); // lcdDataWrite(color >> 8); //#if defined(use_lcdDataWrite16bbp) // lcdDataWrite16bbp(color); //#endif }
Your choice on how you want to differentiate.
EDIT: Maybe be simpler to move drawPixel into each lib instead of gfx?
This is what I am seeing on the T4.1. Right now I have the parallel version hooked up to the DB5I was going to mention that the colors look different on mine (DB5)
I am wondering if we still have some timing issues?This is what I am seeing on the T4.1. Right now I have the parallel version hooked up to the DB5
View attachment 35328
Just tried it on the DB4.5 and its looks ok - same as posted aboveI am wondering if we still have some timing issues?
boolean RA8876_common::ra8876Initialize() {
// Init PLL
if (!ra8876PllInitial())
return false;
// Init SDRAM
if (!ra8876SdramInitial())
return false;
lcdRegWrite(RA8876_CCR); // 01h
#if defined(USE_SPI)
lcdDataWrite(RA8876_PLL_ENABLE << 7 | RA8876_WAIT_NO_MASK << 6 | RA8876_KEY_SCAN_DISABLE << 5 | RA8876_TFT_OUTPUT24 << 3 |
RA8876_I2C_MASTER_DISABLE << 2 | RA8876_SERIAL_IF_ENABLE << 1 | RA8876_HOST_DATA_BUS_SERIAL);
#else
if(_bus_width == 16) {
lcdDataWrite(RA8876_PLL_ENABLE<<7|RA8876_WAIT_NO_MASK<<6|RA8876_KEY_SCAN_DISABLE<<5|RA8876_TFT_OUTPUT24<<3
|RA8876_I2C_MASTER_DISABLE<<2|RA8876_SERIAL_IF_ENABLE<<1|RA8876_HOST_DATA_BUS_16BIT);
} else {
lcdDataWrite(RA8876_PLL_ENABLE<<7|RA8876_WAIT_NO_MASK<<6|RA8876_KEY_SCAN_DISABLE<<5|RA8876_TFT_OUTPUT24<<3
|RA8876_I2C_MASTER_DISABLE<<2|RA8876_SERIAL_IF_ENABLE<<1|RA8876_HOST_DATA_BUS_8BIT);
}
#endif
...
Don't blame you - think we all know the feeling!I'm getting a little burnt out with this and need to take a break so I'm going to populate @KurtE DB5 shield and fix the DB5 connector,,,
Yep you can say that again!.Don't blame you - think we all know the feeling!
Are these changes up on github? Just wondering as might be interesting to see how the images compare to the other displays.24-Bit color images are now working using writeRect(), pushPixels16bitAsync() and pushPixels16bitDMA(). Examples using writeRect():
Not yet. Still finishing up. I made some more changes and DMA quit working SPI version is going to be really interesting. As it turns out All three libraries have to be changed so that is going to mean three more repo's. Today I will upload what I have for the 8080 parallel version so far for testing. It still is very much unfinishedAre these changes up on github? Just wondering as might be interesting to see how the images compare to the other displays.
No hurry for me, having fun again playing with the GIGA.Not yet. Still finishing up. I made some more changes and DMA quit working SPI version is going to be really interesting. As it turns out All three libraries have to be changed so that is going to mean three more repo's. Today I will upload what I have for the 8080 parallel version so far for testing. It still is very much unfinished
Edit: Just rechecked DMA operation and it is working again. Go figure..
Well my PayPal and bank account got hacked so I will be dealing with that for a bit Sorry...No hurry for me, having fun again playing with the GIGA.