Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

ILI9341, RGB INTERFACE and emwin

From the help i found in this forum i managed to port emwin to my custom pcb with a tft screen with ST7735 controller. The interface i used was SPI.

Thanks a lot. I need some more help.

I am now finalizing the functionality of my custom pcb. I use an LPC4367 microcontroller and a TFT 320x240 with an ILI9341 controller. Pcb has an external sdram of 64mbyte.

All components are working. TFT without emwin is working. The interface that i am using is RGB interface. LPC4367 has its own lcd controller and provides the timings of hsync vsync etc.
ILI9341 which is the onboard TFT LCD module is configured to function under rgb interface. Everything works fine

My final desirable setting is using RGB interface and having emwin on top.

I have tried to port my previous working emwin code of SPI to RGB but i cannot find any information that explains well enough the relation between RGB interface and emwin.

Can I please have some help?

If a discussion opens i am willing to share any specific information about my code and where the problems are.

Thanks a lot in advance!

This post has been edited 2 times, last edit by "disideris" (Oct 10th 2017, 11:03am)

Since you are using the LCD controller of the LPC4367 you should you use the GUIDRV_Lin driver. Also there must be a framebuffer somewhere the on board LCD controller has access to.

Now you need to configure emWin, and the GUIDRV_Lin driver, to access the same framebuffer. In general this should be all.

Attached is a generic LCDConf.c for the GUIDRV_Lin driver. You have to set the proper display size, the address of the framebuffer (#define VRAM_ADDR ...) and the color depth to be used (COLOR_CONVERSION and DISPLAY_DRIVER).

In the function _InitiControler() you initialize the controller and any other display related HW. The other function beginning with an underscore are not entirely necessary.

Quoted

So i have to use GUIDRV_Lin for driving LPC onbard controller and not GUIDRV_FlexColor for driving ILI9341?

Quoted

Also there must be a framebuffer somewhere the on board LCD controller has access to

This is working

Quoted

In the function _InitiControler() you initialize the controller and any other display related HW.

This is the part that might confuse me. InitController must initialize the Lpc onboard lcd controller (which i already have done the initialization) or the ILI9341? As far as i know ILI9341 must be configured in the first place through SPI in order to function with RGB interface.

If i understood, you suggest that ILI9341 does not need to be initialized at all?

Quoted

So i have to use GUIDRV_Lin for driving LPC onbard controller and not GUIDRV_FlexColor for driving ILI9341?

This depends on the mode you are driving the ILI9341 in.
If you use the R-G-B mode the signals (such as HSYNC, pixel clock, R-G-B, etc.) are getting generated by the controller on the LPC4367. In this case you should use GUIDRV_Lin. This driver writes into a framebuffer and according the content of this framebuffer the on board controller of the LPC4367 generates the signals accordingly.

If you are using the MCU mode of the ILI9341 the signals for HSYNC, pixel clock, etc. are getting generated by the ILI9341 itself. In this case you have to send the display data vie a serial interface (like SPI, 8080, ...).

Quoted

This is the part that might confuse me. InitController must initialize
the Lpc onboard lcd controller (which i already have done the
initialization) or the ILI9341? As far as i know ILI9341 must be
configured in the first place through SPI in order to function with RGB
interface.

You are absolutely right, both controllers have to be initialized. Initialize the ILI9341 to work in RGB mode and configure the LPC4367 to generate the signals as the ILI expects them.

- Initialize the ILI9341 to work in RGB mode (via SPI or any other serial interface).

- Initialize the LPC4367 on board controller to generate the proper signals for the ILI.

- The LPC4367 on board controller reads from a framebuffer (most likely placed in external RAM).

- Configure emWin to use GUIDRV_Lin (as shown in the LCDConf.c from my last post).

- When setting up GUIDRV_Lin in LCD_X_Config() 'tell' emWin where the framebuffer is (the same as for the on board controller). To do so use LCD_SetVRAMAddrEx(0, (void *)VRAM_ADDR), where VRAM_ADDR is the address of the framebuffer.

The LPC generates the signals according to the framebuffer content.

If the framebuffer is not initialized with zero you should see 'pixel garbage' if it is 'zeroed' it is black.

When you draw something with emWin it simply writes into the framebuffer (shared with the on board controller) and the LPC4367 controller generates the signals. That's almost all.

Quoted

Is the RAM, where the GUI memory is placed in, 8, 16 and 32 bit wise accessible?

Lpc4367 has an external memory controller (EMC) that is used as interface with the external sdram. Sdram is 16-bit addressable in physical terms.
EMC on top of this can handle memory as we want to. I can write 32bit values with no problem to memory.