<?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>MPSL timeslot API stops TIMER10 at IDLE and doesn&amp;#39;t restart it?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/118213/mpsl-timeslot-api-stops-timer10-at-idle-and-doesn-t-restart-it</link><description>I&amp;#39;m porting some code from nRF52832/nRF52840 to nRF54L15 using the MPSL timeslot API. The old code uses MPSL version v2.5.1, the new v2.9.0. 
 The firmware opens a session and then schedules a timeslot. In the end the timeslot handler returns the END</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 07 Feb 2025 08:15:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/118213/mpsl-timeslot-api-stops-timer10-at-idle-and-doesn-t-restart-it" /><item><title>RE: MPSL timeslot API stops TIMER10 at IDLE and doesn't restart it?</title><link>https://devzone.nordicsemi.com/thread/521863?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2025 08:15:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7468307-8093-4264-90bf-c71d8952cfbd</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Sorry for the late reply Sebastian, I do not see anything wrong in the code snippet you provided. Help me reproduce it (give the minimalistic project instead of code snippets) and I can take this to the dev team.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPSL timeslot API stops TIMER10 at IDLE and doesn't restart it?</title><link>https://devzone.nordicsemi.com/thread/521171?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2025 16:28:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:daf182d2-d4da-4dcd-96d7-2045ecdbadcf</guid><dc:creator>SebastianA</dc:creator><description>&lt;p&gt;No, of course we shouldn&amp;#39;t use any of MPSLs resources. I&amp;#39;m just thinking if there is some bug somewhere in our code that causes them to be used anyway which in turn causes the TIMER10 to be stopped since there is no code that can stop the timer on its own in our code.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;We compile our code as application code with security, so GRTC IRQ channel 2 will be used.&lt;/p&gt;
&lt;p&gt;We use GRTC channel 0 to trigger an interrupt with a compare, this is run in thread mode:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define CPU_TIMER_GRTC_CALLBACK_CH       0
#define CPU_TIMER_GRTC_RFTIMER_RAMPUP_CH 1

#define RF_SLOTS_SYNC_10_DPPI            1
#define RF_SLOTS_SYNC_20_DPPI            1
#define RF_SLOTS_SYNC_11_21_PPIB       1
#define RF_TIMER0 NRF_TIMER10
#define RF_TIMER0_IRQn TIMER10_IRQn&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    nrf_grtc_event_disable(NRF_GRTC, ~0);

    nrf_grtc_int_enable(NRF_GRTC,
        (1 &amp;lt;&amp;lt; (GRTC_INTENSET0_COMPARE0_Pos + CPU_TIMER_GRTC_CALLBACK_CH)));

    nrf_grtc_sys_counter_set(NRF_GRTC, true);
    nrf_grtc_clksel_set(NRF_GRTC, NRF_GRTC_CLKSEL_LFXO);
    nrf_grtc_task_trigger(NRF_GRTC, NRF_GRTC_TASK_START);

    nrf_grtc_sys_counter_compare_event_enable(
        NRF_GRTC, CPU_TIMER_GRTC_CALLBACK_CH
    );
    
    nrf_grtc_sys_counter_cc_set(
        NRF_GRTC,
        CPU_TIMER_GRTC_CALLBACK_CH,
        cpu_timer_scheduled_counter
    );
    
    nrf_grtc_event_clear(NRF_GRTC,
        nrf_grtc_sys_counter_compare_event_get(CPU_TIMER_GRTC_CALLBACK_CH));

    NVIC_SetPriority(cpu_peripherials_cfg_grtc_irq,
        cpu_peripherials_cfg_grtc_irq_prio);
    NVIC_ClearPendingIRQ(cpu_peripherials_cfg_grtc_irq);
    NVIC_EnableIRQ(cpu_peripherials_cfg_grtc_irq);

&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;and in the interrupt handler we simply run:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;    NRF_GRTC-&amp;gt;EVENTS_COMPARE[CPU_TIMER_GRTC_CALLBACK_CH] = 0;
    nrf_grtc_sys_counter_cc_set(
        NRF_GRTC,
        CPU_TIMER_GRTC_CALLBACK_CH,
        cpu_timer_scheduled_counter
    );&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;GRTC channel 1 is used to&amp;nbsp; trigger a capture in TIMER10 channel 3, we run this in a timeslot handler:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    nrf_timer_cc_set(RF_TIMER0, NRF_TIMER_CC_CHANNEL3, 0);

    nrf_grtc_publish_set(
        NRF_GRTC,
        nrf_grtc_sys_counter_compare_event_get(CPU_TIMER_GRTC_RFTIMER_RAMPUP_CH),
        RF_SLOTS_SYNC_20_DPPI);
    nrf_timer_subscribe_set(
        RF_TIMER0,
        NRF_TIMER_TASK_CAPTURE3,
        RF_SLOTS_SYNC_10_DPPI);

    nrf_ppib_subscribe_set(NRF_PPIB21,
        nrf_ppib_send_task_get(RF_SLOTS_SYNC_11_21_PPIB),
        RF_SLOTS_SYNC_20_DPPI);
    nrf_ppib_publish_set(NRF_PPIB11,
        nrf_ppib_receive_event_get(RF_SLOTS_SYNC_11_21_PPIB),
        RF_SLOTS_SYNC_10_DPPI);

    nrf_dppi_channels_enable(NRF_DPPIC10, 1 &amp;lt;&amp;lt; RF_SLOTS_SYNC_10_DPPI);
    nrf_dppi_channels_enable(NRF_DPPIC20, 1 &amp;lt;&amp;lt; RF_SLOTS_SYNC_20_DPPI);

    nrf_grtc_sys_counter_cc_add_set(
        NRF_GRTC,
        CPU_TIMER_GRTC_RFTIMER_RAMPUP_CH,
        100,
        NRF_GRTC_CC_ADD_REFERENCE_SYSCOUNTER);

    RF_TIMER0-&amp;gt;TASKS_CAPTURE[2] = 1;
    __DSB();
    uint32_t cc2_time = nrf_timer_cc_get(RF_TIMER0, NRF_TIMER_CC_CHANNEL2);
    nrf_timer_cc_set(RF_TIMER0,
        NRF_TIMER_CC_CHANNEL2,
        cc2_time + RF_SLOTS_CPU_SYNC_INTERVAL + 100);
    
    nrf_timer_event_clear(RF_TIMER0, NRF_TIMER_EVENT_COMPARE2);
    NVIC_ClearPendingIRQ(RF_TIMER0_IRQn);
    nrf_timer_int_enable(RF_TIMER0, TIMER_INTENSET_COMPARE2_Msk);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;When we get the TIMER event in the timeslot handler for channel 2 we run:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    nrf_timer_event_clear(RF_TIMER0, NRF_TIMER_EVENT_COMPARE2);
    
    nrf_ppib_subscribe_clear(NRF_PPIB11,
        nrf_ppib_send_task_get(RF_SLOTS_SYNC_10_DPPI));
    nrf_ppib_subscribe_clear(NRF_PPIB21,
        nrf_ppib_receive_event_get(RF_SLOTS_SYNC_20_DPPI));

    nrf_dppi_channels_disable(NRF_DPPIC10, 1 &amp;lt;&amp;lt; RF_SLOTS_SYNC_10_DPPI);
    nrf_dppi_channels_disable(NRF_DPPIC20, 1 &amp;lt;&amp;lt; RF_SLOTS_SYNC_20_DPPI);

    uint64_t syscounter_time = nrf_grtc_sys_counter_cc_get(
        NRF_GRTC,
        CPU_TIMER_GRTC_RFTIMER_RAMPUP_CH);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPSL timeslot API stops TIMER10 at IDLE and doesn't restart it?</title><link>https://devzone.nordicsemi.com/thread/521089?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2025 11:32:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47bd2879-f1ee-4a82-8e45-bc7b01727923</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="SebastianA"]From what I can see from the include file, only DPPI channel 0 on PD 10 is used by MPSL. If our code triggers it, could that stop the timer?[/quote]
&lt;p&gt;Not sure what you mean by &amp;quot;if your code triggers it&amp;quot;? You should not use any triggers with the resource that MPSL is using.&lt;/p&gt;
[quote user="SebastianA"]We use some one GRTC channel (should only be channel 0) and some TIMER10 capture/compare channels (0-3). Could that cause it to stop?[/quote]
&lt;p&gt;This is possible. Can you show me some snippets on how you are using the GRTC and TIMER10 channels and the exact context in which these registers are touched/configured in your application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPSL timeslot API stops TIMER10 at IDLE and doesn't restart it?</title><link>https://devzone.nordicsemi.com/thread/520524?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2025 09:37:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1447fb90-134c-41a2-9c98-24db65cf5cf2</guid><dc:creator>SebastianA</dc:creator><description>&lt;p&gt;It is on my todo list to reproduce this in a small example.&lt;br /&gt;&lt;br /&gt;From what I can see from the include file, only DPPI channel 0 on PD 10 is used by MPSL. If our code triggers it, could that stop the timer?&lt;br /&gt;&lt;br /&gt;We use some one GRTC channel (should only be channel 0) and some TIMER10 capture/compare channels (0-3). Could that cause it to stop?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPSL timeslot API stops TIMER10 at IDLE and doesn't restart it?</title><link>https://devzone.nordicsemi.com/thread/520521?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2025 09:24:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d6fe610-13d5-4882-91c5-11bff94c390d</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Thanks Hieu for your kind reply.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sebastian, The MPSL developer tried to replicate the issue and &lt;span&gt;TIMER10 was running at the start of the timeslot when the same not closed session id was used. It seems something else is happening in your setup or a corner case we cannot reproduce. Please help us reproduce this. I see that TIMER10 in the code is handled the exact same way as other times with macro magic, but maybe what you are seeing might be a hardware glitch in this timer in some special scenario. Hard to know unless we manage to reproduce it here.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPSL timeslot API stops TIMER10 at IDLE and doesn't restart it?</title><link>https://devzone.nordicsemi.com/thread/519879?ContentTypeID=1</link><pubDate>Thu, 23 Jan 2025 22:03:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4816bfc7-36c0-4821-b707-e4fa987100e7</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi SebastianA,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My apology for the last very short reply. I&amp;nbsp;made a mistake and sent it before finishing all I wanted to do.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Susheel is out of office, and while I am honestly quite new to the topic, I am trying to learn and substitute in for the mean time. I hope you can bear with me.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;While a bare metal example isn&amp;#39;t available, is it possible to use the &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.9.0/samples/mpsl/timeslot/src/main.c"&gt;Timeslot sample&lt;/a&gt; to show the issue?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Could you also see if the sample works correctly for the nRF54L15 on NCS v2.9.0 for you? It works fine for me.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is it possible to check if your timeslot implementation on NCS v2.9.0 works with&amp;nbsp;the nRF52840 or nRF52832?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Hieu&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPSL timeslot API stops TIMER10 at IDLE and doesn't restart it?</title><link>https://devzone.nordicsemi.com/thread/519797?ContentTypeID=1</link><pubDate>Thu, 23 Jan 2025 14:08:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6da3cc43-ffdd-4306-9bfe-d71da37afbb5</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi SebastianA,&lt;/p&gt;
&lt;p&gt;We unfortunately don&amp;#39;t have such bare metal example.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPSL timeslot API stops TIMER10 at IDLE and doesn't restart it?</title><link>https://devzone.nordicsemi.com/thread/519522?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2025 12:06:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3af40d0-b085-4c25-9352-cd21117112b9</guid><dc:creator>SebastianA</dc:creator><description>&lt;p&gt;I don&amp;#39;t have the time to make a proper minimal example right now, but I did add a check at the end of the timeslot handler just before returning the END request to see that the timer is still running. I did that by capturing the time twice with a busy wait between and then checked that the values differed.&lt;/p&gt;
&lt;p&gt;I also added that check when receiving the SESSION_IDLE signal and there the timer has stopped. We don&amp;#39;t run any of our code between those two checks (except the low prio irq calling into mpsl).&lt;br /&gt;&lt;br /&gt;I also checked the whole codebase for TASKS_STOP, SUBSCRIBE_STOP, timer.*short and timer.*stop (case insensitive), we didn&amp;#39;t have any code that could stop any TIMER.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll try to create a small example. Do you have a good bare metal example for gcc to build upon?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPSL timeslot API stops TIMER10 at IDLE and doesn't restart it?</title><link>https://devzone.nordicsemi.com/thread/519507?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2025 11:10:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69ad5ada-9093-4aed-af62-2fbca0c058c7</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Sebastian,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is it possible that you share a minimalistic project to show this? The low level team might ask for reproducing this before they take this seriously as nothing in the code suggests that this should behave differently.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPSL timeslot API stops TIMER10 at IDLE and doesn't restart it?</title><link>https://devzone.nordicsemi.com/thread/519484?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2025 09:23:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd1cbfd7-86a2-43ff-8414-0cbbef1c00af</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;You are right, looking into the source codes TIMER10 of nRF54L should have behaved the same way&amp;nbsp;as the sources treats them the same. I will get some help from the low level teams as the source code shows me they should behave same.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPSL timeslot API stops TIMER10 at IDLE and doesn't restart it?</title><link>https://devzone.nordicsemi.com/thread/519304?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2025 13:14:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b4df74a-22ac-46c4-96a1-ff5bddfd9eaa</guid><dc:creator>SebastianA</dc:creator><description>&lt;p&gt;The documentation about Timeslot -&amp;gt; &amp;quot;Ending a timeslot in time&amp;quot; says; &amp;quot;the application is granted access to the TIMER0 peripheral for the length of the timeslot. This timer is started from zero at the start of the timeslot and is configured to run at 1 MHz&amp;quot;.&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve assumed TIMER10 is used instead of TIMER0 here, but maybe this is only valid for MCUs with TIMER0? TIMER10 is running fine for the first timeslot anyway, just like TIMER0 did for nRF52.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MPSL timeslot API stops TIMER10 at IDLE and doesn't restart it?</title><link>https://devzone.nordicsemi.com/thread/519301?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2025 13:04:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b9e1f41-8975-47f1-97cc-5e9941bd28bf</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I always assumed that you need to reconfigure the timer when you get the start signal, you cannot assume of the initial state of the underlying timer when you get control of it inside the timeslot.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>