ILI9341, RGB INTERFACE and emwin

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • ILI9341, RGB INTERFACE and emwin

    Hi there,

    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!

    The post was edited 2 times, last by disideris ().

  • Hi,

    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.

    Regards
    Sven
    Files
    • LCDConf.zip

      (1.84 kB, downloaded 172 times, last: )
  • Hi,

    Thanks a lot for the reply.
    you should you use the GUIDRV_Lin driver
    So i have to use GUIDRV_Lin for driving LPC onbard controller and not GUIDRV_FlexColor for driving ILI9341?


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

    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?

    This is what i am doing so far when not using emwin and LCD works.

    Initialize ili9341 through SPI to obtain RGB interface functionality.
    Initialize lpc onboard lcd controller with the correct timings HSYNC, VSYNC, etc.
    Load framebuffer that points to external sdram an image array.
    Image is dispayed in LCD.

    Can you be more specific about the role that both controllers(onboard and ILI) are playing and what needs to be configured for emwin.

    Thanks a lot!
  • Hi,

    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, ...).

    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.

    Regards
    Sven
  • Hi i followed your suggestion and HardFault exception occurs.

    Here is the trace bottom up.

    HardFault_Handler() at cr_startup_lpc43xx.c:452 0x1a0001fc
    <signal handler called>() at 0xfffffff9
    _RemoveHoles() at 0x1a002a76
    GUI_ALLOC_GetFixedBlock() at 0x1a002d06
    GUI_DEVICE_Create() at 0x1a00210a
    GUI_DEVICE_CreateAndLink() at 0x1a0021f8
    LCD_X_Config() at LCDConf.c:469 0x1a000700
    GUI__Config() at 0x1a00230c
    GUI_Init() at 0x1a00232e
    main() at main.c:116 0x1a000e40


    Is there any sample GuiConf file?


    Below main, LCDConf.c and GUIConf.c are attached
    Files
  • Hi,

    On the first glance the LCDConf.c and GUIConf.c look good. There are only small changes I suggest.

    In LCDConfc.:

    Change DISPLAY_DRIVER to GUIDRV_LIN_16 if you use a color conversion for 16bpp (GUICC_M565).

    In GUIConf.c:

    Delete the function call of GUI_ALLOC_SetAvBlockSize(). This is obsolete.

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

    This is mandatory as stated in the emWin user manual in chapter 38.4.1.1 'API functions to be used in GUI_X_Config()' at the describtion of GUI_ALLOC_AssignMemory().

    Regards
    Sven
  • Already tried ur suggestions but hard fault goes on.

    HardFault_Handler() at cr_startup_lpc43xx.c:452 0x1a0001fc
    <signal handler called>() at 0xfffffff9
    _Alloc() at 0x1a002eda
    _EnlargeBlocks() at 0x1a002c2e
    _InitOnce() at 0x1a002cee
    GUI_ALLOC_GetFixedBlock() at 0x1a002d0a
    GUI_DEVICE_Create() at 0x1a002166
    GUI_DEVICE_CreateAndLink() at 0x1a002254
    LCD_X_Config() at LCDConf.c:364 0x1a00068c
    GUI__Config() at 0x1a002368
  • 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.

    I am not sure what 32bit accessible means though.