HardFault caused by EDIT_SetText or TEXT_SetText

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

    • HardFault caused by EDIT_SetText or TEXT_SetText

      Hi guys,
      after a long series of test and manual reading I'm not sure what might be the correct updating of a Text or Edit widget through WM.

      My program easily keep updating some value on the screen these come from two I2C sensor interrogation.
      The program work perfectly for some minutes until it stuck and an HardFault appear. It seems a sort of memory overwriting or overflow.

      If I comment the updating of the Edit any stuck happen.

      I attached the code involved in this problem.

      They are the GUIBuilder file and the WM creating file.


      Thank you for your help! :)
      Files
      • File.zip

        (4.16 kB, downloaded 190 times, last: )
    • Hi,

      I tried to reproduce the behavior, but it is running as desired.

      I commented the functions for getting voltage, current and temperature (I don't got them obviously) and replaced them by getting some random values.

      But why are you setting the values of the edit widget this way?

      You could directly call EDIT_SetText() in WM_TIMER and the main loop (while (1)) would do nothing else than calling GUI_Delay().

      How much memory did you spend emWin (GUI_ALLOC_AssignMemory())?

      Did you already checked the function for getting the values?

      Regards,
      Sven
      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.
    • SEGGER - Schoenen wrote:

      Hi,

      I tried to reproduce the behavior, but it is running as desired.

      I commented the functions for getting voltage, current and temperature (I don't got them obviously) and replaced them by getting some random values.

      But why are you setting the values of the edit widget this way?

      You could directly call EDIT_SetText() in WM_TIMER and the main loop (while (1)) would do nothing else than calling GUI_Delay().

      How much memory did you spend emWin (GUI_ALLOC_AssignMemory())?

      Did you already checked the function for getting the values?

      Regards,
      Sven
      Thanks Sven for your test!

      I give you an answer at your question:

      Question 1:
      - I set the values of the edit inside the While loop as a try to solve the problem, but normally, yes I do inside the WM_TIMER. However the problem stay.

      Question 2:
      - The memory allocated through GUI_ALLOC_AssignMemory() is

      Source Code: GUI_Conf.c

      1. //
      2. // Define the available number of bytes available for the GUI
      3. //
      4. #define GUI_NUMBYTES (1024) * 310 // x KByte
      5. /*********************************************************************
      6. *
      7. * Static data
      8. *
      9. **********************************************************************
      10. */
      11. /* 32 bit aligned memory area */
      12. static U32 extMem[GUI_NUMBYTES / 4];
      13. /*********************************************************************
      14. *
      15. * Public code
      16. *
      17. **********************************************************************
      18. */
      19. /*********************************************************************
      20. *
      21. * GUI_X_Config
      22. *
      23. * Purpose:
      24. * Called during the initialization process in order to set up the
      25. * available memory for the GUI.
      26. */
      27. void GUI_X_Config(void)
      28. {
      29. GUI_ALLOC_AssignMemory(extMem, GUI_NUMBYTES);
      30. }
      31. /*************************** End of file ****************************/
      Display All
      Question 3:

      - Yes, the functions that I used for getting the values work fine. Indeed if I keep the function to get the value and I comment the EDIT_SetText the program doesn't stuck.


      I would just remind you that the particularity of this stuck is that happen after some minutes of normally working.

      Anyway I really appreciate your help!

      Thank you again.

      Regards

      Mattia