<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-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>Bluetooth and threading with Zephyr</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/83689/bluetooth-and-threading-with-zephyr</link><description>Hey, I&amp;#39;m trying to integrate BT + DFU functionality into my application, i&amp;#39;m following this example: Add DFU support to your application - Software - nRF Connect SDK guides - Nordic DevZone (nordicsemi.com) 
 
 Everything is working fine, I can see device</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Wed, 02 Feb 2022 15:10:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/83689/bluetooth-and-threading-with-zephyr" /><item><title>RE: Bluetooth and threading with Zephyr</title><link>https://test-devzone.nordicsemi.com/thread/350926?ContentTypeID=1</link><pubDate>Wed, 02 Feb 2022 15:10:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:288fe4a5-ee0b-4dfe-b74a-7e60415d6191</guid><dc:creator>user112245</dc:creator><description>&lt;p&gt;I tried with example app from nordic and it works with assertion turned off.&lt;br /&gt;I will try to collect more logs or maybe we will rise private tickets.&lt;/p&gt;
&lt;p&gt;But I also have new idea now - is it possible that&amp;nbsp;cause of BT working not properly is that we &lt;strong&gt;totally removed zephyr console&lt;/strong&gt; from our project?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth and threading with Zephyr</title><link>https://test-devzone.nordicsemi.com/thread/350334?ContentTypeID=1</link><pubDate>Sun, 30 Jan 2022 16:38:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9b7b64d-8dac-48d2-8931-fb1cbc4ce1c3</guid><dc:creator>user72692</dc:creator><description>&lt;p&gt;If your code is confidential, I can make this ticket private, so only the support engineers here at Nordic has access to the content.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try to enable some more logging? Set these and reproduce the failing state&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_LOG=y
CONFIG_BT_DEBUG_HCI_CORE=y
CONFIG_BT_DEBUG_HCI_DRIVER=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and see if you get any information about why it fails.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth and threading with Zephyr</title><link>https://test-devzone.nordicsemi.com/thread/349042?ContentTypeID=1</link><pubDate>Sat, 22 Jan 2022 00:48:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e829a82f-7b1c-4b6b-a5d1-00afbf397a35</guid><dc:creator>user112245</dc:creator><description>&lt;p&gt;Unfortunatelly I&amp;#39;m not able to share my code :( Maybe i can create some sample next week.&lt;/p&gt;
&lt;p&gt;But to make long story short - everything works fine with one thread (even without assert), but when two threads are running CONFIG_ASSSERT=y is necessary - otherwise bluetooth will be working fine, only until next thread will be started.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth and threading with Zephyr</title><link>https://test-devzone.nordicsemi.com/thread/348948?ContentTypeID=1</link><pubDate>Fri, 21 Jan 2022 13:50:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5cd22c38-93b3-43f9-a553-8e38769c2419</guid><dc:creator>user72692</dc:creator><description>&lt;p&gt;Hmm.. It is hard to say why enabling asserts makes the issue go away. It would be much easier for me to investigate this if I get the sample, run it on an nRF52832 DK and reproduce it myself. Would it be possible to upload the sample here on DevZone (or a simplified sample that demonstrates the issue)?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth and threading with Zephyr</title><link>https://test-devzone.nordicsemi.com/thread/348910?ContentTypeID=1</link><pubDate>Fri, 21 Jan 2022 12:16:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78488256-efc2-485b-ad36-a5460d37ffa1</guid><dc:creator>user112245</dc:creator><description>&lt;div&gt;&lt;span&gt;It may be helpful to look info my prj.conf. This one is without asserts (so it is not working)&lt;br /&gt;&lt;br /&gt;CONFIG_SIZE_OPTIMIZATIONS&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_GPIO&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_PWM&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_ADC&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_NRFX_TIMER0&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_FLASH&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_SMP&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_PERIPHERAL&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_DEVICE_NAME&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&amp;quot;Nordic_LBS&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;# Enable mcumgr.&lt;/p&gt;
&lt;div&gt;&lt;span&gt;CONFIG_MCUMGR&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;&lt;span&gt;# Enable most core commands.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_MCUMGR_CMD_IMG_MGMT&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_MCUMGR_CMD_OS_MGMT&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;&lt;span&gt;# Ensure an MCUboot-compatible binary is generated.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BOOTLOADER_MCUBOOT&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;&lt;span&gt;# Enable the Bluetooth (unauthenticated) and shell mcumgr transports.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_MCUMGR_SMP_BT&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_MCUMGR_SMP_BT_AUTHEN&lt;/span&gt;&lt;span&gt;=n&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;&lt;span&gt;# Some command handlers require a large stack.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE&lt;/span&gt;&lt;span&gt;=4096&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;&lt;span&gt;# Disable Bluetooth features not needed&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_DEBUG_NONE&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_ASSERT&lt;/span&gt;&lt;span&gt;=n&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_DATA_LEN_UPDATE&lt;/span&gt;&lt;span&gt;=n&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_PHY_UPDATE&lt;/span&gt;&lt;span&gt;=n&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_GATT_CACHING&lt;/span&gt;&lt;span&gt;=n&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS&lt;/span&gt;&lt;span&gt;=n&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_HCI_VS_EXT&lt;/span&gt;&lt;span&gt;=n&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_CTLR_PRIVACY&lt;/span&gt;&lt;span&gt;=n&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;&lt;span&gt;# Reduce Bluetooth buffers&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT&lt;/span&gt;&lt;span&gt;=1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_BUF_EVT_RX_COUNT&lt;/span&gt;&lt;span&gt;=2&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_L2CAP_TX_BUF_COUNT&lt;/span&gt;&lt;span&gt;=2&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;&lt;span&gt;CONFIG_MULTITHREADING&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth and threading with Zephyr</title><link>https://test-devzone.nordicsemi.com/thread/348847?ContentTypeID=1</link><pubDate>Fri, 21 Jan 2022 07:23:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2913caf-d0eb-4162-9112-d335e9dea274</guid><dc:creator>user112245</dc:creator><description>&lt;p&gt;I had to return to this problem, here is my current position:&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;With&amp;nbsp;CONFIG_ASSERT=n:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;main() starts&lt;/span&gt;&lt;br /&gt;&lt;span&gt;enable BT and mcumgr OTA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - &lt;strong&gt;Bluetooth fully responsible&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;delay 3s&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;- &lt;strong&gt;Bluetooth fully responsible&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;run my thread (priority set to 18)&amp;nbsp; &amp;nbsp; - &lt;strong&gt;Bluetooth&amp;nbsp;not responsible at all&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;With&amp;nbsp;CONFIG_ASSERT=y:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;main() starts&lt;/span&gt;&lt;br /&gt;&lt;span&gt;enable BT and mcumgr OTA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;nbsp;&lt;strong&gt;Bluetooth fully responsible&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;delay 3s&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;-&amp;nbsp;&lt;strong&gt;Bluetooth fully responsible&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;run my thread (priority set to 18)&amp;nbsp; &amp;nbsp;&amp;nbsp;-&amp;nbsp;&lt;strong&gt;Bluetooth fully responsible&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My question is - &lt;strong&gt;why does enabling assertion globally solves this problem?&amp;nbsp;&lt;/strong&gt;&lt;br /&gt;I would rather not includ asserts in my code, as BT appliacation with asserts weights a lot,&lt;br /&gt;and i would better keep space for 2 program slots in my 512kB of flash.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It&amp;#39;s worth adding, that my thread is not influencing bluetooth or ota features, it&amp;#39;s simple gpio, uart operations.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth and threading with Zephyr</title><link>https://test-devzone.nordicsemi.com/thread/348019?ContentTypeID=1</link><pubDate>Mon, 17 Jan 2022 12:14:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32bd68ef-9b73-4f56-8c6e-6b0a519980e9</guid><dc:creator>user72692</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m glad you found a partial solution. However, I&amp;#39;m not exactly sure what could cause this issue. Could you share a simple sample that demonstrates the issue?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth and threading with Zephyr</title><link>https://test-devzone.nordicsemi.com/thread/347917?ContentTypeID=1</link><pubDate>Mon, 17 Jan 2022 07:40:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af14ed3b-dec1-4c43-b272-5eef3d3778b7</guid><dc:creator>user112245</dc:creator><description>&lt;p&gt;Ok, I partially solved my problem. Solution was running all BT and DFU init&amp;nbsp;functions in main loop (or separate thread) and setting my code&amp;#39;s thread priority down to 18 value .&lt;br /&gt;Running my code and BT inside one thread is apparently not a good idea.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>