RA8876 Parallel Display Library Testing

Picture viewer works... Problem was with my ATP shield, and I screwed up the SDadapter on that one... Swapped to the one that worked.
1720567389372.png
 
I made sure it was 8Bit and did as @mjs513 suggested adding tft.setBusWidth(8). It is only when using RA8876_pictureEmbed thaat the problem starts. Going to go through all of the other examples and if ok hookup a Dev board and try that...
 
@KurtE @mjs513 - Well guess what, you can't really do a software reset until you HAVE CONFIGURED THE DATA BUS!!!!!
Found the problem and it was my oversight. I was doing:
Code:
boolean RA8876_common::ra8876Initialize() {

    RA8876_SW_Reset();  <--------------------------

    // 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
should be commented out for now until I figure out the proper way to use it:
Code:
boolean RA8876_common::ra8876Initialize() {

    //RA8876_SW_Reset();  <-------------------------

    // 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

What is interesting is that it did not affect your machines...
 
Just a quick note, I noticed that pin #7 is also being used for the backlite pin. That conflicts with the WR pin on the MMod and Dev board. Is there a standard pin number defined for Backlite control? Or should I just select a pin that does not conflict. Don't know if DMA mode has been tested yet so I am testing it...
 
Just a quick note, I noticed that pin #7 is also being used for the backlite pin. That conflicts with the WR pin on the MMod and Dev board. Is there a standard pin number defined for Backlite control? Or should I just select a pin that does not conflict. Don't know if DMA mode has been tested yet so I am testing it...
Pretty much can use any pin that does not conflict. I usually just have BL connected to 3.3v or 5v so I dont have to bother with it.

Sounds like you are recovering nicely.
 
@KurtE @mjs513 - I have added DMA to the library and it is working on the MIcroMod. I changed some of the conflicting names that were used for both async and DMA by just adding DMA to the function or variable name like:
Code:
FASTRUN void RA8876_t41_p::FlexIO_Config_DMA_MultiBeat()
which would conflict with:
Code:
FASTRUN void RA8876_t41_p::FlexIO_Config_MultiBeat()
And so on.
Result:
MM_DMA_images.jpg


Code:
 MicroMod Board and RA8876 parallel 8080 mode testing (8Bit/DMA)

FlexIO_Init: D0:40 WR:7 RD:8
Bus speed: 24 MHZ
Bus Width: 8-bits
Wrote 397400 bytes in 21ms

Press anykey to continue
and is very stable and repeatable at 24 MHz. I tried to add in the same additions to the code that @KurtE did. A little more clean up and I will push it up for testing. Right now, need to lay down for a while...
 
I pushed up the the changes for DMA. I added a simple test case for DMA in the testcases folder. Feel free to test if interested.
I am wondering what is the best way to implement it other than using "pushPixels16bitDMA(...);"?
 
Finally have 1.8.19 and 2.3.2 working with variants. After copying the tools folder to "Arduino/hardware" was able to compile and auto upload sketches to the Dev5 board. Finished testing all sketches except "graphicCursor.ino" (requires USBHost_t36 which is not tested yet). All examples are working without issue @600MHz. @KurtE I did the PR. @mjs513 yours as well.
Will download and test.
Thanks...
 
@KurtE @mjs513 - Are you guys working off of "combined_t4x_wip" still? If so line #153 in "RA8876_common.cpp":
Code:
//    RA8876_SW_Reset();
needs to be commented out. It is causing intermittent reset failures :(
 
@KurtE - Should BUS_WIDTH here:
Code:
//**************************************************************//
// RA8876_t41_p()
//**************************************************************//
// Create RA8876 driver instance 8080 IF
//**************************************************************//
#ifndef BUS_WIDTH
#define BUS_WIDTH 8
#endif
RA8876_t41_p::RA8876_t41_p(const uint8_t DCp, const uint8_t CSp, const uint8_t RSTp)
    : _dc(DCp), _cs(CSp), _rst(RSTp),
      _data_pins{DISPLAY_D0, DISPLAY_D1, DISPLAY_D2, DISPLAY_D3, DISPLAY_D4, DISPLAY_D5, DISPLAY_D6, DISPLAY_D7,
#if defined(DISPLAY_D8)
      DISPLAY_D8, DISPLAY_D9, DISPLAY_D10, DISPLAY_D11, DISPLAY_D12, DISPLAY_D13, DISPLAY_D14, DISPLAY_D15},
#else
      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
#endif     
      _wr_pin(DISPLAY_WR), _rd_pin(DISPLAY_RD)
{
    RA8876_GFX(BUS_WIDTH);
}
Be changed to:
Code:
//**************************************************************//
// RA8876_t41_p()
//**************************************************************//
// Create RA8876 driver instance 8080 IF
//**************************************************************//
//#ifndef BUS_WIDTH
//#define BUS_WIDTH 8
//#endif
RA8876_t41_p::RA8876_t41_p(const uint8_t DCp, const uint8_t CSp, const uint8_t RSTp)
    : _dc(DCp), _cs(CSp), _rst(RSTp),
      _data_pins{DISPLAY_D0, DISPLAY_D1, DISPLAY_D2, DISPLAY_D3, DISPLAY_D4, DISPLAY_D5, DISPLAY_D6, DISPLAY_D7,
#if defined(DISPLAY_D8)
      DISPLAY_D8, DISPLAY_D9, DISPLAY_D10, DISPLAY_D11, DISPLAY_D12, DISPLAY_D13, DISPLAY_D14, DISPLAY_D15},
#else
      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
#endif     
      _wr_pin(DISPLAY_WR), _rd_pin(DISPLAY_RD)
{
    RA8876_GFX(_bus_width);
}
?
 
Probably not this case: that is if you look at the constructor for RA8876_GFX
Code:
void RA8876_common::RA8876_GFX(uint16_t buswidth) {
    _width = SCREEN_WIDTH;
    _height = SCREEN_HEIGHT;
    _bus_width = buswidth;
}
I sets _bus_width to what is passed in.
i.e. if we passed in _bus_width
we would be doing: _bus_width = _bus_width;

In the SPI case we hard code and pass in 8....
The current code goes if you have not setup to change your default by setting:
#define BUS_WIDTH 16

It will default to pass in 8...

You can change it be using the: setBusWidth method

Note: I am playing right now of trying to get my T4 stuff from ILI948x stuff to work here. Where internally I set the BUS_WIDTH = 10.
So far nothing is working yet.

EDIT: I also have considered that if you call:
bool setFlexIOPins(uint8_t write_pin, uint8_t rd_pin,
uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
uint8_t d8=0xff, uint8_t d9=0xff, uint8_t d10=0xff, uint8_t d11=0xff,
uint8_t d12=0xff, uint8_t d13=0xff, uint8_t d14=0xff, uint8_t d15=0xff
);

And you pass in all 16 pins to automatically set it to 16 bit mode..
But have not done so yet.
 
Quick note, I did another update of the branch mentioned above. I think I integrated the IRQ code and it might be working.

However there appears like there might not be any current test sketches that calls the functions like:
Code:
lcd.pushPixels16bitAsync(teensy41_Cardlike,10,10,575,424);


Looks like there may be some related new methods for DMA like:
Code:
lcd.pushPixels16bitDMA(teensy41,1,1,480,320);    // FLASHMEM buffer

Wondering if it makes sense to combine into one method, like the pushPixels16bitAsync
where it detects if the FlexIO supports DMA, if so use it, else fallback to the IRQ code
 
Quick note, I did another update of the branch mentioned above. I think I integrated the IRQ code and it might be working.

However there appears like there might not be any current test sketches that calls the functions like:
Code:
lcd.pushPixels16bitAsync(teensy41_Cardlike,10,10,575,424);


Looks like there may be some related new methods for DMA like:
Code:
lcd.pushPixels16bitDMA(teensy41,1,1,480,320);    // FLASHMEM buffer

Wondering if it makes sense to combine into one method, like the pushPixels16bitAsync
where it detects if the FlexIO supports DMA, if so use it, else fallback to the IRQ code
I was wondering the same thing. The only other issue would be 8/16bit bus usage. I think DMA is only setup for 8bit and I am not sure about async...
 
I was wondering the same thing. The only other issue would be 8/16bit bus usage. I think DMA is only setup for 8bit and I am not sure about async...

That is I updated part of your test dma to
Code:
...
lcd.setRotation(0);
  lcd.onCompleteCB(&frame_complete_callback);

}

void frame_complete_callback() {
    Serial.println("\n*** Frame Complete Callback ***");
}

void loop() {
#if 1   
  lcd.fillScreen(BLUE);
  lcd.pushPixels16bitAsync(teensy41_Cardlike,10,10,575,424);
  waitforInput();
  ...

Output on screen.
1720834616190.png

The callback was called

The 16 bit code would be a hybrid of the two parts. The shifter would be setup for 16 bits, the number of bytes transferred per shifter would be the same as 8, but the number of beats would be half that... The IRQ may work using the stuff for 8 bit mode, or might need a little massaging
 
I now have my one Parallel RA8876 moved back to the T4.1
1720888675031.png

I am using Mikes Adapter, with then my Adpater for ILI94xxx plugged into it, with a long RPI stacking header.
With this added adapter I can now patch in signals to D8-D15 of the display to try 16 bit mode.

Note: the new DB5 arrived and so far I can program it with Blink :D Thanks @defragster
 
Testing with Flexio 16 bit... Ran the 8 wires between the two adapters...
1720893617388.png

Most looks good, but the getRect or more likely writeRect ... looks like the colors are off
Look where the color bar between sort of the filled triangle and circle... top part we did using fillrect
and bottom half did a readRect of that and a writeRect of what we read..

But even more pronounced is the stuff below it (left on picture. those areas were done with different forms of writeRect...
 
Back
Top