<?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>nrf5340dk 8hmz clock output to gpio pin example via gpiote/ppi/timer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79755/nrf5340dk-8hmz-clock-output-to-gpio-pin-example-via-gpiote-ppi-timer</link><description>Hello Nordic Devzone, 
 I am currently attempting to generate 8mhz clock output to a gpio pin on the nrf5340dk. I have found previous posts about utilizing the gpiote, timer, and ppi channels to generate such clock output to a gpio pin, but have not found</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 17 Sep 2021 10:03:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79755/nrf5340dk-8hmz-clock-output-to-gpio-pin-example-via-gpiote-ppi-timer" /><item><title>RE: nrf5340dk 8hmz clock output to gpio pin example via gpiote/ppi/timer</title><link>https://devzone.nordicsemi.com/thread/329976?ContentTypeID=1</link><pubDate>Fri, 17 Sep 2021 10:03:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32948146-a698-44d2-9948-0960bea0f780</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There was a couple of enable and the timer mode was incorrect. Here&amp;#39;s a&amp;nbsp;patched&amp;nbsp;version of your sample:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void main(void)
{
	nrfx_gpiote_init(GPIOTE_INTERRUPT_PRIORITY);



	nrfx_err_t err;
	nrfx_gpiote_out_config_t out_config = NRFX_GPIOTE_CONFIG_OUT_TASK_TOGGLE(false);
	err = nrfx_gpiote_out_init(PIN, &amp;amp;out_config);
	if( err != NRFX_SUCCESS )
	{
      printk(&amp;quot;err_code not 0 for nrf_drv_gpiote_in_init&amp;quot;);
    }



	nrfx_timer_config_t timer_cfg = NRFX_TIMER_DEFAULT_CONFIG;
	timer_cfg.mode = NRF_TIMER_MODE_TIMER;
	timer_cfg.bit_width = NRF_TIMER_BIT_WIDTH_32;
	err = nrfx_timer_init(&amp;amp;m_timer, &amp;amp;timer_cfg, NULL);
	ERROR_STATUS_CHECK(err)

    nrfx_timer_extended_compare(&amp;amp;m_timer, NRF_TIMER_CC_CHANNEL0, DIVIDER_COUNT, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, false);    

    uint8_t channel;
    err =  nrfx_dppi_channel_alloc(&amp;amp;channel);
    nrfx_gpiote_pin_t gpiote_mclk_sync_pin_out = PIN;

 	uint32_t gpiote_mclk_toggle_task_addr = nrfx_gpiote_out_task_addr_get(gpiote_mclk_sync_pin_out); 
	uint32_t timer_event_address = nrfx_timer_event_address_get(&amp;amp;m_timer, NRF_TIMER_EVENT_COMPARE0);
	printk(&amp;quot;%x %x\n&amp;quot;, gpiote_mclk_sync_pin_out, timer_event_address);

	nrfx_gppi_channel_endpoints_setup(channel, timer_event_address, gpiote_mclk_toggle_task_addr );
	nrfx_gppi_channels_enable(BIT(channel));
	nrfx_gpiote_out_task_enable(PIN);
	nrfx_timer_enable(&amp;amp;m_timer);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>