Report
4 years, 3 months ago.

set_time() problem togheter with WakeUp timer

I have a function calibrate_time() which gets the time from a seeed gprs shield and uses this to update the time with the time function time_set(). The function works fine when i run it in main and with a ticker for periodic interrupts.

The problem comes along as I want to use the WakeUp library to run the function with periods of one hour. When I use this and attach the calibrate_time function, it runs fine until I try setting the RTC with the set_time() function. The program halts at this point.

Why is this, and how can I fix it? Is the problem linked to the RTC already being used by the WakeUp timer?

Easiest to use <<code>> and <</code>> for your code. In addition so it stops in your calibrate_time function, but what does that one do exactly?

posted by Erik Olieman 21 Apr 2015

The calibrate_time function gets time from a gprs shield and sets the RTC. I have debugged further and it seems that it is the WakeUp timer that is the cause of the problem, which is as I said, that the program stops when it reaches the line in calibrate_time where the RTC is set using time_set. The calibrate_time itself should work as I have tested it without the WakeUp timer and with a ticker.

Are there a timer I can use that maybe don't utilize the RTC? It works when using a ticker, but I need intervals of one hour?

posted by Håkon Bryn 21 Apr 2015

I have updated the question.

posted by Håkon Bryn 21 Apr 2015

Where exactly in that function is it locking up? Preferably you are going to need to post code. Yes WakeUp uses the RTC, but it should co-exist next to your RTC functions. You can try adding a wait function after setting the RTC time (like 1 millisecond). I have noticed before that some STM devices required that, the WakeUp code also has this, but if you set the RTC yourself that is skipped.

Btw since this will fall down and I don't receive mails for comments here I will likely forget about it soon :P. So with continuing issues a forum topic might be handier.

posted by Erik Olieman 22 Apr 2015

Couldn't make a forum topic; page unavailable when i pressed post.

So I made a more specific question with a code example :)

http://developer.mbed.org/questions/7471/set_time-problem-after-WakeUp-interrupt/

posted by Håkon Bryn 22 Apr 2015
Comment on this question
Be the first to answer this question.

You need to log in to post a question