<?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>8.192 MHz clock signal on GPIO pin with nRF Connect SDK 2.3.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/101783/8-192-mhz-clock-signal-on-gpio-pin-with-nrf-connect-sdk-2-3-0</link><description>Dear Support Team, 
 
 What is the best way to create a 8.192 MHz clock signal on a GPIO pin? I would need it for an external ADC. 
 
 
 Thank you very much in advance and all the best, 
 Viktor</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 28 Jul 2023 13:25:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/101783/8-192-mhz-clock-signal-on-gpio-pin-with-nrf-connect-sdk-2-3-0" /><item><title>RE: 8.192 MHz clock signal on GPIO pin with nRF Connect SDK 2.3.0</title><link>https://devzone.nordicsemi.com/thread/438768?ContentTypeID=1</link><pubDate>Fri, 28 Jul 2023 13:25:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd6a3ace-028b-4296-aada-80db0f4bbc76</guid><dc:creator>ViktorVarjas</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;In the meantime I found another solution that achieves 8Mhz (verified externally) and requires no additional lines in the prj.conf and in general is a simpler solution.&lt;/p&gt;
&lt;p&gt;This is the code needed:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void startClock_8MHz(void)
{
	NRF_TIMER1-&amp;gt;PRESCALER = 0; // 16MHz
    NRF_TIMER1-&amp;gt;SHORTS = TIMER_SHORTS_COMPARE0_CLEAR_Msk;
    NRF_TIMER1-&amp;gt;CC[0] = 1;

    NRF_GPIOTE-&amp;gt;CONFIG[0] = GPIOTE_CONFIG_MODE_Task | (2 &amp;lt;&amp;lt; GPIOTE_CONFIG_PSEL_Pos) |
                            (GPIOTE_CONFIG_POLARITY_Toggle &amp;lt;&amp;lt; GPIOTE_CONFIG_POLARITY_Pos);

    /*Connect TIMER event to GPIOTE out task*/
    NRF_PPI-&amp;gt;CH[0].EEP = (uint32_t) &amp;amp;NRF_TIMER1-&amp;gt;EVENTS_COMPARE[0];
    NRF_PPI-&amp;gt;CH[0].TEP = (uint32_t) &amp;amp;NRF_GPIOTE-&amp;gt;TASKS_OUT[0];
    NRF_PPI-&amp;gt;CHENSET   = 1;

    /*Starts clock signal*/
    NRF_TIMER1-&amp;gt;TASKS_START = 1;
}&lt;/pre&gt;To stop the clock:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;NRF_TIMER1-&amp;gt;TASKS_STOP = 1;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;All the best,&lt;/p&gt;
&lt;p&gt;Viktor&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8.192 MHz clock signal on GPIO pin with nRF Connect SDK 2.3.0</title><link>https://devzone.nordicsemi.com/thread/437290?ContentTypeID=1</link><pubDate>Wed, 19 Jul 2023 14:09:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:91b462a0-f891-4b1b-847a-07cb09b0b0f4</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I tested the example and agree, I see that ticks has to minimum be 2 for it to be stable, making 4 MHz the lowest possible.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;#39;m sorry for the confusion,&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8.192 MHz clock signal on GPIO pin with nRF Connect SDK 2.3.0</title><link>https://devzone.nordicsemi.com/thread/437078?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2023 15:30:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c382570-8560-46fb-a1b0-9fcb546d3b8c</guid><dc:creator>ViktorVarjas</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;If I use both at the same time it is not working, but when changing&amp;nbsp;CONFIG_NRFX_TIMER0 to&amp;nbsp;CONFIG_NRFX_TIMER1, it seems to work fine.&lt;/p&gt;
&lt;p&gt;With the 16 Mhz base clock I can only generate 4Mhz clock signal max, when setting the &amp;quot;desired_ticks&amp;quot; to 4. It seems that&amp;nbsp;desired_ticks = 1 is not possible or at least it didn&amp;#39;t work for me (that would generate 8 Mhz)&lt;/p&gt;
&lt;p&gt;Is there any option to modify the starting point project in a way to use a higher frequency (eg.: 32 MHz) base clock?&lt;/p&gt;
&lt;p&gt;All the best,&lt;/p&gt;
&lt;p&gt;Viktor&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8.192 MHz clock signal on GPIO pin with nRF Connect SDK 2.3.0</title><link>https://devzone.nordicsemi.com/thread/436707?ContentTypeID=1</link><pubDate>Mon, 17 Jul 2023 10:47:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74468c9e-0ccf-4572-a905-b3ceeebaf888</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What error message do you get when you try to enable both of them?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8.192 MHz clock signal on GPIO pin with nRF Connect SDK 2.3.0</title><link>https://devzone.nordicsemi.com/thread/436665?ContentTypeID=1</link><pubDate>Mon, 17 Jul 2023 08:40:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96bea2d9-544d-4093-a06b-9d4bb3706f05</guid><dc:creator>ViktorVarjas</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;Is there any way to do it without GPIOTE? The issue is that to use the solution you suggested the gpio module has to be disabled (CONFIG_GPIO=n) otherwise the 2 modules interfere with each other.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;All the best,&lt;/p&gt;
&lt;p&gt;Viktor&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8.192 MHz clock signal on GPIO pin with nRF Connect SDK 2.3.0</title><link>https://devzone.nordicsemi.com/thread/436159?ContentTypeID=1</link><pubDate>Thu, 13 Jul 2023 07:59:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:243cbf03-19e3-4d59-8d83-c8e9cd34a4a5</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can use &lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/tree/master/nrfx/samples/src/nrfx_gppi/one_to_one"&gt;this&lt;/a&gt;&amp;nbsp;example as a starting point,&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8.192 MHz clock signal on GPIO pin with nRF Connect SDK 2.3.0</title><link>https://devzone.nordicsemi.com/thread/436032?ContentTypeID=1</link><pubDate>Wed, 12 Jul 2023 14:51:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b5a5616-43c1-40db-a3a1-cffd1023b1e5</guid><dc:creator>ViktorVarjas</dc:creator><description>&lt;p&gt;Hi Jared,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Could you please provide an example on how to do it?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you in advance,&lt;/p&gt;
&lt;p&gt;Viktor&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 8.192 MHz clock signal on GPIO pin with nRF Connect SDK 2.3.0</title><link>https://devzone.nordicsemi.com/thread/435938?ContentTypeID=1</link><pubDate>Wed, 12 Jul 2023 10:43:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb3ce21e-5219-42c6-9c72-7d610c8f3b96</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;PWM supports up to about 5 MHz, so I think the best alternative would be to use a Timer + PPI + GPIOTE,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>