<?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>Usage Fault when implementing an advertiser sent callback.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116467/usage-fault-when-implementing-an-advertiser-sent-callback</link><description>NCS 2.7.0 
 NRF52840 DK 
 I am trying to trigger an advertising sent callback to indicate advertising timeout or a maximum number of events. I have tried increasing the workqueue and main thread stack sizes but still get a usage fault error. 
 Here is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 26 Nov 2024 14:00:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116467/usage-fault-when-implementing-an-advertiser-sent-callback" /><item><title>RE: Usage Fault when implementing an advertiser sent callback.</title><link>https://devzone.nordicsemi.com/thread/512156?ContentTypeID=1</link><pubDate>Tue, 26 Nov 2024 14:00:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7904bc95-34c0-49cc-9290-ce9f1dc24ae1</guid><dc:creator>SRall</dc:creator><description>&lt;p&gt;Thank you, this was the issue.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage Fault when implementing an advertiser sent callback.</title><link>https://devzone.nordicsemi.com/thread/511851?ContentTypeID=1</link><pubDate>Mon, 25 Nov 2024 09:49:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d68396a3-ee73-45f9-b7a5-66dcdd0476c6</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I was not able to reproduce at first, and seemingly unrelated changed seemed to affect it, pointing to usage of invalid memory. And that seems to be the case, as your adverticing&amp;nbsp;&lt;code&gt;advertising_cb&lt;/code&gt; &lt;code&gt;struct&lt;/code&gt; is neither global nor static. And this will cause problems if the memory is re-used. The API docuemntation for&amp;nbsp;&lt;code&gt;bt_le_ext_adv_create()&lt;/code&gt; specifies that this callback truct parameters &amp;quot;&lt;em&gt;Must point to valid memory during the lifetime of the advertising set&lt;/em&gt;&amp;quot;.&amp;nbsp;So making it &lt;code&gt;static&lt;/code&gt; (or global) should solve the issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage Fault when implementing an advertiser sent callback.</title><link>https://devzone.nordicsemi.com/thread/511548?ContentTypeID=1</link><pubDate>Thu, 21 Nov 2024 16:26:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bae0810c-fcbf-4bbf-b2af-6c76cac62c29</guid><dc:creator>SRall</dc:creator><description>&lt;p&gt;Sure. I&amp;#39;ve removed all the code apart from the bare application that just creates the advertising set and parameters and starts advertising. Connected and disconnected callbacks are setup as well. I still get the same error when &lt;a href="https://docs.zephyrproject.org/apidoc/latest/structbt__le__ext__adv__cb.html#a85b8887c9ef443d18b71e9561e7dde60" rel="noopener noreferrer" target="_blank"&gt;the &amp;quot;sent&amp;quot; callback&amp;nbsp;&lt;/a&gt;&amp;nbsp;is triggered for any reason.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/3021.radio_5F00_test.zip"&gt;devzone.nordicsemi.com/.../3021.radio_5F00_test.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage Fault when implementing an advertiser sent callback.</title><link>https://devzone.nordicsemi.com/thread/511529?ContentTypeID=1</link><pubDate>Thu, 21 Nov 2024 15:08:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b02434a-8e59-4344-8878-86f6cc93a533</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I see. I am not able to explain that. Can you share the full project (including prj.conf and CMakeLists.txt etc) so that I can test on my end?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage Fault when implementing an advertiser sent callback.</title><link>https://devzone.nordicsemi.com/thread/511217?ContentTypeID=1</link><pubDate>Wed, 20 Nov 2024 07:28:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af2a1fef-5282-4ebb-a833-692ee35029be</guid><dc:creator>SRall</dc:creator><description>&lt;p&gt;addr2line gives&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;C:/ncs/v2.7.0/zephyr/arch/arm/core/cortex_m/swap.c:49&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It seems apparent that the advertising &amp;quot;sent&amp;quot; callback passed to the advertiser is causing the issue. If I don&amp;#39;t pass any advertising callbacks, there is no issue. The error occurs when the callback is triggered, but despite my troubleshooting, I can&amp;#39;t seem to figure out why. Perhaps you can take a look at my code and help me determine what might be happening. It&amp;#39;s a simple BT peripheral application that advertises a simple service with one characteristic that closely follows the LED Button service sample.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage Fault when implementing an advertiser sent callback.</title><link>https://devzone.nordicsemi.com/thread/511012?ContentTypeID=1</link><pubDate>Tue, 19 Nov 2024 08:18:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3881f58b-4c3c-40db-abda-33ec9c23fa8a</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I see. Can you check with addr2line where in the code this failed? You can do it like this (make sure to pint to the same .elf file that is running on the target, and replace the address to the address where it fails in the current build):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;addr2line -e build/zephyr/zephyr.elf 0x000185e0&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;(See more on addr2line &lt;a href="https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-2-debugging/topic/build-errors-and-fatal-errors/"&gt;here&lt;/a&gt;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage Fault when implementing an advertiser sent callback.</title><link>https://devzone.nordicsemi.com/thread/510930?ContentTypeID=1</link><pubDate>Mon, 18 Nov 2024 15:28:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b66c624-b2b8-4903-b5f0-8bc5779aeb1f</guid><dc:creator>SRall</dc:creator><description>&lt;p&gt;Hi this didn&amp;#39;t work. I set CONFIG_BT_RX_STACK_SIZE to 8192 and got the same error.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage Fault when implementing an advertiser sent callback.</title><link>https://devzone.nordicsemi.com/thread/510890?ContentTypeID=1</link><pubDate>Mon, 18 Nov 2024 13:18:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:527b6f2f-9581-4b2c-87fd-4d27dacb9ba0</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The log indicate a stack overflow in the&amp;nbsp;BT RX WQ thread. So incrase the stack size of that thread, set&amp;nbsp;CONFIG_BT_RX_STACK_SIZE to a higher value in your prj.conf (for instance 4096).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>