<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Date time synchronization fails after nRF Connect SDK and modem firmware update</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75824/date-time-synchronization-fails-after-nrf-connect-sdk-and-modem-firmware-update</link><description>Dear N ordic S upport Team, 
 After I updated the nRF Connect SDK (1.4.0 to 1.5.1) and the Modem firmware (1.2.2 to 1.2.3) on my nrf9160 DK devices, the date time isn&amp;#39;t synchronized anymore. 
 After the modem successfully connects to the LTE network </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 06 Oct 2021 15:28:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75824/date-time-synchronization-fails-after-nrf-connect-sdk-and-modem-firmware-update" /><item><title>RE: Date time synchronization fails after nRF Connect SDK and modem firmware update</title><link>https://devzone.nordicsemi.com/thread/332886?ContentTypeID=1</link><pubDate>Wed, 06 Oct 2021 15:28:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ed3690f-8206-49c4-b873-8eb4e417ba1a</guid><dc:creator>Sebastian Stein</dc:creator><description>&lt;p&gt;It seems likely that the error picture I described was a red herring and that the issue was caused by an unfortunately correlated but not causally connected problem with the network, or my SIM card/subscription. See this &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/80090/date-time-synchronization-fails-after-nrf-connect-sdk-and-modem-firmware-update---yet-again"&gt;Ticket&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Date time synchronization fails after nRF Connect SDK and modem firmware update</title><link>https://devzone.nordicsemi.com/thread/316793?ContentTypeID=1</link><pubDate>Wed, 23 Jun 2021 14:58:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29e0e634-5308-4feb-975c-41108a6c8d92</guid><dc:creator>Hakon</dc:creator><description>[quote user="Sebastian Stein"]However, if Nordic&amp;#39;s devs are curious, I am still willing to help if I can.[/quote]
&lt;p&gt;&amp;nbsp;That&amp;#39;s great, we appreciate the feedback. I&amp;#39;m not sure if there is anything that can be done at this point since neither me or Simen are able to reproduce it, but if you want you can leave the ticket open in case someone else runs into the issue or we are able to reproduce it on our side.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Date time synchronization fails after nRF Connect SDK and modem firmware update</title><link>https://devzone.nordicsemi.com/thread/316159?ContentTypeID=1</link><pubDate>Mon, 21 Jun 2021 06:02:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c963d82c-77f4-4b42-8a63-942b69721180</guid><dc:creator>Sebastian Stein</dc:creator><description>&lt;p&gt;Hi Hakon,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="73166" url="~/f/nordic-q-a/75824/date-time-synchronization-fails-after-nrf-connect-sdk-and-modem-firmware-update/316104#316104"]So is there still an issue, if you can&amp;#39;t reproduce it?[/quote]
&lt;p&gt;In a purely practical sense, there isn&amp;#39;t an issue for me which is stopping me from proceeding with my project.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="73166" url="~/f/nordic-q-a/75824/date-time-synchronization-fails-after-nrf-connect-sdk-and-modem-firmware-update/316104#316104"]Do we need more investigation if the issue is gone?[/quote]
&lt;p&gt;The answer to this question is twofold.&lt;/p&gt;
&lt;p&gt;As I mentioned in my original post, I did know the workaround for the issue since the beginning but I was curious about the cause. Furthermore I figured that my observations could be interesting for Nordic&amp;#39;s developers. I am still curious but you don&amp;#39;t have to investigate further just for me. However, if Nordic&amp;#39;s devs are curious, I am still willing to help if I can.&lt;/p&gt;
&lt;p&gt;Long story short, I am fine with closing this ticket.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Date time synchronization fails after nRF Connect SDK and modem firmware update</title><link>https://devzone.nordicsemi.com/thread/316104?ContentTypeID=1</link><pubDate>Fri, 18 Jun 2021 15:11:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12c14084-e519-49c6-b895-92ec8d9848de</guid><dc:creator>Hakon</dc:creator><description>[quote user="Sebastian Stein"]As with my other device, the date time synchronization seems to work again since then. The consequence is that now, I too don&amp;#39;t have a device any more with which I can reproduce the mentioned behavior.[/quote]
&lt;p&gt;&amp;nbsp;So is there still an issue, if you can&amp;#39;t reproduce it? Do we need more investigation if the issue is gone?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Date time synchronization fails after nRF Connect SDK and modem firmware update</title><link>https://devzone.nordicsemi.com/thread/315271?ContentTypeID=1</link><pubDate>Tue, 15 Jun 2021 05:43:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7614ebbe-7f52-424c-83bf-373b6cbcd430</guid><dc:creator>Sebastian Stein</dc:creator><description>&lt;p&gt;Hi Hakon,&lt;/p&gt;
&lt;p&gt;thanks for taken over.&lt;/p&gt;
&lt;p&gt;Yes, my SIM card is registered and has plenty of data volume left. The date time synchronization did also worked in the past. Only since the two updates, I mentioned in my initial post, seems something&amp;nbsp; to be amiss.&lt;/p&gt;
&lt;p&gt;Since I needed to proceed with my project, I flashed the Asset Tracker v2 sample to the last device which had the issue. As with my other device, the date time synchronization seems to work again since then. The consequence is that now, I too don&amp;#39;t have a device any more with which I can reproduce the mentioned behavior.&lt;/p&gt;
&lt;p&gt;However, I logged the output of the Asset Tracker v2 sample. Like I mentioned in my first post, the first run failed and the second run (after a cold reboot) succeeded. Unfortunately the log file of the second run isn&amp;#39;t compete since I wasn&amp;#39;t fast enough to reconnect my terminal to the device after the reboot.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/assetTracker_5F00_firstRun.log"&gt;devzone.nordicsemi.com/.../assetTracker_5F00_firstRun.log&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/assetTracker_5F00_secondRun.log"&gt;devzone.nordicsemi.com/.../assetTracker_5F00_secondRun.log&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Date time synchronization fails after nRF Connect SDK and modem firmware update</title><link>https://devzone.nordicsemi.com/thread/315108?ContentTypeID=1</link><pubDate>Mon, 14 Jun 2021 11:54:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7148c1c1-24e5-45db-bc47-6aa1c62f8324</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello, I&amp;#39;ll be taking care of this case as Simen has other issues to attend to. I tried to reproduce the issue as well, but it doesn&amp;#39;t run in to any errors. Have you made sure your SIM card is activated on your device?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Date time synchronization fails after nRF Connect SDK and modem firmware update</title><link>https://devzone.nordicsemi.com/thread/313558?ContentTypeID=1</link><pubDate>Fri, 04 Jun 2021 07:26:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3a8a3c9-c24c-4120-a002-163e365d0de2</guid><dc:creator>Sebastian Stein</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;thank you for your examples. I had let them run on my device but at my end they have exactly the same issue in synchronizing the date time. I will attach both log files at the end of this post.&lt;/p&gt;
&lt;p&gt;Note that I edited the second example of yours by printing a message for the DATE_TIME_NOT_OBTAINED &lt;span style="font-family:arial, helvetica, sans-serif;"&gt;event:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void date_time_event_handler(const struct date_time_evt *evt)
{
	switch (evt-&amp;gt;type) {
	case DATE_TIME_OBTAINED_MODEM:
	case DATE_TIME_OBTAINED_NTP:
	case DATE_TIME_OBTAINED_EXT:
		printk(&amp;quot;Date time is obtained\n&amp;quot;);
		k_sem_give(&amp;amp;date_time_sem);
		break;
	case DATE_TIME_NOT_OBTAINED:
		printk(&amp;quot;Date time was NOT obtained&amp;quot;);
	default:
		break;
	}
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;As I mentioned in my initial post, I had the exactly same problem with another device and it was miraculously solved after I flashed the Asset Tracker v2 sample. But I am a little reluctant to do the same thing with this device because then, I will not be able to reproduce the error at hand anymore.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;The log messages seem to indicate that the url of the ntp server cannot be resolved. Does the Asset Tracker v2 sample change some persistent modem settings in this regard?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;Log of first example:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/firstExample.log"&gt;devzone.nordicsemi.com/.../firstExample.log&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;Log of second example (with semaphore):&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/secondExample_5F00_withSemaphore.log"&gt;devzone.nordicsemi.com/.../secondExample_5F00_withSemaphore.log&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Date time synchronization fails after nRF Connect SDK and modem firmware update</title><link>https://devzone.nordicsemi.com/thread/313379?ContentTypeID=1</link><pubDate>Thu, 03 Jun 2021 11:30:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f6efa9d-3ea9-4a15-b5d0-6d3710625c05</guid><dc:creator>simensr</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**
 * @brief Directly called in main.c after initialize is complete
 */
void lmControlProtoApp_run(void) {
    int64_t unixStamp;

    while (true)
    {
        date_time_now(&amp;amp;unixStamp);
        printk(&amp;quot;unix time stamp: %lld\n&amp;quot;, unixStamp);
        k_msleep(1000*5);
    }
}
//=============================================================================

// Interface
//=============================================================================
/**
 * @brief Directly called in main.c
 */
void main(void) {
    int error = 0;

    printk(&amp;quot;Init modem\n&amp;quot;);

    error = lte_lc_psm_req(true);
    printk(&amp;quot;\tlte_lc_psm_req returned: %d\n&amp;quot;, error);

    error = lte_lc_init_and_connect();
    printk(&amp;quot;\tlte_lc_init_and_connect returned: %d\n&amp;quot;, error);

    printk(&amp;quot;Fetch date time\n&amp;quot;);

    error = date_time_update_async(NULL);
    printk(&amp;quot;\tdate_time_update_async returned: %d\n&amp;quot;, error);

    while (!date_time_is_valid()) {
        k_msleep(1000);
    }

    printk(&amp;quot;Init done\n&amp;quot;);

    lmControlProtoApp_run();
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Made a few changes. This works at my end. I can provide an alternative if the code above does not work using the callback handler for the date time library in combination with a semaphore:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static K_SEM_DEFINE(date_time_sem, 0, 1);

static void date_time_event_handler(const struct date_time_evt *evt)
{
	switch (evt-&amp;gt;type) {
	case DATE_TIME_OBTAINED_MODEM:
	case DATE_TIME_OBTAINED_NTP:
	case DATE_TIME_OBTAINED_EXT:
		printk(&amp;quot;Date time is obtained\n&amp;quot;);
		k_sem_give(&amp;amp;date_time_sem);
		break;
	case DATE_TIME_NOT_OBTAINED:
		break;
	default:
		break;
	}
}

/**
 * @brief Directly called in main.c after initialize is complete
 */
void lmControlProtoApp_run(void) {
    int64_t unixStamp;

    while (true)
    {
        date_time_now(&amp;amp;unixStamp);
        printk(&amp;quot;unix time stamp: %lld\n&amp;quot;, unixStamp);
        k_msleep(1000*5);
    }
}
//=============================================================================

// Interface
//=============================================================================
/**
 * @brief Directly called in main.c
 */
void main(void) {
    int error = 0;

    printk(&amp;quot;Init modem\n&amp;quot;);

    error = lte_lc_psm_req(true);
    printk(&amp;quot;\tlte_lc_psm_req returned: %d\n&amp;quot;, error);

    error = lte_lc_init_and_connect();
    printk(&amp;quot;\tlte_lc_init_and_connect returned: %d\n&amp;quot;, error);

    printk(&amp;quot;Fetch date time\n&amp;quot;);

    error = date_time_update_async(date_time_event_handler);
    printk(&amp;quot;\tdate_time_update_async returned: %d\n&amp;quot;, error);

    k_sem_take(&amp;amp;date_time_sem, K_FOREVER);

    printk(&amp;quot;Init done\n&amp;quot;);

    lmControlProtoApp_run();
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Date time synchronization fails after nRF Connect SDK and modem firmware update</title><link>https://devzone.nordicsemi.com/thread/312909?ContentTypeID=1</link><pubDate>Tue, 01 Jun 2021 13:45:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c55c8c5d-6aa6-404c-b06c-dd238493b4a5</guid><dc:creator>Sebastian Stein</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/simensr"&gt;simensr&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;thank you for your response.&lt;/p&gt;
&lt;p&gt;I edited the attached files of my first post. I added the log file dateTimeError.log and a minimal example with which I am able to reproduce the issue. To generate the log messages I have set CONFIG_LOG_DEFAULT_LEVEL=4 and CONFIG_LOG_IMMEDIATE=y.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Date time synchronization fails after nRF Connect SDK and modem firmware update</title><link>https://devzone.nordicsemi.com/thread/312880?ContentTypeID=1</link><pubDate>Tue, 01 Jun 2021 12:27:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1d53ddd-5664-488b-8f57-da62c44f0ea7</guid><dc:creator>simensr</dc:creator><description>&lt;p&gt;Hi @Sebastian Stein. I struggle to identify the exact issue at hand. Could you provide some log output to further support your case? The date time library supports registering a handler that provides callbacks when date time has been obtained (In asset tracker v1 main.c the&amp;nbsp;handler name is &lt;em&gt;date_time_event_handler.&amp;nbsp;&lt;/em&gt;I recommend depending on that with a semaphore in stead of blocking on&amp;nbsp;&lt;em&gt;date_time_is_valid().&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>