<?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>nrf523840 with softdevice and app_timer and hfclk timer -&amp;gt; fault</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70033/nrf523840-with-softdevice-and-app_timer-and-hfclk-timer---fault</link><description>hello Nordic 
 
 i am working with the nrf52840 , sdk 16.0, s140 
 
 i am using the peripheral ble_app_blinky example as a base 
 i added saadc and twi, (spi and uart will be added later) 
 i palne to sample the saadc at high frequency (32kHz) so i need</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 04 Jan 2021 14:03:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70033/nrf523840-with-softdevice-and-app_timer-and-hfclk-timer---fault" /><item><title>RE: nrf523840 with softdevice and app_timer and hfclk timer -&gt; fault</title><link>https://devzone.nordicsemi.com/thread/287272?ContentTypeID=1</link><pubDate>Mon, 04 Jan 2021 14:03:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8272bf6c-fd05-4e7a-8504-9046055dd657</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Ziv,&lt;/p&gt;
[quote user="ziv123"]so instead of using &amp;quot;NRF_TIMER_CC_CHANNEL0&amp;quot; i should be using &amp;quot;NRF_TIMER_CC_CHANNEL1&amp;quot; ?[/quote]
&lt;p&gt;That should not be needed, though it also should not matter.bEach timer have a set of CC channels, so channel 0 on timer 1 has nothing to do with channel 0 on timer 0.&lt;/p&gt;
[quote user="ziv123"]if i understand correct the RTC0 is LFCLK and the TIMER0 is HFCLK ?[/quote]
&lt;p&gt;Yes. The RTCs are clocked by the LFCLK (32.768 kHz) and the timers are clocked by the HF clock (specifically a 16 MHz peripheral clock which is the HF clock divided by 4).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf523840 with softdevice and app_timer and hfclk timer -&gt; fault</title><link>https://devzone.nordicsemi.com/thread/287262?ContentTypeID=1</link><pubDate>Mon, 04 Jan 2021 13:52:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fde26ff7-ecc8-483f-a1e5-1a7fc916cd62</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;great, it seems to compile, soon i will run it and test how it works.. but before, just to be sure ..&amp;nbsp;do i need to change the channel in the timer creation as well:&lt;/p&gt;
&lt;p&gt;so instead of using &amp;quot;NRF_TIMER_CC_CHANNEL0&amp;quot; i should be using &amp;quot;NRF_TIMER_CC_CHANNEL1&amp;quot; ?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrf_drv_timer_extended_compare(&amp;amp;m_timer, NRF_TIMER_CC_CHANNEL0, TICS_FOR_32KHZ, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, false);
    nrf_drv_timer_enable(&amp;amp;m_timer);

// samling event configurations - get handlers address: 
    uint32_t timer_compare_event_addr = nrf_drv_timer_compare_event_address_get(&amp;amp;m_timer, NRF_TIMER_CC_CHANNEL0);
    uint32_t saadc_sample_task_addr   = nrf_drv_saadc_sample_task_get();&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;also,&amp;nbsp;if i understand correct the RTC0 is LFCLK and the TIMER0 is HFCLK ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;best regards&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Ziv&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf523840 with softdevice and app_timer and hfclk timer -&gt; fault</title><link>https://devzone.nordicsemi.com/thread/287257?ContentTypeID=1</link><pubDate>Mon, 04 Jan 2021 13:42:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12aade6c-4a01-4bc9-a1c9-479e19bec574</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Ziv,&lt;/p&gt;
[quote user="ziv123"]well for some reason i thought that the softdevice uses the LFCLK and not the HFCLK (which right now seems less logic with BLE operations)[/quote]
&lt;p&gt;The SoftDevice reserve both RTC0 and TIMER0. Neither can be used by the application.&lt;/p&gt;
[quote user="ziv123"]so what am i defining wrong in the sdk_config.h file or the notorious apply_old_config.h file (which i did not touch yet)[/quote]
&lt;p&gt;You do not need to (nor should you) touch apply_old_config.h, but you need to ensure that you enable TIMER1 properly in sdk_config.h. That would be by setting&amp;nbsp;TIMER1_ENABLED to 1 (with that, apply_old_config.h would automatically set&amp;nbsp;NRFX_TIMER1_ENABLED to 1).&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf523840 with softdevice and app_timer and hfclk timer -&gt; fault</title><link>https://devzone.nordicsemi.com/thread/287251?ContentTypeID=1</link><pubDate>Mon, 04 Jan 2021 13:36:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7a4a9ed-2ec3-4577-837c-341ed6b6a8d4</guid><dc:creator>ziv123</dc:creator><description>&lt;p&gt;hi Einar&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;well for some reason i thought that the softdevice uses the LFCLK and not the HFCLK (which right now seems less logic with BLE operations), but anyway, so i set the instance of the timer i create with 1 instead of 0 and then i get compilation error here (in file nrfx_timer.h) :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/** @brief Macro for creating a timer driver instance. */
#define NRFX_TIMER_INSTANCE(id)                                   \
{                                                                 \
    .p_reg            = NRFX_CONCAT_2(NRF_TIMER, id),             \
    .instance_id      = NRFX_CONCAT_3(NRFX_TIMER, id, _INST_IDX), \
    .cc_channel_count = NRF_TIMER_CC_CHANNEL_COUNT(id),           \
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;saying that :&lt;/p&gt;
&lt;p&gt;&amp;#39;NRFX_TIMER1_INST_IDX&amp;#39; undeclared here (not in a function); did you mean &amp;#39;NRFX_TIMER0_INST_IDX&amp;#39;?&lt;/p&gt;
&lt;p&gt;so what am i defining wrong in the sdk_config.h file or the notorious apply_old_config.h file (which i did not touch yet) &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;hope to read from you soon&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;best regards&lt;/p&gt;
&lt;p&gt;Ziv&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf523840 with softdevice and app_timer and hfclk timer -&gt; fault</title><link>https://devzone.nordicsemi.com/thread/287225?ContentTypeID=1</link><pubDate>Mon, 04 Jan 2021 12:51:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:765d313e-ca8a-4c96-9df4-f728dd8646db</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Ziv,&lt;/p&gt;
&lt;p&gt;As this fails immediately when you initialize the timer I suspect you may be using timer 0? If so, this is expected as that is reserved for the SoftDevice and cannot be used by the application when a SoftDevice is used. You need to use another timer instance in that case.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>