<?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>Achieve non-concurrent switching between ESB/BLE</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/128777/achieve-non-concurrent-switching-between-esb-ble</link><description>Hi: 
 I use ncs3.1.1. 
 BLE and ESB clock conflict now. ESB clock. 
 
 When I default to using ESB 
 
 int main ( void ) 
 { //ESB 
 
 err = clocks_start (); 
 if ( err ) { 
 printk ( &amp;quot;clocks_start failed: %d \n &amp;quot; , err ); 
 return 0 ; 
 } 
...... 
 </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 23 Jul 2026 13:36:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/128777/achieve-non-concurrent-switching-between-esb-ble" /><item><title>RE: Achieve non-concurrent switching between ESB/BLE</title><link>https://devzone.nordicsemi.com/thread/569413?ContentTypeID=1</link><pubDate>Thu, 23 Jul 2026 13:36:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b50e227-58e7-4fc6-a248-33d1db16ba21</guid><dc:creator>john.liu</dc:creator><description>&lt;p&gt;Hi Priyanka:&lt;br /&gt;Thanks for your help!&lt;br /&gt;&lt;span&gt;CONFIG_BT_UNINIT_MPSL_ON_DISABLE&lt;/span&gt;=y is already enabled.&lt;/p&gt;
&lt;p&gt;When I start up, it defaults to ESB mode.&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;static K_SEM_DEFINE(bt_init_sem, 0, 1);

static void bt_ready_cb(int err)
{
    if (err) {
        printk(&amp;quot;bt_enable failed in callback: %d\n&amp;quot;, err);
    }
    /* 通知 main bt_enable 已完成 */
    k_sem_give(&amp;amp;bt_init_sem);
}

int main(void)
{
	int err;
    err = bt_enable(bt_ready_cb);
    if (err) {
        printk(&amp;quot;bt_enable failed: %d\n&amp;quot;, err);
        return 0;
    }
    /* 阻塞等待初始化完成 */
    k_sem_take(&amp;amp;bt_init_sem, K_FOREVER);
    printk(&amp;quot;bt_enable complete\n&amp;quot;);

    err = bt_disable();
    if (err) {
        printk(&amp;quot;bt_disable failed: %d\n&amp;quot;, err);
        return 0;
    }
	k_sleep(K_MSEC(500));
	printk(&amp;quot;k_sleep done\n&amp;quot;);
	err = clocks_start();
	printk(&amp;quot;clocks_start ret: %d\n&amp;quot;, err);
	if (err) {
		 printk(&amp;quot;clocks_start failed: %d\n&amp;quot;, err);
		return 0;
	}
	..........&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span data-slate-fragment="JTVCJTdCJTIydHlwZSUyMiUzQSUyMnBhcmFncmFwaCUyMiUyQyUyMmNoaWxkcmVuJTIyJTNBJTVCJTdCJTIyaWQlMjIlM0ElMjJrMTVhYURERDVkJTIyJTJDJTIycGFyYUlkeCUyMiUzQTAlMkMlMjJzcmMlMjIlM0ElMjJJdCUyMHdpbGwlMjBnZXQlMjBzdHVjayUyMGF0JTIwY2xvY2tzX3N0YXJ0JTIyJTJDJTIyZHN0JTIyJTNBJTIyJUU1JUFFJTgzJUU1JUIwJTg2JUU1JTlDJUE4JUU2JTk3JUI2JUU5JTkyJTlGJUU1JTkwJUFGJUU1JThBJUE4JUU2JTk3JUI2JUU1JThEJUExJUU0JUJEJThGJTIyJTJDJTIybWV0YWRhdGElMjIlM0ElMjIlMjIlMkMlMjJtYXRjaGVzJTIyJTNBbnVsbCUyQyUyMnRyYW5zbGF0ZWRCeSUyMiUzQW51bGwlMkMlMjJtZXRhRGF0YSUyMiUzQSU1QiU1RCUyQyUyMnRleHQlMjIlM0ElMjJJdCUyMHdpbGwlMjBnZXQlMjBzdHVjayUyMGF0JTIwY2xvY2tzX3N0YXJ0JTIyJTdEJTVEJTdEJTVE"&gt;It will get stuck at clocks_start()...&lt;/span&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;static int clocks_start(void)
{
	int err;
	int res;
	struct onoff_manager *clk_mgr;
	struct onoff_client clk_cli;

	clk_mgr = z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF);
	if (!clk_mgr) {
		printk(&amp;quot;Unable to get the Clock manager\n&amp;quot;);
		return -ENXIO;
	}

	sys_notify_init_spinwait(&amp;amp;clk_cli.notify);

	err = onoff_request(clk_mgr, &amp;amp;clk_cli);
	if (err &amp;lt; 0) {
		printk(&amp;quot;Clock request failed: %d&amp;quot;, err);
		return err;
	}

	do {
		err = sys_notify_fetch_result(&amp;amp;clk_cli.notify, &amp;amp;res);
		if (!err &amp;amp;&amp;amp; res) {
			printk(&amp;quot;Clock could not be started: %d\n&amp;quot;, res);
			return res;
		}
	} while (err);

#if NRF54L_ERRATA_20_PRESENT
	if (nrf54l_errata_20()) {
		nrf_power_task_trigger(NRF_POWER, NRF_POWER_TASK_CONSTLAT);
	}
#endif /* NRF54L_ERRATA_20_PRESENT */

#if defined(NRF54LM20A_ENGA_XXAA)
	/* MLTPAN-39 */
	nrf_clock_task_trigger(NRF_CLOCK, NRF_CLOCK_TASK_PLLSTART);
#endif

	printk(&amp;quot;HF clock started\n&amp;quot;);
	return 0;
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Achieve non-concurrent switching between ESB/BLE</title><link>https://devzone.nordicsemi.com/thread/569404?ContentTypeID=1</link><pubDate>Thu, 23 Jul 2026 12:37:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d18816d-0a31-4194-b707-4ebea1538a8d</guid><dc:creator>Priyanka</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The crash&amp;nbsp;might not be caused&amp;nbsp;by k_msgq_put(). That is most likely where the failure becomes visible.&lt;/p&gt;
&lt;p&gt;The MPSL assertion shows that Bluetooth/MPSL and ESB are conflicting over shared resources such as the radio, clock, or interrupts.&lt;/p&gt;
&lt;p&gt;Although you wish to run ESB and Bluetooth non-concurrently, enabling CONFIG_BT=y initializes components that manage these resources. Therefore, the transition between ESB and Bluetooth must fully release one protocol before starting the other. i.e. use only one protocol at a time.&lt;/p&gt;
&lt;p&gt;Please check the following:&lt;/p&gt;
&lt;p&gt;Configure MPSL and ESB to use dynamic interrupts.&lt;br /&gt;Fully stop ESB before starting Bluetooth.&lt;br /&gt;Call bt_disable() before returning to ESB.&lt;br /&gt;Enable CONFIG_BT_UNINIT_MPSL_ON_DISABLE=y so disabling Bluetooth also releases MPSL’s radio-related resources.&lt;br /&gt;Avoid manually controlling clocks or peripherals while MPSL owns them.&lt;/p&gt;
[quote user="john.liu"]But after canceling &lt;span&gt;CONFIG_BT=y&lt;/span&gt;, there&amp;#39;s no problem.[/quote]
&lt;p&gt;when you do this, the Bluetooth controller and its MPSL-related resource management are no longer included or initialized. ESB then has exclusive ownership of the radio, clocks, and interrupts, so the conflict disappears.&lt;/p&gt;
&lt;p&gt;In simple words,&amp;nbsp; without Bluetooth enabled, only ESB is trying to drive the radio;&lt;/p&gt;
&lt;p&gt;with Bluetooth enabled, two different systems believe they control it.&lt;/p&gt;
&lt;p&gt;-Priyanka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Achieve non-concurrent switching between ESB/BLE</title><link>https://devzone.nordicsemi.com/thread/569383?ContentTypeID=1</link><pubDate>Thu, 23 Jul 2026 08:29:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:663a663e-9549-4df3-9290-a4a7915e0e6c</guid><dc:creator>john.liu</dc:creator><description>&lt;p&gt;Hi:&lt;br /&gt;The exact location of the collapse.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;                    struct main_msg msg;
                    msg.type = MAIN_MSG_MOTION;
                    msg.cnt = 1;
                    int err = k_msgq_put(&amp;amp;main_msgq, &amp;amp;msg, K_NO_WAIT);&lt;/pre&gt;&lt;br /&gt;But after canceling &lt;span&gt;CONFIG_BT=y&lt;/span&gt;, there&amp;#39;s no problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>