Hello. I use STemWin_Library_V1.1.2 (on EmWin 5.22). Processor STM32F103, IDE IAR EWARM 6.50. When executed GUI_Init() processor rush out in HardFault_Handler(). I found in debugging mode, what it happened when executed assembler command BLX R1 (R1=0x08004C30), or the memory address on jupm command out of processor FLASH regions. But sometimes in debugging mode GUI_Init() execute, and after GUI work OK. Change project option, stack size, GUI memory not helped. Programm still non-forking. What is the problem may be? Thank you.
STemwin GUI_Init Hard Fault
This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.
-
-
Hello,
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.
Details can be found in the chapter "Configuration" in the emWin user manual.
Best regards,
Adrian -
I explored this and found out that hard fault happen after executed LCD_X_DisplayDriver() inside GUI library STemWin522_CM3_IAR.a.
-
Hello,
The display driver callback function is called with a command. Could you please tell me which one? Please note that implementing this function is user responsibility, so you will have to make sure the function works properly. For details on how to correctly modify the function LCD_X_DisplayDriver(), please refer to the section 32.6 ""Display drivers" -> "Display driver callback function" in the emWin user manual.
Best regards,
Adrian -
int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void * pData) {
int r;
(void) LayerIndex;
(void) pData;
switch (Cmd)
{
case LCD_X_INITCONTROLLER:
{
_InitController();
return 0;
}
default: r = -1;
}
return r;
}
This function called with Cmd=1, executing _InitController(), and routine return r=0. I sure the innitialization of controller done correct.The post was edited 1 time, last by lehacheb ().
-
Hello,
Are the functions LCD_X_Config() and GUI_X_Config() processed properly?
Please note that the function LCD_X_Config() has to create an emWin display driver device and the function GUI_X_Config() needs to assign a sufficient amount of memory to emWin.
Which driver do you use? In case you use GUIDRV_Lin, please make sure not to use the same memory area for both, GUI memory and frame buffer.
Best regards,
Adrian -
#define XSIZE_PHYS 480// Physical display size
#define YSIZE_PHYS 272
#define COLOR_CONVERSION GUICC_M565
#define DISPLAY_DRIVER GUIDRV_FLEXCOLOR
#define DISPLAY_ORIENTATION (0)
void LCD_X_Config(void)
{
GUI_DEVICE * pDevice;
CONFIG_FLEXCOLOR Config = {0};
GUI_PORT_API PortAPI = {0};
pDevice = GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER, COLOR_CONVERSION, 0, 0);// Set display driver and color conversion
LCD_SetSizeEx (0, XSIZE_PHYS , YSIZE_PHYS);// Display driver configuration
LCD_SetVSizeEx(0, VXSIZE_PHYS, VYSIZE_PHYS);
Config.Orientation = DISPLAY_ORIENTATION;// Orientation
GUIDRV_FlexColor_Config(pDevice, &Config);
PortAPI.pfWrite8_A0 = Write_Cmd;//запись команда
PortAPI.pfWrite8_A1 = Write_Data;//запись данные
PortAPI.pfWriteM8_A1 = Write_M_Data;//запись нескольких байт данных
PortAPI.pfReadM8_A1 = Read_M_Data;//чтение нескольких байт данных
GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66720, GUIDRV_FLEXCOLOR_M16C0B8);
}
#include "GUI.h"
#define GUI_NUMBYTES (1024) * 50 // x KByte Define the available number of bytes available for the GUI
U32 static extMem[GUI_NUMBYTES / 4];//32 bit aligned memory area
void GUI_X_Config(void)
{
GUI_ALLOC_AssignMemory(extMem, GUI_NUMBYTES);
GUI_SetDefaultFont(GUI_FONT_8X16);
}
I use GUIDRV_FLEXCOLOR -
Hello,
According to the emWin user manual the function pointer PortAPI.pfRead8_A1 should be set. For details, please refer to section 32.7.4 "Display drivers" -> "Detailed display driver descriptions" -> "GUIDRV_FlexColor".
Best regards,
Adrian -
I added function PortAPI.pfRead8_A1. No changes. In emWin user manual PortAPI.pfRead8_A1 need for GUIDRV_FLEXCOLOR_F66721 (I am GUIDRV_FLEXCOLOR_F66720). By help debugger I find what GUI_Init() not use
function PortAPI.pfRead8_A1. -
Hello,
Please note that the statement is wrong in the emWin user manual. The additional function to implement for the 66721 mode is pfReadXX_A0(). Either way the pfReadXX_A1() needs to be implemented.
The emWin user manual will be corrected accordingly.
Best regards,
Adrian -
Any way, I added function PortAPI.pfRead8_A1, but it not be effectived.
-
Hello,
..., but it not be effectived.
Does that mean the function is not called at all before the hard fault happens?
Best regards,
Adrian -
Yes. I put breakpoint inside PortAPI.pfRead8_A1 function, but HardFault happend before
-
Hello,
I am afraid I do not have further suggestions. I would recommend you to contact ST for support. Maybe they can help you better. From my point of view this problem is not caused directly by emWin.
Best regards,
Adrian -
Ну спасибо конечно!
-
Hello,
I've got the same issue.
I notice that the "Hard Fault" trap disapear if i use only one layer.
I use TFT4.3" and a 16bits external sdram on my board vs the 32bits sdram on the STM32F429i-EVAL.
Do you have more idea to solve our problem ?
Best regards.
Olivier -
Hello Olivier,
Please note that emWin requires memory to be accessible 32-, 16- and 8-bitwise.
Best regards,
Adrian -
Lehacheb, i think you should use functions
PortAPI.pfWrite16_A0 = LcdWriteReg;
PortAPI.pfWrite16_A1 = LcdWriteData;
PortAPI.pfWriteM16_A1 = LcdWriteDataMultiple;
PortAPI.pfReadM16_A1 = LcdReadDataMultiple;
I understand correctly you have 16 bits data bus?The post was edited 1 time, last by pvo125 ().
-
I have 8 bit data bus. Но это вроде бы как неважно, сами-то функции описаны правильно, потому что иногда инициализацию проходит и GUI загружает. Но все равно скинь пожалуйста, посмотрю
-
My functions in file LCDConf.c
static __INLINE void LcdWriteReg(U16 Data) {
// ... TBD by user
LCD_REG_ADDRESS=Data;
}
static __INLINE void LcdWriteData(U16 Data) {
// ... TBD by user
LCD_DATA_ADDRESS=Data;
}
static __INLINE void LcdWriteDataMultiple(U16 * pData, int NumItems) {
while (NumItems--) {
// ... TBD by user
LCD_DATA_ADDRESS = *pData++;
}
}
static __INLINE void LcdReadDataMultiple(U16 * pData, int NumItems) {
while (NumItems--) {
// ... TBD by user
*pData++ = LCD_DATA_ADDRESS;
}
}
void LCD_X_Config(void) {
// U32 TouchOrientation;
GUI_DEVICE * pDevice;
CONFIG_FLEXCOLOR Config = {0};
GUI_PORT_API PortAPI = {0};
//
// Set display driver and color conversion
//
pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR, GUICC_M565, 0, 0);
//
// Display driver configuration, required for Lin-driver
//
LCD_SetSizeEx (0, XSIZE_PHYS , YSIZE_PHYS);
LCD_SetVSizeEx(0, VXSIZE_PHYS, VYSIZE_PHYS);
//
// Display driver configuration, required for Lin-driver
//
Config.Orientation =GUI_MIRROR_Y|GUI_MIRROR_X;
//Config.FirstCOM=0;
//Config.FirstSEG=0;
GUIDRV_FlexColor_Config(pDevice, &Config);
//
// Set controller and operation mode
//
//
GUIDRV_FlexColor_SetReadFunc66720_B16(pDevice, GUIDRV_FLEXCOLOR_READ_FUNC_II); //GUIDRV_FLEXCOLOR_READ_FUNC_II
PortAPI.pfWrite16_A0 = LcdWriteReg;
PortAPI.pfWrite16_A1 = LcdWriteData;
PortAPI.pfWriteM16_A1 = LcdWriteDataMultiple;
PortAPI.pfReadM16_A1 = LcdReadDataMultiple;
GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66720, GUIDRV_FLEXCOLOR_M16C0B16);
}
My version LCD_X_Config not much different from yours. You hardfault happens at what point (LCD_X_Config, LCD_X_DisplayDriver or in the wilds of the library in the disassembler?)The post was edited 1 time, last by pvo125 ().
-
Share
- Facebook 0
- Twitter 0
- Google Plus 0
- Reddit 0