<?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>I am using nRF52840 and SDK16 with S140 softdevice. How to generate an interrupt once 128 uS?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58329/i-am-using-nrf52840-and-sdk16-with-s140-softdevice-how-to-generate-an-interrupt-once-128-us</link><description>I want to use a timer to generate a Manchester data. The fastest data rate is 3.906 K-bit. So I want to generate a timer interrupt once 128 uS. Can anyone guide me how to generate it?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 Feb 2020 01:29:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58329/i-am-using-nrf52840-and-sdk16-with-s140-softdevice-how-to-generate-an-interrupt-once-128-us" /><item><title>RE: I am using nRF52840 and SDK16 with S140 softdevice. How to generate an interrupt once 128 uS?</title><link>https://devzone.nordicsemi.com/thread/236670?ContentTypeID=1</link><pubDate>Thu, 27 Feb 2020 01:29:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:044afe61-e9e8-4ddd-84a9-ecb810bdf99c</guid><dc:creator>Ted</dc:creator><description>&lt;p&gt;Thank you very much. I&amp;#39;ll try it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using nRF52840 and SDK16 with S140 softdevice. How to generate an interrupt once 128 uS?</title><link>https://devzone.nordicsemi.com/thread/236447?ContentTypeID=1</link><pubDate>Wed, 26 Feb 2020 09:02:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c602247-cab7-4224-ab7d-c8d642df761d</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Use TIMER1 with the&amp;nbsp;&lt;a title="Timer driver" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrfx__timer.html?cp=7_1_6_9_0_37_1"&gt;Timer driver&lt;/a&gt;, call&amp;nbsp;&lt;a title="nrfx_timer_init" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrfx__timer.html?cp=7_1_6_9_0_37_1_19#ga4ff72f2933ca09b483ebabb9bbd8cdbc"&gt;nrfx_timer_init&lt;/a&gt;&amp;nbsp;to initialize the driver.&lt;br /&gt;&lt;br /&gt;1. Create a timer instance with&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/structnrfx__timer__t.html"&gt;nrfx_timer_t&lt;/a&gt;&lt;span&gt;&amp;nbsp;const timer1 =&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;a title="NRFX_TIMER_INSTANCE" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrfx__timer.html?cp=7_1_6_9_0_37_1_4#gac8cf0e0a9612d6212a1b0bbedc1178be"&gt;NRFX_TIMER_INSTANCE&lt;/a&gt;(1);&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. Create an event handler for your timer with&amp;nbsp;&lt;span&gt;nrfx_timer_event_handler_t timer_evt_handler(&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrf__timer__hal.html#ga6c7c835fd175129175fe2c08237af3c3"&gt;nrf_timer_event_t&lt;/a&gt;&amp;nbsp;event_type, void *p_context){}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;3. C&lt;span&gt;all&amp;nbsp;&lt;/span&gt;&lt;a title="nrfx_timer_init" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrfx__timer.html?cp=7_1_6_9_0_37_1_19#ga4ff72f2933ca09b483ebabb9bbd8cdbc"&gt;nrfx_timer_init&lt;/a&gt;(&amp;amp;&lt;span&gt;timer1&amp;nbsp;,&amp;nbsp;&lt;a title="NRFX_TIMER_DEFAULT_CONFIG" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrfx__timer.html?cp=7_1_6_9_0_37_1_3#gabc69ba0af1dd55ffe0fa1df7b7a23a0d"&gt;NRFX_TIMER_DEFAULT_CONFIG&lt;/a&gt;,&amp;nbsp;timer_evt_handler&lt;/span&gt;)&lt;span&gt;&amp;nbsp;to initialize the driver.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;4.&amp;nbsp;Set up a Compare event at 2048 ticks of the 16MHz TIMER using&amp;nbsp;&lt;a title="nrfx_timer_extended_compare" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrfx__timer.html?cp=7_1_6_9_0_37_1_17#ga2ce27bb2a29a79257932da348a7c79e7"&gt;nrfx_timer_extended_compare&lt;/a&gt;(&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;timer1,&amp;nbsp;&lt;em&gt;NRF_TIMER_CC_CHANNEL0&lt;/em&gt;&amp;nbsp;, 2048,&amp;nbsp;&lt;em&gt;NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK&lt;/em&gt;&amp;nbsp;, true&lt;/span&gt;). This also clears the TIMER in order to create a free-running timer. Use&amp;nbsp;&lt;em&gt;NRF_TIMER_SHORT_COMPARE0_STOP_MASK&lt;/em&gt;&lt;span&gt;&amp;nbsp; for a one-shot timer.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;5. Call&amp;nbsp;&lt;a title="nrfx_timer_enable" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrfx__timer.html?cp=7_1_6_9_0_37_1_15#ga413788edd263406f5a47e82bbe825267"&gt;nrfx_timer_enable&lt;/a&gt;(&amp;amp;timer1) to start the timer.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;timer_evt_handler will then be called every 128µs.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Remember to enable the TIMER1 in sdk_config.h. The SoftDevice has execution priority and can block the application for a few ms, if you need to not get interrupted for a time use the&amp;nbsp;&lt;a title="Timeslot API timing" href="https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/multilink_scheduling/timeslot_api_timing.html?cp=4_5_3_0_14_8"&gt;Timeslot API timing&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;See also the &lt;a title="Timer Example" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/nrf_dev_timer_example.html?cp=7_1_4_6_48"&gt;Timer Example&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>