_SetText() cause hardfault.

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

  • _SetText() cause hardfault.

    Hello,
    I am using STemwin but there is nobody in st forum to solve my problem.


    I can init LCD; i can write anything on the screen using GUI_DispString(). I can create button (or checkbox, or some widgets) on anywhere on the screen, but when i try to write anything on the widget (for example BUTTON_SetText(), or for example CHECKBOX_SetText() ), after GUI_Exec() a hard fault occured. I download a lot of example, and i did what they did but the result didnt changed.
    What do you thing about the reason?
    NOTE:
    - LCD driver is RA8875
    - MCU is STM32F427VI (256KByte RAM, 2MByte Flash)
    - FMC is using for communication.
    - External memory device is not using.There is a code which wrote for testing.- Allocated 192KByte ram for emWin.

    - LCD size is normall 800*480 but i tried to make this 150*150.

    C Source Code

    1. static void _DemoButton(void) {
    2. BUTTON_Handle hButton;
    3. GUI_SetFont(&GUI_Font8x16);
    4. GUI_DispStringHCenterAt("Click on button...", 160, 90);
    5. //
    6. // Create the button and set text
    7. //
    8. hButton = BUTTON_CreateEx(110, 110, 100, 40, 0, WM_CF_SHOW,0,1);
    9. BUTTON_SetText(hButton, "Click me..."); //When i remove this line, everything is ok, but when i wrote this line after GUI_Exec() hard fault occured.
    10. }
    11. void EMain(void){
    12. GUI_Init();
    13. GUI_SetBkColor(GUI_RED);
    14. GUI_Clear();
    15. GUI_SetFont(&GUI_Font8x16);
    16. _DemoButton();
    17. GUI_Exec();
    18. while(1){
    19. }
    20. }
    Display All

    The post was edited 4 times, last by ertana ().

  • Hello, i find the reason. RA8875 works different from standard version driver chips. Normally if RS is 0, this means the data is command, if RS is 1, this means the data is data. But RA8875 works reverse of this. So normally emwin uses pfWriteM16_A1 but for RA8875 pfWriteM16_A0 should be used.