GUI_X_RTE osTimer 1ms is too fast and causes OS_ERROR_TIMER_OVF

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

    • GUI_X_RTE osTimer 1ms is too fast and causes OS_ERROR_TIMER_OVF

      Hi

      I'm getting RTX crash, seemingly due to emWin's use of a 1ms osTimer.

      I'm wondering if you have comment/workaround without making my emWin thread the highest priority which may result in other issues. Is there a way of re-defining the emWin core to work on a 10 or 20ms tick rather than the 1ms? I have found that this probably works. I think I can do this by changing GUI_X_RTE and then re-scale my WM_TIMER durations but I wonder if there is a more centralised method?

      Problem is in these circumstances:
      (a) emWin, multiple WM objects with WM_TIMER refresh timers
      (b) MDK RTX v1
      (c) GUI_X_RTE
      (d) MDK USBH MSC (core PriorityAboveNormal)
      (e) single emWin thread, PriorityNormal
      (f) my USB-accessing thread is PriorityNormal (I have tried AboveNormal without success)

      The crash occurs when I insert my USB. Crash sometimes during the mount, mostly during file access. Crash is always OS_ERROR_TIMER_OVF.

      I tried
      (a) removed all instances/uses of osTimer in my source (did not help)
      (b) switched off emWin thread: no fault (ie fixed the fault)
      (b) changed the GUI_X_RTE osTimer to 100ms: seems to work but all my WM_TIMERS run 100-times slower (obviously!)

      Thanks
      Mark
    • Hi,

      The files named GUI_X_<your RTOS>.c offering you an interface to provide emWin with a timebase (GUI_X_GetTime()). How this is implemented is up to you. All such files coming from us are just examples.

      The most important functions to be implemented are GUIX_GetTime() and GUI_X_Delay(). GUI_X_GetTime() should return a time stamp of the current system in milliseconds. For this you can either use the RTOS timing API (something like OS_GetTime()) or you set up a timer which increments a variable each ms.

      GUI_X_Delay() should simply perform a delay for the given period. Easiest way is to use the RTOS functions, obviously.

      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.