RA8876 Parallel Display Library Testing

I was in the process of it doing it as well, until the act up with the board yesterday...
I also was changing:
The current Async function I renamed to ....IRQ
And had an Async function which detected if it supported DMA, if so called it, else called IRQ.
Changed the DMA callback function to be the same as the Async callback function...

Was in the process of debugging DMA... the WIP code was in my fork/branch: async16_wip

Will be interesting to see what you changed that I had not yet...
 
@wwatson - @KurtE

Just a heads up testing the GEN5 with the ILI9488 and RA8876 serial mode with @KurtE. Found that we dont need to overclock the SDRAM to get rid of the yellowish. Changed the sketches a bit.

also we found that got an error when using RA8876_t3 - lcdDataRead16 wasnt defined so I added this to common.h to take of it:
Code:
ru16 lcdDataRead16(bool finalize = true) { return 0; };

Changes have been push to the respective branches and now for some soldering since I got Kurt's adapter board this morning
 
I just got back from some errands. @KurtE - I'll take a look at your repo hopefully tonight. @mjs513 - ditto...
It will be interest to play with it again. Looks like your code changes are similar to what I was trying before I removed all of the wires
with the 9 blink problem.

The main difference between ours (versus name changes of other methods was where you did:
Code:
if(_bus_width == 8) {
    MulBeatWR_BeatQty = SHIFTNUM * sizeof(uint32_t) / sizeof(uint8_t);   //Number of beats = number of shifters * beats per shifter
  } else {
    MulBeatWR_BeatQty = SHIFTNUM * sizeof(uint32_t) / sizeof(uint16_t);   //Number of beats = number of shifters * beats per shifter
  }
I did
Code:
// try to setup for 8 or 16 bits...
    uint8_t MulBeatWR_BeatQty = SHIFTNUM * sizeof(uint32_t) / _bus_width;   //Number of beats = number of shifters * beats per shifter
In these cases bus width will either be 8 or 16. There is the case where bus width = 10, but only on T4 and that is only on FlexIO3 which does not
have DMA.

This morning, I should have my adapter boards for current board as well as updated shield boards, which I will hopefully start soldering...
And then can try again.
 
It will be interest to play with it again. Looks like your code changes are similar to what I was trying before I removed all of the wires
with the 9 blink problem.

The main difference between ours (versus name changes of other methods was where you did:
Code:
if(_bus_width == 8) {
    MulBeatWR_BeatQty = SHIFTNUM * sizeof(uint32_t) / sizeof(uint8_t);   //Number of beats = number of shifters * beats per shifter
  } else {
    MulBeatWR_BeatQty = SHIFTNUM * sizeof(uint32_t) / sizeof(uint16_t);   //Number of beats = number of shifters * beats per shifter
  }
I did
Code:
// try to setup for 8 or 16 bits...
    uint8_t MulBeatWR_BeatQty = SHIFTNUM * sizeof(uint32_t) / _bus_width;   //Number of beats = number of shifters * beats per shifter
In these cases bus width will either be 8 or 16. There is the case where bus width = 10, but only on T4 and that is only on FlexIO3 which does not
have DMA.

This morning, I should have my adapter boards for current board as well as updated shield boards, which I will hopefully start soldering...
And then can try again.
That make sense and is much cleaner:D Good luck with the new adapter boards. Plugging in an adapter is a lot quicker than wiring it in...
 
Ok since I did the soldering on @KurtE's adapter to old shield I managed to get it working to a point. There does seem to be issues with DMA so maybe time resynch and try it again: (RVGA) note SVGA works with JPEG.
1721478544666.png


NOTE: we are not using SDRAM speed up anymore. Using 166Mhz which is the default.
 
@wwatson - @KurtE
Was running the FB test case and noticed that the gradient fills was wrong. Traced it drawPixel. Looks like the TeensyRA8876Combined repo doesnt have the drawPixel fix:

Code:
void RA8876_common::drawPixel(ru16 x, ru16 y, ru16 color) {
    graphicMode(true);
    setPixelCursor(x, y);
    ramAccessPrepare();
    if(_bus_width == 16) {
      lcdDataWrite16(color);
    } else {
      lcdDataWrite(color);
      lcdDataWrite(color >> 8);
#if defined(use_lcdDataWrite16bbp)
      lcdDataWrite16bbp(color);
#endif
    }
}

Tested it with the current repo and now its working correctly. Will push the change.

EDIT: @wwatson - just sent you a PR with 2 fixes - drawPixel and the dummy function mentioned earlier
 
Last edited:
Code:
Code:
void RA8876_common::drawPixel(ru16 x, ru16 y, ru16 color) {
    graphicMode(true);
    setPixelCursor(x, y);
    ramAccessPrepare();
    if(_bus_width == 16) {
      lcdDataWrite16(color);
    } else {
      lcdDataWrite(color);
      lcdDataWrite(color >> 8);
#if defined(use_lcdDataWrite16bbp)
      lcdDataWrite16bbp(color);
#endif
    }
}
Wondering if it needs the stuff in the #if defined... clause? as when you are in 8 bit mode, you are then
outputting the data with the two lcdDataWrite calls...
 
Wondering if it needs the stuff in the #if defined... clause? as when you are in 8 bit mode, you are then
outputting the data with the two lcdDataWrite calls...
Good point will have to test since I am using 8bit with the RA8876
 
I had those fixed if I remember right:
Code:
//**************************************************************//
/* Write a 16bpp pixel                                          */
//**************************************************************//
void RA8876_common::drawPixel(ru16 x, ru16 y, ru16 color) {
    graphicMode(true);
    setPixelCursor(x, y);
    ramAccessPrepare();
    lcdDataWrite16(color);
}

which calls:
Code:
//*********************************************************
// Write RA8876 data to display memory, 8/16 bit buss mode.
//*********************************************************
void RA8876_t41_p::lcdDataWrite16(uint16_t data, bool finalize) {
    while (WR_IRQTransferDone == false) {
    } // Wait for any IRQ transfers to complete
    //  while(digitalReadFast(WINT) == 0);  // If monitoring XnWAIT signal from RA8876.

    FlexIO_Config_SnglBeat();

    CSLow();
    DCHigh();

    if (_bus_width == 16) {
        p->SHIFTBUF[0] = data;
        while (0 == (p->SHIFTSTAT & (1 << 0))) {
        }
        while (0 == (p->TIMSTAT & (1 << 0))) {
        }
    } else {
        p->SHIFTBUF[0] = generate_output_word(data >> 8);
        while (0 == (p->SHIFTSTAT & (1 << 0))) {
        }
        p->SHIFTBUF[0] = generate_output_word(data & 0xff);
        while (0 == (p->SHIFTSTAT & (1 << 0))) {
        }
        while (0 == (p->TIMSTAT & (1 << 0))) {
        }
    }
    /* De-assert /CS pin */
    CSHigh();
    DCLow();
}
lcdDataWrite16() takes care of 8/16-bit modes. You might want to double check me;) It is in TeensyRA8876Combined...
 
It is in TeensyRA8876Combined...
Yep:
Code:
    graphicMode(true);
    setPixelCursor(x, y);
    ramAccessPrepare();
    lcdDataWrite16(color);
but it wasn;t working for me when I tested the RA8876 in 8bit parallel, ie, gradient fills colors were off. Think that was why I went that route in the other branch.

This what it was before the change
1721493563758.png



After I made the change - on SPI and Parallel
1721493773261.png


EDIT: Just checked - see this post where I mentioned it: https://forum.pjrc.com/index.php?threads/ra8876-parallel-display-library-testing.75345/post-346438

Too much happening :)
 
Last edited:
@wwatson and @mjs513 - I am not having any luck with the DMA stuff running on the 16 bit bus with the current stuff in
the master branch. Are you having any luck?

If I run it, at 16 bits, it looks like:
1721650851056.png

This is the TestDMA sketch, the T4.1 and MicrMod images were the images that were drawn without using DMA.

The previous version you posted computed the number of Beats, I mentioned I did something similar, by using the _bus_width...

The main difference between ours (versus name changes of other methods was where you did:
Code:
if(_bus_width == 8) {
MulBeatWR_BeatQty = SHIFTNUM * sizeof(uint32_t) / sizeof(uint8_t); //Number of beats = number of shifters * beats per shifter
} else {
MulBeatWR_BeatQty = SHIFTNUM * sizeof(uint32_t) / sizeof(uint16_t); //Number of beats = number of shifters * beats per shifter
}
I did
Code:
// try to setup for 8 or 16 bits...
uint8_t MulBeatWR_BeatQty = SHIFTNUM * sizeof(uint32_t) / _bus_width; //Number of beats = number of shifters * beats per shifter
In these cases bus width will either be 8 or 16. There is the case where bus width = 10, but only on T4 and that is only on FlexIO3 which does not
have DMA.

But looking at the current stuff, I am getting confused:
Code:
uint8_t MulBeatWR_BeatQty = SHIFTNUM * sizeof(uint32_t) / _bus_width * 8;   //Number of beats = number of shifters * beats per shifter

It appears like the DMA worked at 8 bit mode at 20mhz...

Will continue playing...
 
@KurtE - This did not work correctly:
Code:
// try to setup for 8 or 16 bits...
    uint8_t MulBeatWR_BeatQty = SHIFTNUM * sizeof(uint32_t) / _bus_width;   //Number of beats = number of shifters * beats per shifter
I had to multiply the result by 8 to get the needed 32 or 16 otherwise the result is 4 and 2:
Code:
// try to setup for 8 or 16 bits...
    uint8_t MulBeatWR_BeatQty = SHIFTNUM * sizeof(uint32_t) / _bus_width * 8;   //Number of beats = number of shifters * beats per shifter
I'll push up the changes...

Edit: Not sure if I posted this a couple of days ago:unsure:
 
@wwatson and @mjs513 - I am not having any luck with the DMA stuff running on the 16 bit bus with the current stuff in
the master branch. Are you having any luck?

If I run it, at 16 bits, it looks like:
View attachment 35180
This is the TestDMA sketch, the T4.1 and MicrMod images were the images that were drawn without using DMA.

The previous version you posted computed the number of Beats, I mentioned I did something similar, by using the _bus_width...



But looking at the current stuff, I am getting confused:
Code:
uint8_t MulBeatWR_BeatQty = SHIFTNUM * sizeof(uint32_t) / _bus_width * 8;   //Number of beats = number of shifters * beats per shifter

It appears like the DMA worked at 8 bit mode at 20mhz...

Will continue playing...
I will check here. I have been playing with the async_wip branch. Hopefully I did not mess up and push up changes for that...
 
@KurtE @mjs513 - Well I think things are back to what they were before. My last backup was 7/20 so that's the one I used. Then I went through this thread to try and make sure all of the updates were present in the library. Went through all of the examples using both 8-bit and 16-bit modes. Everything appears to be working except 16-bit async which is where we left off. I am not going to try and push it up tonight. I'll do it tomorrow when I am fresh. Then you guys can test it if have a chance. TIme for:sleep:
 
@KurtE - @watson

Think there may be an issue with using DMA for the camera and CSI at the same time.

Modifying one of our test sketches that uses both the 5640 and the RA8876 (OV2640_display_RA8876) to use pushPixels16bitDMA instead of writeRect found the issue.

If I use any of the command options 'f' or 'M' that uses DMA it hangs the board and I have to cycle power or hit the PGM again. Also it seems if I use the 'm' command it runs but then after I stop it bang - hangs the board. Note no crashe.
 
Well I finally got 16-bit async mode working on the DB5 and RA8876. Here is a a picture of both DMA and async IRQ working together:
DMA_ASYNC_8bit_16Bit.jpg

The image in the lower right is 16-bit async. The image in the upper left is 16-bit DMA as well. There does not seem to be any conflict between them. 8-bit mode works the same except 8-bit mode is about half as fast as 16-bit mode.
16-bit mode:
Code:
 DB5 board and RA8876 parallel 8080 mode testing (8-Bit/16-bit,DMA/ASYNC)

Bus speed: 12 MHZ
Bus Width: 16-bits
Wrote 243800 bytes in 12941us

Press anykey to continue
And 8-bit mode:
Code:
 DB5 board and RA8876 parallel 8080 mode testing (8-Bit/16-bit,DMA/ASYNC)

Bus speed: 12 MHZ
Bus Width: 8-bits
Wrote 243800 bytes in 25737us

Press anykey to continue
I cannot get DMA or async to go any higher then 12MHz in 16-bit mode. The only file I modified was RA8876_t41_p.cpp pertaining to FlexIO IRQ. I pushed up the changed file and added a test sketch to the testcases folder if you want to test.
Again, this is good learning to try and understand FlexIO. Now to setup my RA8876 SPI display and do some more testing :D
 
@mjs513 the p#1 links to an older WIP github not the last that seems to be the current work?:
Is there a post in these 10 pages that would show the wiring needed for the RA8876? That would be nice in p#1 too.
Suppose I can wait at this point for the updated board from @KurtE and just set up SPI for now if I get anxious - and free time.

Think there may be an issue with using DMA for the camera and CSI at the same time.
Doesn't seem surprising - is that DB5 with SDRAM too?
Wonder if it is still ticking and just stuck - probably stuck - if TyComm was in use the Reset or Bootloader would trigger?
Trying to recall what it was I put in an 'am I alive' indicator - seems that was in a USB_Host project? MTP? - an interrupt doing something?
 
Back
Top