STM32w108 delay function with Ember stack
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-12-16 6:09 AM
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- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-12-16 8:07 AM
Break the delay down into digestible pieces, and kick the watch dog, repeat.
Otherwise take it up with the vendor's support contact.Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-12-16 8:23 AM
sorry, I didn't understand what you mean. How can I do it?
there is no function for max delay?!!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-12-16 8:45 AM
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);
}
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-12-16 9:43 AM
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- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-12-16 10:18 AM
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 behalInternalResetWatchDog();
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);
}
Up vote any posts that you find helpful, it shows what's working..
