<?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>Intermittent problem restarting advertising: ENOMEM, failed to create advertising set</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/109942/intermittent-problem-restarting-advertising-enomem-failed-to-create-advertising-set</link><description>Hi all, 
 Short problem description: I am troubleshooting an issue with the nRF5340 wherein the device runs for some time, then eventually gets stuck with an err -12 (ENOMEM) when attempting to create an extended advertising set. 
 This is on a custom</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 12 Apr 2024 14:49:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/109942/intermittent-problem-restarting-advertising-enomem-failed-to-create-advertising-set" /><item><title>RE: Intermittent problem restarting advertising: ENOMEM, failed to create advertising set</title><link>https://devzone.nordicsemi.com/thread/478586?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2024 14:49:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9415b006-9c9d-49c7-9bd7-8ac625c59301</guid><dc:creator>cscase</dc:creator><description>&lt;p&gt;Finally got this resolved, with the help of Nordic&amp;#39;s insightful Edvin Holmseth, and wanted to share what I learned here in the DevZone post.&lt;/p&gt;
&lt;p&gt;Ultimately the problem was the way the app was set up to update advertising data. Previously, it would be advertising, and when new data came in and the advertisement data needed to be updated, it would:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Stop advertising.&lt;/li&gt;
&lt;li&gt;Delete the existing advertising set.&lt;/li&gt;
&lt;li&gt;Create a new advertising set with the new data and parameters.&lt;/li&gt;
&lt;li&gt;Start advertising again.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Despite being clunky and overly-complicated, it did work most of the time, but when given enough time, and constant start and stop of advertising from Bluetooth connections, etc, eventually I guess the timing would align and wires would get crossed, two things trying to restart advertising at once, we end up trying to create an advertising set before the old one has been fully deleted, or something.&lt;/p&gt;
&lt;p&gt;What fixed the problem was to simplify the process of updating advertising data:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Stop advertising.&lt;/li&gt;
&lt;li&gt;Update the advertising data and/or parameters.&lt;/li&gt;
&lt;li&gt;Start advertising again.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;So, it was not necessary or helpful to be deleting the advertising set each time. Instead, we create an advertising set during initialization and just keep using that same one. With this approach, the problem I was seeing is gone.&lt;/p&gt;
&lt;p&gt;Thanks very much to Edvin, and also to Reuven, for your help in working on this problem.&lt;/p&gt;
&lt;p&gt;Scott&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent problem restarting advertising: ENOMEM, failed to create advertising set</title><link>https://devzone.nordicsemi.com/thread/477909?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2024 21:05:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5aabf06-6236-4e1e-9cad-3b40f5e3a366</guid><dc:creator>RM</dc:creator><description>&lt;p&gt;Hi Scott,&lt;br /&gt;&lt;br /&gt;If it exists under app/child_image, hci_rpmsg.conf&amp;nbsp; is included in the build, and used for the net core to configure submodules/settings.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent problem restarting advertising: ENOMEM, failed to create advertising set</title><link>https://devzone.nordicsemi.com/thread/477907?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2024 20:36:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ac42adf-5e47-4d78-99e2-c761d677c0be</guid><dc:creator>cscase</dc:creator><description>&lt;p&gt;For our network core, I have been editing a config file that is under my main application in a folder called child_image.&lt;/p&gt;
&lt;p&gt;But I just noticed, there is a separate application folder for hci_rpmsg and it has its own prj.conf. I didn&amp;#39;t do the initial setup on this project or repo, and I&amp;#39;m not sure which of these two config files is actually being used - or maybe settings from both are applied.&lt;/p&gt;
&lt;p&gt;I do know that HCI RPMSG is being built as a child image. Does that imply that this other application folder is vestigial and its config is not used?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent problem restarting advertising: ENOMEM, failed to create advertising set</title><link>https://devzone.nordicsemi.com/thread/477865?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2024 15:22:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7072032f-ab1c-48e6-b86c-abff4d602e6f</guid><dc:creator>cscase</dc:creator><description>&lt;p&gt;Thanks once again, Reuven.&amp;nbsp; I&amp;#39;m doing some research on increasing stack and heap sizes. When you say increase stack and heap, do you mean for the net core, app core, or both? Or maybe I ought to just give each a shot in turn and see if it helps. Doing some reading online in an effort to find out what are their default and max values, and what config options are used to set the current value.&lt;/p&gt;
&lt;p&gt;I do have control of the SPI master device, though, and I have a logic analyzer on this interface so I can see that the CS line is being asserted and released as expected when communications occur.&lt;/p&gt;
&lt;p&gt;We are not using any bootloader.&lt;/p&gt;
&lt;p&gt;I noticed yesterday afternoon that the reboot and hang event seemed always to be preceded by a failure to restart advertising, and I tried to catch that error and force an NVIC.SystemReset.&amp;nbsp; I get erratic behavior with that code in place, even before it actually executes, and had to back off the change.&lt;/p&gt;
&lt;p&gt;Anyway, I will get back to research on stack and heap allocation. Thanks for your help.&lt;/p&gt;
&lt;p&gt;Scott&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent problem restarting advertising: ENOMEM, failed to create advertising set</title><link>https://devzone.nordicsemi.com/thread/477670?ContentTypeID=1</link><pubDate>Mon, 08 Apr 2024 22:20:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c65b4e67-41a4-433b-9ed3-a4d27850a4b0</guid><dc:creator>RM</dc:creator><description>&lt;p&gt;Try increasing heap, stack, would also disable printk.&lt;br /&gt;&lt;br /&gt;As for SPI, one of the reasons maybe that CS line is not properly released, did you get a chance to debug inside SPI driver., do you control the other side of the SPI peripheral, if master is stuck with CS selected, the other side should be stuck as well.&lt;br /&gt;&lt;br /&gt;Are using bootloader, haven&amp;#39;t seen it in config the file. You can also manually release/set any SPI CS during board initialization before Zephyr runs.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Reuven&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent problem restarting advertising: ENOMEM, failed to create advertising set</title><link>https://devzone.nordicsemi.com/thread/477664?ContentTypeID=1</link><pubDate>Mon, 08 Apr 2024 20:25:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bde8a037-10b0-476f-acc8-0d3323e0d6c4</guid><dc:creator>cscase</dc:creator><description>&lt;p&gt;I have continued to troubleshoot on this issue, adjusting config options and making tweaks and checks. As it stands right now, I still get err -12 ENOMEM, but now when this occurs, I see the Zephyr boot banner immediately afterward and the IC becomes mostly unresponsive. It still gives the standard &amp;quot;I&amp;#39;m listening&amp;quot;&amp;nbsp;data on the MISO line&amp;nbsp;as the SPI master clocks data in to it, but it does not make any response to commands. Power cycling it, or a reset from the J-Link will revive it.&lt;/p&gt;
&lt;p&gt;Any ideas what could be causing this?&amp;nbsp;My network core config options are below. I will try to attach the app core config as a file, since it&amp;#39;s a little longer.&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_LOG&lt;/span&gt;&lt;span&gt;=n&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_SERIAL&lt;/span&gt;&lt;span&gt;=n&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BOOT_BANNER&lt;/span&gt;&lt;span&gt;=n&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_EXT_ADV&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_CTLR_ADV_EXT&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_CTLR_CONN_RSSI&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_EXT_ADV_MAX_ADV_SET&lt;/span&gt;&lt;span&gt;=3&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_CTLR_ADV_SET&lt;/span&gt;&lt;span&gt;=3&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_MAX_CONN&lt;/span&gt;&lt;span&gt;=3&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/prj-_2D00_-Copy.conf"&gt;devzone.nordicsemi.com/.../prj-_2D00_-Copy.conf&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent problem restarting advertising: ENOMEM, failed to create advertising set</title><link>https://devzone.nordicsemi.com/thread/477352?ContentTypeID=1</link><pubDate>Fri, 05 Apr 2024 14:17:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ecfbd03-cd46-4104-8858-406e28d7f5a9</guid><dc:creator>cscase</dc:creator><description>&lt;p&gt;Hi Kurt,&lt;/p&gt;
&lt;p&gt;Have you tried increasing&amp;nbsp;CONFIG_BT_EXT_ADV_MAX_ADV_SET ? Sounds like in some cases that helps, based on what I&amp;#39;ve seen online. It doesn&amp;#39;t resolve it for me, but worth a shot if you have not already tried it, I would think.&lt;/p&gt;
&lt;p&gt;Scott&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent problem restarting advertising: ENOMEM, failed to create advertising set</title><link>https://devzone.nordicsemi.com/thread/477349?ContentTypeID=1</link><pubDate>Fri, 05 Apr 2024 14:04:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7c34a7c-2221-435b-94cd-fff7de654bf9</guid><dc:creator>kpreiss</dc:creator><description>&lt;p&gt;Hi Scott,&lt;br /&gt;&lt;br /&gt;I am seeing the same behavior you&amp;#39;ve outlined above using an extended advertising set.&amp;nbsp; Using nrf Connect SDK v2.4, I am restarting extended advertising in another thread after a disconnect occurs.&amp;nbsp; In my situation, it always appears that an ENOMEM error is returned after calling&amp;nbsp;bt_le_ext_adv_start() after the 4th disconnect.&amp;nbsp; The KCONFIG parameters being used...&amp;nbsp;&lt;/p&gt;
&lt;p&gt;CONFIG_BT_MAX_CONN=4&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;CONFIG_BT_CTLR_ADV_SET&lt;/span&gt;=3&lt;br /&gt;&lt;span&gt;CONFIG_BT_CTLR_ADV_EXT&lt;/span&gt;=y&lt;br /&gt;&lt;span&gt;CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT&lt;/span&gt;=3&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;Best,&lt;/p&gt;
&lt;p&gt;Kurt&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent problem restarting advertising: ENOMEM, failed to create advertising set</title><link>https://devzone.nordicsemi.com/thread/477217?ContentTypeID=1</link><pubDate>Fri, 05 Apr 2024 00:07:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8825e2e-3d23-4d03-9c23-326c12be46bc</guid><dc:creator>RM</dc:creator><description>&lt;p&gt;In later SDK releases, there is bt_disable function in &lt;/p&gt;
&lt;p&gt;ncs/v2.3.0/zephyr/subsys/bluetooth/host/hci_core.c&lt;/p&gt;
&lt;p&gt;I think similar functionality should be achievable with 1.7.1&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent problem restarting advertising: ENOMEM, failed to create advertising set</title><link>https://devzone.nordicsemi.com/thread/477213?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2024 21:35:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c517d0c-f5b3-456d-af81-1955cec91014</guid><dc:creator>cscase</dc:creator><description>&lt;p&gt;To be more clear in my answer, to your question: I did try the things mentioned here, but I have not tried specifically disabling BT. If you think this is a good approach to take, I would be glad to give it a shot. How could I go about that? Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent problem restarting advertising: ENOMEM, failed to create advertising set</title><link>https://devzone.nordicsemi.com/thread/477210?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2024 20:50:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ae33a18-3e43-4e3c-b03d-89cf68af2aa2</guid><dc:creator>cscase</dc:creator><description>&lt;p&gt;Thanks Reuven,&lt;/p&gt;
&lt;p&gt;I have found that if I reset the nRF5340 via the J-Link (nrfjprog --pinreset), it returns to normal function. However, nothing else that I have found is able to recover it.&amp;nbsp;Here is what I have in the reset routine currently. It does not allow advertising to resume.&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; *(&lt;/span&gt;&lt;span&gt;volatile&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;uint32_t&lt;/span&gt;&lt;span&gt; *) &lt;/span&gt;&lt;span&gt;0x40005618ul&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;1ul&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;NRF_RESET&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;NETWORK&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;FORCEOFF&lt;/span&gt;&lt;span&gt; = (&lt;/span&gt;&lt;span&gt;RESET_NETWORK_FORCEOFF_FORCEOFF_Release&lt;/span&gt;&lt;span&gt; &amp;lt;&amp;lt; &lt;/span&gt;&lt;span&gt;RESET_NETWORK_FORCEOFF_FORCEOFF_Pos&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;k_msleep&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;5&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;span&gt; // Wait for at least five microseconds&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;NRF_RESET&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;NETWORK&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;FORCEOFF&lt;/span&gt;&lt;span&gt; = (&lt;/span&gt;&lt;span&gt;RESET_NETWORK_FORCEOFF_FORCEOFF_Hold&lt;/span&gt;&lt;span&gt; &amp;lt;&amp;lt; &lt;/span&gt;&lt;span&gt;RESET_NETWORK_FORCEOFF_FORCEOFF_Pos&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;k_msleep&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;span&gt; // Wait for at least one microsecond&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;NRF_RESET&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;NETWORK&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;FORCEOFF&lt;/span&gt;&lt;span&gt; = (&lt;/span&gt;&lt;span&gt;RESET_NETWORK_FORCEOFF_FORCEOFF_Release&lt;/span&gt;&lt;span&gt; &amp;lt;&amp;lt; &lt;/span&gt;&lt;span&gt;RESET_NETWORK_FORCEOFF_FORCEOFF_Pos&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; *(&lt;/span&gt;&lt;span&gt;volatile&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;uint32_t&lt;/span&gt;&lt;span&gt; *) &lt;/span&gt;&lt;span&gt;0x40005618ul&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;0ul&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;code&gt;&lt;span&gt;NVIC_SystemReset&lt;/span&gt;&lt;span&gt;();&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent problem restarting advertising: ENOMEM, failed to create advertising set</title><link>https://devzone.nordicsemi.com/thread/477209?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2024 20:42:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de291bce-838e-435a-ba1e-56e315c75379</guid><dc:creator>RM</dc:creator><description>&lt;p&gt;Hi Scott,&lt;br /&gt;&lt;br /&gt;Did you try to disable BT part and re-enable after a short delay in case of error?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Reuven&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>