This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem porting emWin for a new graphic controller

Dear Sirs

Has anyone ever ported a new TFT display for emWin in mdk-5 professional?
I am following the emWin 5 user guide with Graphics->Core selected under Manage Run-Time Environment.
Under Display, Interface Template has been chosen for a new low level TFT driver.

In mdk 5 workspace, the LCD_X_Serial.c included as a HAL layer for SPI access.

A new, customerised LCDConf.c is there.

The same driver is working I know, because it does successfully initialize the display, clear screen OK,
turn on pixel OK, ...

The problem is that, whenever GUI_Init() is stepped over, the mcu goes into hardware fault ISR.

The most simple program is attempted.

#include "GUI.h"

void main(void)
{ GUI_Init();
}

I am using a Freescale MK64F as a prototype platform.

Any help or suggestion will be appreciated.

KW John

Parents Reply Children
  • Hi Matthias

    I checked GUIConf.c and tried IRAM1 [0x20000000-0x2002FFFF] & IRAM2[0x1FFF0000-0x1FFFFFFF]
    for Graphics->CORE. Both gave the same result.

    When I step over GUI_Init() in main with F11, HardFault_Handler in startup_MK64F12.s was trapped.

    No clue to the reason...

    John

  • Hi Matthias

    Still no clue to the problem but I think the Linker needs to "know" I am using a Display Interface Template
    LCDConf.c. This file is included in the workspace of course. Inside LCDConf.c I have LCD_X_DisplayDriver() as
    below:

    int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void * pData) { int r;

    switch (Cmd) { case LCD_X_INITCONTROLLER: { myLowLevelReset(); return 0; } case LCD_X_SETVRAMADDR:{}
    ....
    }

    The function myLowLevelReset() is taking care of GPIO init, SPI init, LCD controller init,
    clear the display, and finally switch on backlight.
    It is working outside emWin.

    The question is, how the Linker "know" GUI_Init() should call LCD_X_DisplayDriver() and
    hence myLowLevelReset()?

    Couldn't debug it as F11 is clicked before GUI_Init(), the program just stops at
    HardFault_Handler in startup_MK64F12.s!

    No clue to this problem as emWin is supplied as a library instead of source code.

    John

  • The below discussion may help:

    forum.segger.com/index.php

    SEGGER - Adrian
    Super Moderator

    The function GUI_Init() calls the functions LCD_X_Config(), LCD_X_DisplayDriver() and GUI_X_Config(). Please make sure those functions to not cause the hard fault.