<?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>How to reset the uptime after a reboot?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/119304/how-to-reset-the-uptime-after-a-reboot</link><description>Hi, 
 Is there a way to reset the uptime after doing a reboot? Rebooting the device by resetting the power does reset the uptime, however we need a way to initiate the reboot using firmware. 
 What we have tried so far: Using sys_reboot(); 
 Putting in</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 24 Apr 2025 20:20:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/119304/how-to-reset-the-uptime-after-a-reboot" /><item><title>RE: How to reset the uptime after a reboot?</title><link>https://devzone.nordicsemi.com/thread/532915?ContentTypeID=1</link><pubDate>Thu, 24 Apr 2025 20:20:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5a14056-7763-4b97-bd55-b3522c5024ca</guid><dc:creator>Nick Ewalt</dc:creator><description>&lt;p&gt;You need to set&amp;nbsp;NRFX_GRTC_CONFIG_CLEAR_AT_INIT. See:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/120970/grtc-is-not-cleared-on-reset-causes-zephyr-sys_clock-to-break-when-uptime-20-hours"&gt;devzone.nordicsemi.com/.../grtc-is-not-cleared-on-reset-causes-zephyr-sys_clock-to-break-when-uptime-20-hours&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reset the uptime after a reboot?</title><link>https://devzone.nordicsemi.com/thread/524809?ContentTypeID=1</link><pubDate>Wed, 26 Feb 2025 12:50:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05de1371-f36b-4fac-a0dc-9ed82cb6b9d8</guid><dc:creator>vesrup</dc:creator><description>&lt;p&gt;Would like to add, that doing the &amp;quot;button&amp;quot; sample and initiating the reboot on the button press, uptime does not in fact reset on the 54l15 DK. It is probably a problem with the 54l15 chip, which we are using on our custom board. Hopefully it will be fixed on the next SDK update.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reset the uptime after a reboot?</title><link>https://devzone.nordicsemi.com/thread/524637?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2025 14:21:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5adb150-b7a4-43c7-9ba8-ca31f43381d7</guid><dc:creator>vesrup</dc:creator><description>&lt;p&gt;As I understand it, yes, this parameter initializes the GRTC.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reset the uptime after a reboot?</title><link>https://devzone.nordicsemi.com/thread/524636?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2025 14:19:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0b6b24b-ff85-422f-a69a-617bcb964543</guid><dc:creator>Jakob Ruhe</dc:creator><description>&lt;p&gt;Good that you found it! I had no idea about this. Is this somehow related to the configuration parameter `CONFIG_NRF_GRTC_START_SYSCOUNTER`?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reset the uptime after a reboot?</title><link>https://devzone.nordicsemi.com/thread/524629?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2025 13:59:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6a6c8bb-4750-421a-904e-44a4fa8886c0</guid><dc:creator>vesrup</dc:creator><description>&lt;p&gt;Managed to fix it by calling&amp;nbsp;&lt;/p&gt;
&lt;div&gt;&lt;span&gt;NRF_GRTC_S&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;TASKS_CLEAR&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;before initiating the reboot.&amp;nbsp;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reset the uptime after a reboot?</title><link>https://devzone.nordicsemi.com/thread/524617?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2025 13:39:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d24d07d2-a6e0-42c7-827b-cb80abd4d50d</guid><dc:creator>vesrup</dc:creator><description>&lt;p&gt;Yes, pulling the reset pin or resetting the power does reset the uptime, however we need a way to do that&amp;nbsp;using firmware, not hardware.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reset the uptime after a reboot?</title><link>https://devzone.nordicsemi.com/thread/524614?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2025 13:31:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b23aea8d-d42e-46b2-bdb8-5f5e78e67990</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi!&lt;br /&gt;&lt;span&gt;A pin reset or a power on reset will reset the GRTC counter.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reset the uptime after a reboot?</title><link>https://devzone.nordicsemi.com/thread/524605?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2025 13:21:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0a32600-df5c-4fe8-bd0b-466cdc63483e</guid><dc:creator>vesrup</dc:creator><description>&lt;p&gt;Thank you for trying to help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reset the uptime after a reboot?</title><link>https://devzone.nordicsemi.com/thread/524600?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2025 13:13:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76b82840-01e2-4a41-95ca-7fbfceda4456</guid><dc:creator>Jakob Ruhe</dc:creator><description>&lt;p&gt;OK. It was a very long shot indeed. I have no more ideas at the moment. I think you need to share more about your board and how you have configured it, in order for others to help you troubleshoot further.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reset the uptime after a reboot?</title><link>https://devzone.nordicsemi.com/thread/524596?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2025 12:59:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d688579-8b13-4e4e-b91c-458b12fa4aad</guid><dc:creator>vesrup</dc:creator><description>&lt;p&gt;First time booting:&amp;nbsp;&lt;/p&gt;
&lt;pre id="output" class="col form-control mb-0"&gt;startup_test: b1: 0, b2: 42&lt;/pre&gt;
&lt;p&gt;Second time booting after calling NVIC_SystemReset():&amp;nbsp;&lt;/p&gt;
&lt;pre id="output" class="col form-control mb-0"&gt;startup_test: b1: 0, b2: 42&lt;/pre&gt;
&lt;p&gt;No change.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reset the uptime after a reboot?</title><link>https://devzone.nordicsemi.com/thread/524591?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2025 12:52:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:842380fb-7201-4b3a-8752-90fc9acaafe9</guid><dc:creator>Jakob Ruhe</dc:creator><description>&lt;p&gt;I see. Strange.&lt;/p&gt;
&lt;p&gt;What output do you get if you call this function twice during each boot?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void startup_test(void)
{
    static int b1;
    static int b2 = 42;
    LOG_INF(&amp;quot;%s: b1: %d, b2: %d&amp;quot;, __func__, b1, b2);
    b1++;
    b2++;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Since I know nothing about how much you have customized for your board I just want to check that the `bss` and `data` sections are initialized correctly by the reset handler. If they are not, you would probably see other, more severe, problems. But it should be quick to test and rule out at least.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reset the uptime after a reboot?</title><link>https://devzone.nordicsemi.com/thread/524586?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2025 12:24:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c3e4597-30f4-4002-a038-1926307a3f8e</guid><dc:creator>vesrup</dc:creator><description>&lt;p&gt;I tried checking k_uptime_get() and its not reset after the reboot.&lt;/p&gt;
&lt;p&gt;Using sys_reboot(); or NVIC_SystemReset(); does perform a reboot. Logs clearly indicate that the device is rebooted, by showing the startup of the bootloader and the startup process of our device, but the uptime is carried over, instead of starting at 0.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Uptime is printed first things first with the logging system:&lt;/p&gt;
&lt;pre id="output" class="col form-control mb-0"&gt;&lt;span style="background-color:#ffff00;color:#000000;"&gt;[00:47:01.025,216]&lt;/span&gt; &amp;lt;dbg&amp;gt; watchdog: primary_feed_worker: Feeding watchdog
&lt;span style="background-color:#ffff00;"&gt;[00:47:31.025,280]&lt;/span&gt; &amp;lt;dbg&amp;gt; watchdog: primary_feed_worker: Feeding watchdog
&lt;span style="background-color:#ffff00;"&gt;[00:48:01.025,344]&lt;/span&gt; &amp;lt;dbg&amp;gt; watchdog: primary_feed_worker: Feeding watchdog&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;I tried reproducing the problem by using the &amp;quot;button&amp;quot; sample. Constantly printing out uptime by using k_uptime_get() and calling NVIC_SystemReset() when the button is pressed, the uptime does reset. I was using the N52832 DK, since it is the only one I had on hand. However, on our device, printing k_uptime_get() on boot and then initiating NVIC_SystemReset() does not reset the uptime.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reset the uptime after a reboot?</title><link>https://devzone.nordicsemi.com/thread/524564?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2025 11:28:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2457d7f9-43b0-4823-ba2e-7abc90854571</guid><dc:creator>Jakob Ruhe</dc:creator><description>&lt;p&gt;The Zephyr function `k_uptime_get()` should return the uptime in milliseconds since boot.&lt;/p&gt;
&lt;p&gt;The function `NVIC_SystemReset()` should perform a reboot. Can you verify that your system actually reboots?&lt;/p&gt;
&lt;p&gt;How do you read the uptime in your system?&lt;/p&gt;
&lt;p&gt;Can you reproduce your problem on a standard development board?&lt;/p&gt;
&lt;p&gt;Can you share a minimum example that makes it possible for others to reproduce your problem?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>