<?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>nRF52840: 16 MHz Clock-Out on GPIO Pin</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55428/nrf52840-16-mhz-clock-out-on-gpio-pin</link><description>Can we get a 16MHz clock out over a GPIO pin? We could use this to clock some downstream devices.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 13 Dec 2019 07:36:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55428/nrf52840-16-mhz-clock-out-on-gpio-pin" /><item><title>RE: nRF52840: 16 MHz Clock-Out on GPIO Pin</title><link>https://devzone.nordicsemi.com/thread/225291?ContentTypeID=1</link><pubDate>Fri, 13 Dec 2019 07:36:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c098b300-9a21-4c77-94ae-ec08015205a7</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;No problem. I hope the clock output characteristics meet your requirements.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: 16 MHz Clock-Out on GPIO Pin</title><link>https://devzone.nordicsemi.com/thread/225030?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2019 20:18:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c98d6778-7958-42a7-b869-409439fb4cb5</guid><dc:creator>Mike</dc:creator><description>&lt;p&gt;Thank you, this is extremely helpful. Yes, we will double-check to ensure we don&amp;#39;t use a Radio sensitive pin. I appreciate your very quick response.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: 16 MHz Clock-Out on GPIO Pin</title><link>https://devzone.nordicsemi.com/thread/224864?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2019 09:26:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5310094-8463-4d3a-9a1f-5168deb4af36</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Yes, it should be possible. I made the code below that you can use to test this.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;quot;boards.h&amp;quot;


void gpio_clock_8m(uint32_t pin_number)
{
    
    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 | (pin_number &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;
}

/**
 * @brief Function for application main entry.
 */
int main(void)
{
    
    /*Start HF crystal for improved clock tolerance*/
    NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART = 1;
    while (NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0);


    gpio_clock_8m(27);


    for (;;)
    {
        __WFE();
    }
     
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Also, in case you haven&amp;#39;t noticed, some pins are not recommended for high-frequency I/O operation (may interfere with RADIO). See the &amp;quot;&lt;a title="This section describes the pin assignment and the pin functions." href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/pin.html#pin_assign"&gt;Pin assignments&amp;quot; &lt;/a&gt;section of the PS to see which pins this applies to.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: 16 MHz Clock-Out on GPIO Pin</title><link>https://devzone.nordicsemi.com/thread/224792?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 16:58:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9089051a-3fcd-45d5-bea1-9718de6826b5</guid><dc:creator>Mike</dc:creator><description>&lt;p&gt;Thanks for the quick response. Would it be possible then to get an 8MHz clock out over a GPIO pin? Could you provide some example code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840: 16 MHz Clock-Out on GPIO Pin</title><link>https://devzone.nordicsemi.com/thread/224732?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 12:41:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2fab7c48-c882-4ada-b67b-09628eb136fb</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The GPIO module runs on 16M&amp;nbsp;so the theoretical max. frequency&amp;nbsp;is limited to 8Mhz, unfortunately.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>