Skip to main content
w23
Associate
December 16, 2011
Question

STM32w108 delay function with Ember stack

  • December 16, 2011
  • 5 replies
  • 968 views
Posted on December 16, 2011 at 15:09

hi,

i have a problem with delay time function of the STM32W108 and EmberZnet stack. so I want a delay time of more than 10 seconds. I used the HAL library and especially the function: halCommonDelayMilliseconds();

it was exactly like this: halCommonDelayMilliseconds(10000);

when I put it ON the delay was only for less than 3seconds and the uC make a WDG reset.

can you help me with a function of delay time more than 10 seconds?

thank you so much
    This topic has been closed for replies.

    5 replies

    Tesla DeLorean
    Guru
    December 16, 2011
    Posted on December 16, 2011 at 17:07

    Break the delay down into digestible pieces, and kick the watch dog, repeat.

    Otherwise take it up with the vendor's support contact.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    w23
    w23Author
    Associate
    December 16, 2011
    Posted on December 16, 2011 at 17:23

    sorry, I didn't understand what you mean. How can I do it?

    there is no function for max delay?!!

    Tesla DeLorean
    Guru
    December 16, 2011
    Posted on December 16, 2011 at 17:45

    You'll have to work on the implementation details

    void delaylongms(int delay)
    {
    while(delay > 2500) // 2.5 seconds
    {
    delayms(2500); // watch dog in 3 seconds
    kickwatchdog();
    delay -= 2500;
    }
    if (delay > 0) // consume any remaining delay
    delayms(delay);
    }

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    w23
    w23Author
    Associate
    December 16, 2011
    Posted on December 16, 2011 at 18:43

    thank you so much.

    I found an other solution. It's a function that disable WDG.

    so the code is:

    FUNCTION0();

     halInternalDisableWatchDog(MICRO_DISABLE_WATCH_DOG_KEY);

     halCommonDelayMilliseconds(60000);

     halInternalWatchDogEnabled();

      FUNCTION1();

     

    So in this case, I  do the FUNCTION0(), disable the WDG, delay function then enable WDG and finally FUNCTION1.

    this is the solution for disabling the WDG in STM32W108 with EmberZnet API.

    thanks again

    Tesla DeLorean
    Guru
    December 16, 2011
    Posted on December 16, 2011 at 19:18

    I'm not sure I'd disable it, what if something goes wrong in the background and it never comes back? I think my earlier suggestion is more robust, and works better as a subroutine abstraction than placed in-line.

    The kicking function in your case appears to be

    halInternalResetWatchDog();

    void delaylongms(int delay)
    {
    while(delay > 2500) // 2.5 seconds, use 1 second if more appropriate
    {
    halCommonDelayMilliseconds(2500); // watch dog in 3 seconds
    halInternalResetWatchDog();
    delay -= 2500;
    }
    if (delay > 0) // consume any remaining delay
    halCommonDelayMilliseconds(delay);
    }

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..