This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Using RTC to control the real timestamp

Hi Dev Team,

I had a task to work on that required a timsetamp to schedule a certain event, like for example I wanted my modem to start off every morning at 10:00:00 and switch off at 10:05:00.

What could be the best way to achieve this kind of functionality ?

Regards,

Adeel.

Parents Reply Children
  • Hi Torbjorn,

    I am trying to use the date_time.h library that incorporates SNTP in it. When i try to run it, I get the following errors that I am unable to solve.

     2020-08-20T11_12_42.702Z-log.txt

    Could you let me know the methods to solve this error that I am getting. This is using the date_time.h library.

    Regards,

    Adeel.

  • Hi Adeel

    Looking at the log it appears you are disabling the modem before this issue occurs:

    2020-08-20T11:13:04.559Z DEBUG modem << AT send: AT+CFUN=0

    Can you confirm whether or not this was intentional?

    After disabling the modem you can see that you get detached, and at this point the data connection is lost. 

    Best regards
    Torbjørn

  • Hi Tobjorn,

    Yes, I was trying to turn off my modem for a certain time and then turn it back on later. Even when it is turned back on (AT+CFUN = 1), I still get the same error. 

    2020-08-20T11:13:36.441Z DEBUG modem << AT send: AT+CFUN=1
    2020-08-20T11:13:36.546Z DEBUG modem << AT ret: OK
    2020-08-20T11:13:37.283Z DEBUG modem << [00:01:05.495,147] [1;31m<err> date_time: sntp_query, error: -1[0m
    2020-08-20T11:13:37.294Z DEBUG modem << [00:01:05.503,540] [1;31m<err> date_time: getaddrinfo, error: -11[0m
    2020-08-20T11:13:37.302Z DEBUG modem << [00:01:05.513,458] [1;31m<err> date_time: getaddrinfo, error: -11[0m
    2020-08-20T11:13:37.312Z DEBUG modem << [00:01:05.522,064] [1;31m<err> date_time: getaddrinfo, error: -11[0m
    2020-08-20T11:13:37.319Z DEBUG modem << [00:01:05.530,700] [1;31m<err> date_time: getaddrinfo, error: -11[0m
    2020-08-20T11:13:37.329Z DEBUG modem << [00:01:05.538,482] [1;31m<err> date_time: Not getting time from any NTP server[0m

    Is there any procedure or a way to use the date_time library. Is there any specific example to use that library ?

  • Hi Adeel

    After turning the modem back on it will take some time for it to reconnect to the network. 

    If you wait for the CEREG notification informing you that the modem is connected is the date_time library still reporting errors?

    Best regards
    Torbjørn

  • Hi Tobjorn,

    Unfortunately yes, its still reporting the same error. The CEREG value says the modem is connected but the error still remains. Is there any way or other example where this could have been implemented for a reference ?

    Regards,

    Adeel. 

Related