<?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>bt_sdc_hci_driver: SoftDevice Controller ASSERT: 33, 531?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/98828/bt_sdc_hci_driver-softdevice-controller-assert-33-531</link><description>Hello all. 
 I&amp;#39;ve been writing code for an nRF52832, now using the v2.3.0 SDK but previously on v2.2.0; I upgraded just in case. 
 I had a set of disparate but working pieces of code that I have put together into one application/device and I&amp;#39;m getting</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Apr 2023 13:15:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/98828/bt_sdc_hci_driver-softdevice-controller-assert-33-531" /><item><title>RE: bt_sdc_hci_driver: SoftDevice Controller ASSERT: 33, 531?</title><link>https://devzone.nordicsemi.com/thread/421050?ContentTypeID=1</link><pubDate>Tue, 18 Apr 2023 13:15:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:654f89a9-1fe6-406b-afca-66c2056dec67</guid><dc:creator>Raoul</dc:creator><description>&lt;p&gt;Hi Tim, I&amp;#39;m glad you found the source of your issue.&lt;/p&gt;
&lt;p&gt;Regarding the asserts, you&amp;#39;ll see that many customers on DevZone experience this when trying to set breakpoints in their BLE-enabled applications. (You could search for &amp;quot;assert 2195&amp;quot; in particular). The fact is that with normal &amp;quot;halting debugging&amp;quot;, it&amp;#39;s simply not possible to set breakpoints on any application that uses the SoftDevice controller or Zephyr BLE controller. BLE is extremely sensitive to timing and so the link layer code has asserts all over the place to ensure that timing requirements are upheld. If not, they will fault.&lt;/p&gt;
&lt;p&gt;One solution is &amp;quot;monitor mode debugging&amp;quot; which is an alternative to halting debugging, where it keeps high priority interrupts such as those from the SoftDevice, running in the background. But we don&amp;#39;t currently have a solution for this as far as I know. I could look more into this when I have the time, if you like.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Raoul&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bt_sdc_hci_driver: SoftDevice Controller ASSERT: 33, 531?</title><link>https://devzone.nordicsemi.com/thread/420896?ContentTypeID=1</link><pubDate>Tue, 18 Apr 2023 06:08:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83dc84f4-2015-452b-a4e8-8d0e1c1d5a5a</guid><dc:creator>pilux</dc:creator><description>&lt;p&gt;Right. It was my fault.&lt;/p&gt;
&lt;p&gt;I hooked up an oscilloscope to a spare GPIO pin and toggled it in my 1Hz reporting thread: that was toggling in both my debug and in the non-debug, so nothing wrong with the initialisation.&lt;/p&gt;
&lt;p&gt;So I looked at the code again and realised that one of the threads I was spinning up wasn&amp;#39;t sleeping; in fact it consuming 100% CPU and starving the logging. I got further in the debug because I was probably pausing that thread and allowing other stuff - like logging - to run. I now believe that the ASSERT is what I thought: starvation of an IRQ or similar.&lt;/p&gt;
&lt;p&gt;I got logging working in the no-sleep case by adding this config property to force immediate logging instead of waiting for the logging thread to have its turn:&lt;/p&gt;
&lt;div&gt;
&lt;pre&gt;&lt;span&gt;CONFIG_LOG_MODE_IMMEDIATE=y&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;This then showed me that the CPU was pegged at 100% (thank you cpu_load_init!).&lt;/p&gt;
&lt;p&gt;The fix was simple: put a sleep into the thread that was starving the rest, including logging. I have now removed the&amp;nbsp;CONFIG_LOG_MODE_IMMEDIATE and it still all behaves, sitting normally at ~7% CPU instead of 100%.&lt;/p&gt;
&lt;p&gt;My remaining question is: is the ASSERT &amp;quot;expected&amp;quot; while debugging? If so, is there a way to avoid it? Having random kernel oops while debugging anything might get a bit... annoying. &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>