Hard fault on LCD_SetPosEx(0, 0, 0)

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

  • Hard fault on LCD_SetPosEx(0, 0, 0)

    Dear Adrian,


    Hello. I am having some problems driving LCD modules using emWin. The program gives a hard fault on LCD_SetPosEx(0, 0, 0) in LCD_Config.c. I know the problem is most likely caused by hardware, but I do not know where to start testing. Would you please tell me what happens inside that function so that I know where to look for the problem?


    Best regards
  • Hello,

    This function should be documented. So first of all thank you for the hint. We will add a description of this function to the emWin user manual.

    Prototype:
    int LCD_SetPosEx(int LayerIndex, int xPos, int yPos);

    Description:
    Sets the position of the given layer.

    Return value:
    0 if the command was successfully processed; 1 if the command was not processed.

    Additional information:
    This function should be called only in case multiple layers have been configured.

    Best regards,
    Adrian
  • Dear Adrian,


    Thanks for your updates.
    As I mentioned in my previous post, all the code before LCD_SetPosEx(0, 0, 0) is executed just fine, but the program does not return from this function and gives me a hard fault. I was wondering if you could tell me what functionality happens inside this function. What could be the hardware problem with LCD? I mean where this function is prone to hard faults.


    Best regards
  • Hello,

    The function LCD_SetPosEx() should be used only in a MultiLayer environment. This function expects an emWin display driver to be configured which supports the display driver command LCD_X_SETPOS. The hard fault therefor may be caused by a NULL pointer.

    As far as I know usage of multiple layers are supported by GUIDRV_Lin, only. So if you do not use this driver, you should not be calling the function LCD_SetPosEx() at all. We will make this clear in the emWin user manual to avoid future misunderstandings.

    Best regards,
    Adrian