<?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>Measure accuracy of external clock on NRF52840 SoC using zephyr</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/101632/measure-accuracy-of-external-clock-on-nrf52840-soc-using-zephyr</link><description>Hi, 
 I am trying to measure the exact accuracy of a 32MHz external clock connected to my nrf SoC. I would like to know how to access this clock and measure its accuracy through my firmware using zephyr. 
 Thanks for your help. 
 
 Jeff</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Jul 2023 12:40:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/101632/measure-accuracy-of-external-clock-on-nrf52840-soc-using-zephyr" /><item><title>RE: Measure accuracy of external clock on NRF52840 SoC using zephyr</title><link>https://devzone.nordicsemi.com/thread/435731?ContentTypeID=1</link><pubDate>Tue, 11 Jul 2023 12:40:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5d951bf-4342-4d14-9411-7d7a2ccdea74</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If by &amp;quot;external clock connected to my nrf SoC&amp;quot; you mean the crystal oscillator connected to XC1 and XC2 (as shown in the schematic excerpt) then there is functionality in nRF Connect SDK to calibrate the 32 kHz clock signal, but there is no functionality to measure the frequency, no.&lt;/p&gt;
&lt;p&gt;If you have an external signal connected to a GPIO then you may have some luck measuring the length of one clock cycle using the TIMER peripheral, which in theory will give you resolution/accuracy close to the HFCLK (within a couple of HFCLK periods.) One way to do this is described in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/9036/measuring-input-gpio-pin-frequency-with-soft-device-running"&gt;measuring input GPIO pin frequency with soft device running&lt;/a&gt;. While this was for the older nRF5 SDK, the same (low level) approach should be doable also in nRF Connect SDK. Please note that connecting to and measuring clock sources directly will typically affect the clock circuit thus changing the frequency.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>