<?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>restricted peripheral access</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14718/restricted-peripheral-access</link><description>Hi, 
 I want to access restricted peripheral: TIMER0.
After small research found that I should use sd_ wrappers, in my case sd_nvic_SetPendingIRQ(TIMER0_IRQn) however I got always NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE error.
How can I check if</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 27 Jun 2016 16:26:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14718/restricted-peripheral-access" /><item><title>RE: restricted peripheral access</title><link>https://devzone.nordicsemi.com/thread/56165?ContentTypeID=1</link><pubDate>Mon, 27 Jun 2016 16:26:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:accea916-0d8e-476a-a781-aecf8a8aa6bd</guid><dc:creator>Anders Strand</dc:creator><description>&lt;p&gt;Where is the above code running, and in which context? If you want to update the m_timeslot.in_timeslot variable to indicate is the timeslot is ongoing, you should not do it in the NRF_EVT_RADIO_SESSION_IDLE event.&lt;/p&gt;
&lt;p&gt;This event might appear to your application after the softdevice is active again, because the event is given on a lower priority. You should update the m_timeslot.in_timeslot variable in the callback function for the timeslot.&lt;/p&gt;
&lt;p&gt;Set it to True in NRF_RADIO_CALLBACK_SIGNAL_TYPE_START , and to false in NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0 (i assume that you have started a timer that times out before the timeslot is over).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: restricted peripheral access</title><link>https://devzone.nordicsemi.com/thread/56164?ContentTypeID=1</link><pubDate>Fri, 24 Jun 2016 10:40:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22068063-5a2f-4570-adaf-2835be1ac86d</guid><dc:creator>drk_tg</dc:creator><description>&lt;p&gt;Yes, inside timeslot event there is no sd activity but I don&amp;#39;t known that I&amp;#39;m inside timeslot. I want to call termination procedure from another rtos thread so i must check that softdevice is active at the moment.
So my question is simply: How to check that softDevice is doing something at the moment?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: restricted peripheral access</title><link>https://devzone.nordicsemi.com/thread/56163?ContentTypeID=1</link><pubDate>Fri, 24 Jun 2016 10:16:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9be2b84-1f24-4216-90f6-e241e84c5a64</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;Inside the timeslot event there will be no SoftDevice activity, set up a timer to terminate or extend the timeslot when it runs out of scheduled time. If you do not end the timeslot in time you will hardfault. A simple implementation of this is described in the &lt;a href="https://devzone.nordicsemi.com/tutorials/16/"&gt;timeslot tutorial&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: restricted peripheral access</title><link>https://devzone.nordicsemi.com/thread/56162?ContentTypeID=1</link><pubDate>Fri, 24 Jun 2016 10:03:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae509bc0-b34b-44bb-89d9-efd724597b12</guid><dc:creator>drk_tg</dc:creator><description>&lt;p&gt;I have HFCLK active. My request looks like:&lt;/p&gt;
&lt;p&gt;static nrf_radio_request_t * m_request_earliest(enum NRF_RADIO_PRIORITY priority)
{
m_timeslot.timeslot_request.request_type                = NRF_RADIO_REQ_TYPE_EARLIEST;
m_timeslot.timeslot_request.params.earliest.hfclk       = NRF_RADIO_HFCLK_CFG_XTAL_GUARANTEED;
m_timeslot.timeslot_request.params.earliest.priority    = priority;
m_timeslot.timeslot_request.params.earliest.length_us   = TIMESLOT_LEN_US;
m_timeslot.timeslot_request.params.earliest.timeout_us  = 1000000;
return &amp;amp;m_timeslot.timeslot_request;
}&lt;/p&gt;
&lt;p&gt;Ofcourse I&amp;#39;m returning NRF_RADIO_SIGNAL_CALLBACK_ACTION_END in nrf_radio_signal_callback_return_param_t * m_timeslot_callback, but I must wait for any signal to enter this callback.
To avoid delay I&amp;#39;m calling NVIC_SetPendingIRQ(TIMER0_IRQn); which causes immediate enter to this callback but it&amp;#39;s problematic when softdevice is currently running. So if I good understanding
I must check if soft device is running before call NVIC_SetPendingIRQ(TIMER0_IRQn); How to do that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: restricted peripheral access</title><link>https://devzone.nordicsemi.com/thread/56161?ContentTypeID=1</link><pubDate>Fri, 24 Jun 2016 09:24:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6cdfc122-3aed-4339-8f75-7d8969fec2d3</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;For reference consult the &lt;a href="https://devzone.nordicsemi.com/tutorials/16/"&gt;tutorial&lt;/a&gt; on timeslots and the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.sds/dita/softdevices/s130/concurrent_multiprotocol_tsl_api/tsl_usage_examples.html?cp=2_3_0_0_8_2"&gt;infocenter reference&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After returning NRF_RADIO_SIGNAL_CALLBACK_ACTION_END you will terminate the ongoing timeslot. Which hard fault are you getting?&lt;/p&gt;
&lt;p&gt;You could get issues if you do not requests timeslots specifically with HFCLK active, are you calling&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;m_timeslot_request.params.your_config.hfclk = NRF_RADIO_HFCLK_CFG_XTAL_GUARANTEED;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;as part of your request to ensure that you have guaranteed crystal usage?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: restricted peripheral access</title><link>https://devzone.nordicsemi.com/thread/56160?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2016 14:49:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:134a330f-53ce-473d-ae5c-75b958928e1b</guid><dc:creator>John</dc:creator><description>&lt;p&gt;Unfortunately you have advanced beyond my ability to help. I know of the timeslot feature but I have not used it. Hopefully someone else can address your question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: restricted peripheral access</title><link>https://devzone.nordicsemi.com/thread/56159?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2016 14:43:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7a6d13f-91c7-4dcd-89a3-9a319cfcfe34</guid><dc:creator>drk_tg</dc:creator><description>&lt;p&gt;I have enabled timeslot and my question is related to timeslot.
I want to terminate timeslot so I&amp;#39;m calling:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;timer0_enter_critical();
radio_enter_critical();
//__disable_irq();

// terminate immediately if in timeslot
if(m_timeslot.in_timeslot)// &amp;amp;&amp;amp; __sd_nvic_app_accessible_irq(TIMER0_IRQn)) // start immediately if in timeslot
{
	// set session terminate flag
	m_timeslot.terminate_flag = true;

	// report when session is closed
	m_timeslot.external_session_close_flag = true;

	// stop and clear TIMER0
	NRF_TIMER0-&amp;gt;TASKS_STOP 	 = 1;
	NRF_TIMER0-&amp;gt;TASKS_CLEAR  = 1;

	// disable TIMER0 interrupts
	NRF_TIMER0-&amp;gt;INTENCLR 	 = ((TIMER_INTENSET_COMPARE1_Enabled  &amp;lt;&amp;lt; TIMER_INTENSET_COMPARE1_Pos)  &amp;amp; TIMER_INTENSET_COMPARE1_Msk);
	NRF_TIMER0-&amp;gt;CC[1]    	 = 0;

	// clear and set pending TIMER0 interrupt
	NVIC_ClearPendingIRQ(TIMER0_IRQn);
	NVIC_SetPendingIRQ(TIMER0_IRQn);
}
else
{
	// set session terminate flag
	m_timeslot.terminate_flag = true;

	// report when session is closed
	m_timeslot.external_session_close_flag = true;
}

timer0_exit_critical();
radio_exit_critical();
//__enable_irq();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I&amp;#39;m setting m_timeslot.in_timeslot to true after NRF_RADIO_CALLBACK_SIGNAL_TYPE_START and to false after NRF_EVT_RADIO_SESSION_IDLE&lt;/p&gt;
&lt;p&gt;and in static nrf_radio_signal_callback_return_param_t * m_timeslot_callback(uint8_t signal_type):&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if(m_timeslot.terminate_flag)
{
	//SEGGER_SYSVIEW_Print(&amp;quot;terminate_flag&amp;quot;);
	//SEGGER_RTT_printf(0,&amp;quot;terminate_flag\n&amp;quot;);

	m_timeslot.terminate_flag = false;

	NRF_PPI-&amp;gt;CHENCLR 								   = ((PPI_CHEN_CH8_Enabled &amp;lt;&amp;lt; PPI_CHEN_CH8_Pos) &amp;amp; PPI_CHEN_CH8_Msk);
	signal_callback_return_param.params.request.p_next = NULL;
	signal_callback_return_param.callback_action       = NRF_RADIO_SIGNAL_CALLBACK_ACTION_END;
	m_timeslot.in_timeslot    						   = false;

	return ( &amp;amp;signal_callback_return_param );
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;p&gt;But after some time I&amp;#39;m landing in hard fault handler so I&amp;#39;m guessing that problem is accesing TIMER0 while it&amp;#39;s used by softdevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: restricted peripheral access</title><link>https://devzone.nordicsemi.com/thread/56158?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2016 14:25:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bfd372b3-79fc-4c00-a121-4ac2e219c381</guid><dc:creator>John</dc:creator><description>&lt;p&gt;The Soft Device Specification has a table is section 11 of the peripherals. TIMER0 is not restricted, it is blocked with the caveat that it is accessible using the multi protocol timeslot. So, you cannot access it using the Soft Device without the timeslot feature enabled.&lt;/p&gt;
&lt;p&gt;What is it about TIMER0 that you can&amp;#39;t do with TIMER1 or TIMER2? There may be other alternatives if we know what you are trying to accomplish.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>