<?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>Possibility to read the current timer value</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115521/possibility-to-read-the-current-timer-value</link><description>Hi 
 
 Is there any way to read the current value of the nPM1300 timer? 
 This would allow to keep track of time while the CPU is not running or rebooting (in the absence of an external RTC) 
 
 Thanks</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Oct 2024 10:04:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115521/possibility-to-read-the-current-timer-value" /><item><title>RE: Possibility to read the current timer value</title><link>https://devzone.nordicsemi.com/thread/506681?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2024 10:04:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ff3baa8-562e-4d82-acca-029450a94e95</guid><dc:creator>dacr</dc:creator><description>&lt;p&gt;I will relay your feedback to the relevant teams.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possibility to read the current timer value</title><link>https://devzone.nordicsemi.com/thread/506680?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2024 10:02:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5243053c-92ed-44a2-98da-17dd220f37ad</guid><dc:creator>mthomas</dc:creator><description>&lt;p&gt;Thanks for the reply&lt;/p&gt;
&lt;p&gt;It would be nice to consider adding this in future releases&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possibility to read the current timer value</title><link>https://devzone.nordicsemi.com/thread/506672?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2024 09:35:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0b94b01-d31f-430d-9d52-c245e4ebb34f</guid><dc:creator>dacr</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There is no possibility to read the current value of the timer.&amp;nbsp;You can only know when the timer expires.&lt;/p&gt;
&lt;p&gt;All the best,&lt;/p&gt;
&lt;p&gt;Dan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possibility to read the current timer value</title><link>https://devzone.nordicsemi.com/thread/506539?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2024 13:37:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf931ae2-088d-46a1-85f1-4d7bd420f485</guid><dc:creator>mthomas</dc:creator><description>&lt;p&gt;Hi, I&amp;#39;ve already tried to read that register.&lt;/p&gt;
&lt;p&gt;The value&amp;nbsp;does not change while the timer is running (at least in General Purpose mode) :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;npmx_timer_t *timer = npmx_timer_get(&amp;amp;m_npmx, 0);
const npmx_timer_config_t timer_cfg = {
    .prescaler = NPMX_TIMER_PRESCALER_SLOW,
    .mode = NPMX_TIMER_MODE_GENERAL_PURPOSE,
    .compare_value = 0xFFFFFF,
};
npmx_timer_config_set(timer, &amp;amp;timer_cfg);
npmx_timer_task_trigger(timer, NPMX_TIMER_TASK_ENABLE);

nrf_delay_ms(100);

uint8_t timer_buffer[3] = {0};
npmx_backend_register_read(m_npmx.p_backend, NPMX_REG_TO_ADDR(NPM_TIMER-&amp;gt;TIMERHIBYTE), timer_buffer, 3);

uint32_t timer_value = (
    (timer_buffer[0] &amp;lt;&amp;lt; 16) |
    (timer_buffer[1] &amp;lt;&amp;lt;  8) |
    (timer_buffer[2] &amp;lt;&amp;lt;  0)
);
NRF_LOG_INFO(&amp;quot;Timer value: 0x%x&amp;quot;, timer_value);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Output is:&amp;nbsp;Timer value: 0xFFFFFF&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Possibility to read the current timer value</title><link>https://devzone.nordicsemi.com/thread/506515?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2024 12:31:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fdf9578-b2c9-45a4-8214-9ac2c8f94390</guid><dc:creator>helsing</dc:creator><description>&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: Sorry, no, this is not possible :) See comment from Dan. &lt;br /&gt;&lt;span style="text-decoration:line-through;"&gt;Yes, you can read the current value of the nPM1300 timer by accessing the TIMERHIBYTE, TIMERMIDBYTE, and TIMERLOBYTE registers. These registers represent the most significant byte, middle byte, and least significant byte of the timer respectively.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:line-through;"&gt;TIMERHIBYTE: Address offset 0x8&lt;/span&gt;&lt;br /&gt;&lt;span style="text-decoration:line-through;"&gt; TIMERMIDBYTE: Address offset 0x9&lt;/span&gt;&lt;br /&gt;&lt;span style="text-decoration:line-through;"&gt; TIMERLOBYTE: Address offset 0xA&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:line-through;"&gt;You will find more details on TIMER in the nPM1300 documentation:&lt;/span&gt;&lt;br /&gt;&lt;span style="text-decoration:line-through;"&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ps_npm1300/page/chapters/core_components/timer/doc/frontpage.html"&gt;https://docs.nordicsemi.com/bundle/ps_npm1300/page/chapters/core_components/timer/doc/frontpage.html&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>