RA6M3 2 graphics layers, double framebuffer and emWin

Hi, 

I'm experiencing some isues trying to implement a 2 graphics layers.

I have developed the whole project with 1 graphic layer and 2 framebuffers and with emwin graphical stack (switching between them with "GUI_MULTIBUF_Begin" and "GUI_MULTIBUF_End"). Now I'm trying to implement a second graphic layer. When the projects starts with two layers nothing is displayed on the TFT.

With 1 Graphic layer and 2 framebuffers the memory distributions is as follows:

  • fb_background[0] -> 0x9000 0000
  • fb_background[1] -> 0x9007 F800

The microcontroller displays fb_background[0] and the emWin graphic instructions are visible on TFT.

With 2 graphics layers and 3 framebuffers (2 for the first layer and 1 for the second) the memory distribution is as follows:

  • fb_foreground[0]  -> 0x9000 0000
  • fb_background[0] -> 0x9007 F800
  • fb_background[1] -> 0x900F F000

The microcontroller displays fb_foreground[0]  and the emWin graphic instructions are NOT visible on TFT.

Only if I call to "R_GLCDC_LayerChange(&g_display0_ctrl, &g_display0_cfg, 1);" after GUI_INIT() the emWin instructions draw something on displayed framebuffer.

As you can notice the TFT is a 480x272 pixels, so taking account I'm using 4 channels color codification (A,R,G,B) there's a size used of 522240 bytes (== 0x7F800) per each framebuffer. It makes sense. I'm running this on a custom board. I have an external SDRAM so it is not because of a lack of storage (it is a 32Mb SDRAM).

Does this behavior make sense? Shouldn't it still displaying on TFT the fb_background[0] framebuffer as before? Do you have a project example that switchs between graphic layers and framebuffers succesfully?

Thank you in advance.