<?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>RTC tick is out by 24hz when set to 1000hz</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48793/rtc-tick-is-out-by-24hz-when-set-to-1000hz</link><description>Hi, 
 I am running NRF52840 on a custom board with SDK 15.0.0, Softdevice S140 6.0.0 and SES. 
 I am measuring using a toggled GPIO pin measured on a CRO. This produces a wave form at 511-512hz - one transition up or down per tick - giving me an external</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 Jun 2019 21:49:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48793/rtc-tick-is-out-by-24hz-when-set-to-1000hz" /><item><title>RE: RTC tick is out by 24hz when set to 1000hz</title><link>https://devzone.nordicsemi.com/thread/193964?ContentTypeID=1</link><pubDate>Thu, 20 Jun 2019 21:49:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe71ebd2-7af3-4005-b1b9-836d409d9fe9</guid><dc:creator>paul</dc:creator><description>&lt;p&gt;Thanks Einar,&lt;/p&gt;
&lt;p&gt;No&amp;nbsp; just reading the documentation:&lt;/p&gt;
&lt;p&gt;&amp;quot;Macro for converting expected frequency to prescaler setting.&amp;quot;&lt;/p&gt;
&lt;p&gt;and expecting that if I put 1000 in I will get 1000 out ;-)=&lt;/p&gt;
&lt;p&gt;Many thanks&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Paul&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTC tick is out by 24hz when set to 1000hz</title><link>https://devzone.nordicsemi.com/thread/193786?ContentTypeID=1</link><pubDate>Thu, 20 Jun 2019 07:01:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94e78c01-a8bc-433d-b07b-39eac9d354df</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This is expected. It seems you have forgotten to consider that you are doing integer arithmetic.&lt;/p&gt;
&lt;p&gt;Details:&lt;/p&gt;
&lt;p&gt;#define RTC_FREQ_TO_PRESCALER(FREQ) (uint16_t)(((RTC_INPUT_FREQ) / (FREQ)) - 1)&lt;/p&gt;
&lt;p&gt;So with the values from your code, the output result from RTC_FREQ_TO_PRESCALER() is floor((32768/1000)-1) = floor(31.768) = &lt;span style="text-decoration:underline;"&gt;31&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Than you find the RTC frequency by this calculation:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;fRTC [Hz] = 32768 / (PRESCALER + 1 ) =&amp;nbsp;32768 / (31 + 1 ) =&amp;nbsp;&lt;span style="text-decoration:underline;"&gt;1024&lt;/span&gt;.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>