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