Thursday, June 29th 2017, 9:21am UTC+2

You are not logged in.

  • Login
  • Register



Date of registration: Jun 16th 2017

Posts: 2


Monday, June 19th 2017, 2:41am

Hard fault by unaligned memory access at GUI_Init()


I'm trying to implement STemWin to STM32F769NI based board.

H/W setting; I'm using external SDRAM as frame buffer with FMC, LTDC, and DSIHOST.

The LCD interface is LVDS; so a bridge chip(TI's SN65DSI83) is used to convert DSI signal into LVDS signal.

At first, the LTDC and DSIHOST is initialized. Then, SN65DSI83 is initialized using I2C.

After that, writing to frame buffer is successfully applied to LCD display.

As you may noticed there isn't any LCD driver initialization step.

So, I've chosen GUIDRV_LIN_32 as display driver and GUICC_M8888 as color conversion in LCDConf.c, originally derived from STM32Cube Fw F7 V.1.7.0, STemWin Hello world project.

In that source file, I've commented every step related to LTDC/DSI initialization and the part related to LCD driver(otm8009A).

Here's the problem: at the GUI_Init() - GUI__Config - LCD_X_Config - GUI_DEVICE_CreateAndLink - GUI_DEVICE_Link.

I can only see the source so I attached debugger's disassembly screen. Hard fault with UNALIGNED bit set in CFSR occurs after that break point at 0x8001e58.

Can you tell me the major suspects of this problem?

Thank you in advance.
mcubebry has attached the following image:
  • gui_init.PNG

This post has been edited 1 times, last edit by "mcubebry" (Jun 19th 2017, 3:06am)

SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 309


Monday, June 19th 2017, 2:02pm


please try to call GUI_BSP_SDRAM_Init() from the BSP_GUI.c (attached) before assigning memory to emWin int GUIConf.c. The following line in BSP_GUI.c might be adapted depending on where the framebuffer is located and where the GUI_RAM (aMemory in GUIConf.c) should be placed.

C/C++ Source code

  MPU_InitStruct.BaseAddress  	= 0xC0400000;

In the case above the frame buffer lays at 0xC0000000 and aMemory at 0xC0400000.

SEGGER - Schoenen has attached the following file:



Date of registration: Jun 16th 2017

Posts: 2


Tuesday, June 20th 2017, 2:55am

Hi, Sven. Thank you for your help.

I've added the code you gave. It was really simple since I've already had SysInit_MPU() function in the original code.

The regions where frame buffer and assigned buffer to emWin are same as your example case. So I changed it, but hard fault still exists, at the same place.

The only difference is that now the BFARVALID and PRECISERR bit is set in CFSR.

I don't understand since the project and frame buffer in the SDRAM works perfectly without GUI_Init().

I assume you suspect this is memory related. Am I right?

If do you have further suggestions other than MPU configuration, I'll be pleased to know that. Thank you. :)