<?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>strange bluetooth low energy behavior and assertions in zephyr 3.2 when using debug mode for compilation</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112629/strange-bluetooth-low-energy-behavior-and-assertions-in-zephyr-3-2-when-using-debug-mode-for-compilation</link><description>Hi, 
 we are working on a device based on a nrf52840 using zephyr 3.2, which uses bluetooth low energy for advertising and for providing some services with some characteristics. 
 When building our application in debug mode, which has a lot of logging</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 03 Jul 2024 20:41:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112629/strange-bluetooth-low-energy-behavior-and-assertions-in-zephyr-3-2-when-using-debug-mode-for-compilation" /><item><title>RE: strange bluetooth low energy behavior and assertions in zephyr 3.2 when using debug mode for compilation</title><link>https://devzone.nordicsemi.com/thread/492127?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2024 20:41:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6e8fb76-8ebf-4553-a45c-7eee6c569a93</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Volker,&lt;/p&gt;
&lt;p&gt;Sorry I wasn&amp;#39;t clear. I meant to just take a look at the relevant source code so that you can put more details in when you report the issue to the Zephyr project.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t mean to recommend you to move to latest Zephyr version.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: strange bluetooth low energy behavior and assertions in zephyr 3.2 when using debug mode for compilation</title><link>https://devzone.nordicsemi.com/thread/492063?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2024 12:32:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fc18e73-5930-4bbc-8c2a-7b9f90b545ac</guid><dc:creator>Volker</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;for our application the upgrade from zephyr 2.4 to zephyr 3.2 took about 3 month until everything was running again, especially with having the same low power consumption as before. So I am seeing almost no chance to check this on the latest zephyr.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Volker&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: strange bluetooth low energy behavior and assertions in zephyr 3.2 when using debug mode for compilation</title><link>https://devzone.nordicsemi.com/thread/492017?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2024 09:02:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32904ce5-3028-4784-94cb-dcf69612948c</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Volker,&lt;/p&gt;
&lt;p&gt;What you discovered&amp;nbsp;about overlapping priorities check out and explain the situation we see. If you no longer see the same&amp;nbsp;issue anymore, I believe&amp;nbsp;you have got the correct fix.&lt;/p&gt;
&lt;p&gt;Since you know the details, do you think it is a good idea to check if the&amp;nbsp;problem is still in the latest version of Zephyr, and report it on Zephyr GitHub?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: strange bluetooth low energy behavior and assertions in zephyr 3.2 when using debug mode for compilation</title><link>https://devzone.nordicsemi.com/thread/491992?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2024 08:15:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aefc9bff-54d0-416b-87ea-e8de01646823</guid><dc:creator>Volker</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;thank you for your detailed reply.&lt;/p&gt;
&lt;p&gt;I found some youtube comparison of zephyr-vanialla and ncs. There was mentioned some difference in the licensing model. Is it right that using ncs is ok, as long as it runs on some nrf hardware (cpu)?&lt;/p&gt;
&lt;p&gt;As soon as I realized, that &lt;span&gt;CONFIG_PRINTK_SYNC&lt;/span&gt; increased the problem, I deactivated it immediately.&lt;/p&gt;
&lt;p&gt;In the meantime I was able to make some progress ... and found out, that there was some overlap between application thread priorities and bluetooth related thread priorities. When giving all the application threads lower priorities than the bluetooth threads, the problems seems to disappear.&lt;/p&gt;
&lt;p&gt;This was kind of surprising, as the same application was running on zephyr 2.4 without having these problems.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Volker&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: strange bluetooth low energy behavior and assertions in zephyr 3.2 when using debug mode for compilation</title><link>https://devzone.nordicsemi.com/thread/491881?ContentTypeID=1</link><pubDate>Tue, 02 Jul 2024 14:27:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9fdefa5d-3a6e-4e44-9466-ce27655f1d95</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Volker,&lt;/p&gt;
[quote user="Volker"]Yes, we are using vanilla zephyr since several years. We are within the step to upgrade from zephyr 2.4 to zephyr 3.2 so we might have some minor chance to use this drive to eventually switch over to nRF Connect SDK. Are there some major benefits from doing so?[/quote]
&lt;p&gt;The nRF Connect SDK (NCS)&amp;nbsp;supports the SoftDevice Controller (SDC), which is Nordic&amp;#39;s proprietary controller that was designed to work best with Nordic&amp;#39;s products. It also&amp;nbsp;includes the (also proprietary)&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.6.1/page/nrfxlib/mpsl/README.html"&gt;Multiprotocol Service Layer&lt;/a&gt;, MPSL, which as its name says, enables multi-protocol support.&lt;/p&gt;
&lt;p&gt;We also perform Bluetooth qualification on the Zephyr Host and SDC combination, so&amp;nbsp;as long as there is no modification to the Bluetooth LE stack, you can refer to our QDID during your product&amp;#39;s qualification process. The Zephyr Controller doesn&amp;#39;t have this.&lt;/p&gt;
&lt;p&gt;Last but not least, as&amp;nbsp;Nordic own the SDC completely, we can provide you better technical support for issues regarding it.&lt;/p&gt;
[quote user="Volker"]We had several stack overflows during the migration process to zephyr 3.2 and now I would assume that we have increased the stack size of all relevant threads. We used CONFIG_THREAD_ANALYZER to get regular output about the actual used stack size, but I am not quite sure if this covers all dynamic of stack usage properly. Do you have some more hints of how to make sure that all stacks are big enough?[/quote]
&lt;p&gt;I had a similar issue back in NCS 2.3.0, which coincidentally (?) is also based on Zephyr 3.2. What I observed is that even with thread analyzer showing that the&amp;nbsp;stack uses are almost always fine, the system still crashes, and a further increase in stack size did help.&lt;/p&gt;
&lt;p&gt;I &lt;em&gt;guess&lt;/em&gt; that&amp;nbsp;a fairly large spike in stack use caused the overflow, and&amp;nbsp;thus the thread analyzer didn&amp;#39;t have a chance to show that the impending issue.&lt;/p&gt;
[quote user="Volker"]Reducing the amount of logging output is not really an option, as we are just using our application specific logging, which is almost essential. Other built in component logging has been disabled already.[/quote]
&lt;p&gt;I&amp;nbsp;see. But then you should at least disable&amp;nbsp;&lt;span&gt;CONFIG_PRINTK_SYNC. If you are worried about losing logs, it&amp;#39;s better to increase the buffer size instead. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you&amp;nbsp;are using printk() for logging, the config is&amp;nbsp;CONFIG_PRINTK_BUFFER_SIZE.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you are using the logging module, the config is CONFIG_LOG_BUFFER_SIZE.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is this possible? If so, please try it and see if the situation improve.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&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: strange bluetooth low energy behavior and assertions in zephyr 3.2 when using debug mode for compilation</title><link>https://devzone.nordicsemi.com/thread/491640?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2024 14:33:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9b04159-261e-4495-bb20-e248301d36ee</guid><dc:creator>Volker</dc:creator><description>&lt;p&gt;I found the CONFIG_BT_CTLR_PROFILE_ISR config option, but I am not quite sure about how to interpret the output. Can you give me some advise?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: strange bluetooth low energy behavior and assertions in zephyr 3.2 when using debug mode for compilation</title><link>https://devzone.nordicsemi.com/thread/491626?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2024 13:20:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e7dfe31-d0e9-41ea-90a4-e0f7f964470b</guid><dc:creator>Volker</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;Yes, we are using vanilla zephyr since several years. We are within the step to upgrade from zephyr 2.4 to zephyr 3.2 so we might have some minor chance to use this drive to eventually switch over to nRF Connect SDK. Are there some major benefits from doing so?&lt;/p&gt;
&lt;p&gt;We had several stack overflows during the migration process to zephyr 3.2 and now I would assume that we have increased the stack size of all relevant threads. We used CONFIG_THREAD_ANALYZER to get regular output about the actual used stack size, but I am not quite sure if this covers all dynamic of stack usage properly. Do you have some more hints of how to make sure that all stacks are big enough?&lt;/p&gt;
&lt;p&gt;Reducing the amount of logging output is not really an option, as we are just using our application specific logging, which is almost essential. Other built in component logging has been disabled already.&lt;/p&gt;
&lt;p&gt;Do you have any other suggestions of how to track down and potentially fix the root cause for the bluetooth processing delays? Or how to optimize this?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Volker&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: strange bluetooth low energy behavior and assertions in zephyr 3.2 when using debug mode for compilation</title><link>https://devzone.nordicsemi.com/thread/491586?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2024 12:11:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93a7fafd-2baf-42ed-a47c-674159a59a38</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Volker,&lt;/p&gt;
&lt;p&gt;You mentioned Zephyr 3.2, and the log shows use of&amp;nbsp;the Zephyr Controller. Are you using vanilla Zephyr RTOS? We recommend using the nRF Connect SDK for development.&lt;/p&gt;
&lt;p&gt;For your issue,&amp;nbsp;debug mode builds often cause less efficient code, so the application requires more memory and timing margins.&lt;/p&gt;
&lt;p&gt;One common issue is threads running out of stack, so please try increasing your threads&amp;#39; stack size first.&lt;/p&gt;
&lt;p&gt;If the problem persists, please try to turn off logging or reducing the log level of the modules that you are not debugging.&lt;/p&gt;
&lt;p&gt;Please let me know if any of those helps.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>