Hard fault by unaligned memory access at GUI_Init()

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

  • Hard fault by unaligned memory access at GUI_Init()

    Hello,

    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.
    Images
    • gui_init.PNG

      44.08 kB, 497×754, viewed 804 times

    The post was edited 1 time, last by mcubebry ().

  • Hi,

    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 Source Code

    1. MPU_InitStruct.BaseAddress = 0xC0400000;


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

    Regards,
    Sven
    Files
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • 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. :)


    Regards,
    Boram