<?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>Changing advertising modes from IDLE to FAST SDK V15.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/35437/changing-advertising-modes-from-idle-to-fast-sdk-v15-0</link><description>I am migrating from SDK v14.2.0 to v15.0.0 and from S132 to S112 (v6) using the NRF52810. I have mostly everything migrated, but a functionality that worked before does not seem to behave correctly now and have not been able to find the root cause. 
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 27 Jul 2018 17:14:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/35437/changing-advertising-modes-from-idle-to-fast-sdk-v15-0" /><item><title>RE: Changing advertising modes from IDLE to FAST SDK V15.0</title><link>https://devzone.nordicsemi.com/thread/141752?ContentTypeID=1</link><pubDate>Fri, 27 Jul 2018 17:14:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1ef4876-1016-4c1f-b3db-17d321bb921a</guid><dc:creator>amorgan</dc:creator><description>&lt;p&gt;H&amp;aring;vard,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; Thanks for the reply! This resolved the error I was getting, but it was not setting the duration correctly.&lt;/p&gt;
&lt;p&gt;Stepping through ble_advertising_start, you will see that&lt;/p&gt;
&lt;p&gt;memset(&amp;amp;p_advertising-&amp;gt;adv_params, 0, sizeof(p_advertising-&amp;gt;adv_params));&lt;/p&gt;
&lt;p&gt;is called, which clears out the adv_params. Therefore, the following is what was needed to get the duration / timeout to fully work and to not get the original error message:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void sleep_mode_enter(void)
{
    ret_code_t err_code;
    
    m_advertising.adv_mode_current = BLE_ADV_MODE_FAST;
    m_advertising.adv_modes_config.ble_adv_fast_timeout = 10000;
    m_advertising.adv_modes_config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    
    m_advertising.adv_params.duration = 10000;
    m_advertising.adv_params.interval = APP_ADV_INTERVAL;

    err_code = ble_advertising_restart_without_whitelist(&amp;amp;m_advertising);
    if (err_code != NRF_ERROR_INVALID_STATE)
    {
        APP_ERROR_CHECK(err_code);
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Note also that if m_advertising.adv_params.interval = APP_ADV_INTERVAL; is not set before calling ble_advertising_restart_without_whitelist, I still get the invalid parameters error. Even though I was not intending to change the interval, only duration, this still was needed.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Is there any documentation on how to correctly change these parameters? It seems as if the new SDK does not handle this as seamlessly as one would expect.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, I am using a whitelist, but in this specific case, where there are no bonds, I do not want the device to be advertising, which does occur when using a whitelist when there are no bonds. Therefore I prevent this from happening by forcing it to go to idle, then on user input, change to advertise without whitelist to get the initial bond.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Either way, thank you for helping out, this has now solved my issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing advertising modes from IDLE to FAST SDK V15.0</title><link>https://devzone.nordicsemi.com/thread/141583?ContentTypeID=1</link><pubDate>Thu, 26 Jul 2018 22:43:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:324344a0-e6c8-4e46-82ed-59846f09c089</guid><dc:creator>H&amp;#229;vard</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void sleep_mode_enter(void)
{
    ret_code_t err_code;
    
    m_advertising.adv_mode_current = BLE_ADV_MODE_FAST;
    m_advertising.adv_params.duration = 10000;
    m_advertising.adv_params.interval = APP_ADV_INTERVAL;

    err_code = ble_advertising_restart_without_whitelist(&amp;amp;m_advertising);
    if (err_code != NRF_ERROR_INVALID_STATE)
    {
        APP_ERROR_CHECK(err_code);
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Hi amorgan, try the code above instead. You were setting configs that are only being read during ble_advertising_init().&lt;/p&gt;
&lt;p&gt;On a related note, if you are not using whitelist, you should never have to call ble_advertising_restart...&lt;/p&gt;
&lt;p&gt;instead you can just call ble_advertising_start(&amp;amp;m_advertising,APP_ADV_MODE_FAST) when you get the idle event.&lt;/p&gt;
&lt;p&gt;Good luck!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing advertising modes from IDLE to FAST SDK V15.0</title><link>https://devzone.nordicsemi.com/thread/140241?ContentTypeID=1</link><pubDate>Mon, 16 Jul 2018 14:17:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a2a9d87-13f4-4151-b32a-267cbb0a36dc</guid><dc:creator>amorgan</dc:creator><description>&lt;p&gt;Sorry for the delay, Attached are the before and after. Note I get the error when ble_advertising_restart_without_whitelist calls flags_set.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Before update m_advertising coming from IDLE:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Before updating" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/2063.2018_2D00_07_2D00_16_5F00_nRF52810_5F00_SDK15_5F00_IDLE_5F00_to_5F00_FAST_5F00_Error_5F00_Before.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Before ble_advertising_restart_without_whitelist calls flags_set:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Before flags_set" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/3884.2018_2D00_07_2D00_16_5F00_nRF52810_5F00_SDK15_5F00_IDLE_5F00_to_5F00_FAST_5F00_Error_5F00_Before_2D00_flags_5F00_set.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;After flags_set returns Error (0x07):&lt;/p&gt;
&lt;p&gt;&lt;img alt="After flags_set" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/5850.2018_2D00_07_2D00_16_5F00_nRF52810_5F00_SDK15_5F00_IDLE_5F00_to_5F00_FAST_5F00_Error_5F00_After_2D00_flags_5F00_set.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;LLet me know if this helps.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;TThank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing advertising modes from IDLE to FAST SDK V15.0</title><link>https://devzone.nordicsemi.com/thread/138903?ContentTypeID=1</link><pubDate>Wed, 04 Jul 2018 08:23:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9eb01395-d7f1-4667-9ae6-2c923035f851</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;I cannot see directly from the main.c what is causing the issue. When you have the failing and working parameters avaiable, please upload them here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing advertising modes from IDLE to FAST SDK V15.0</title><link>https://devzone.nordicsemi.com/thread/138735?ContentTypeID=1</link><pubDate>Tue, 03 Jul 2018 10:45:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f0f28ba-0e51-496e-9807-1bf474d5c787</guid><dc:creator>amorgan</dc:creator><description>&lt;p&gt;The file main.c I linked duplicates the issue, which occurs when it is in idle then&amp;nbsp;&lt;span&gt;ble_advertising_restart_without_whitelist is called to switch to fast mode. Would you be able to evaluate this?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I will send the results of your request when i get back in the office.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing advertising modes from IDLE to FAST SDK V15.0</title><link>https://devzone.nordicsemi.com/thread/138694?ContentTypeID=1</link><pubDate>Tue, 03 Jul 2018 08:32:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e31a4d3b-8b9c-43f4-aeee-932f03ca8c53</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;It&amp;nbsp; should not be necessary to comment out flags_set.&lt;/p&gt;
&lt;p&gt;When the advertising mode is BLE_ADV_MODE_FAST, could you upload a snippet of the current advertising parameters, like then one I have added below?&lt;/p&gt;
&lt;p&gt;(I have tested a simple example going from BLE_ADV_MODE_IDLE to BLE_ADV_MODE_FAST and that works. I think it&amp;#39;s hard to see just from the code what is wrong, when the problem is invalid parameters, it is better to see what the parameters are.)&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-dbf4cd263eb746d0ae5499790eb9bdf4/adv_5F00_start.PNG" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing advertising modes from IDLE to FAST SDK V15.0</title><link>https://devzone.nordicsemi.com/thread/138601?ContentTypeID=1</link><pubDate>Mon, 02 Jul 2018 19:08:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58bbd616-c539-426f-a4ff-764ade8e156c</guid><dc:creator>amorgan</dc:creator><description>&lt;p&gt; thanks for the response.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It doesn&amp;#39;t seem to be related to the whitelist, since I am able to restart without a whitelist if I am in BLE_ADV_MODE_FAST and then call ble_advertising_restart_without_whitelist().&lt;br /&gt;&lt;br /&gt;It seems to be related to going from BLE_ADV_MODE_IDLE to BLE_ADV_MODE_FAST mode.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If I comment out:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ret = flags_set(p_advertising, BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
VERIFY_SUCCESS(ret);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;in ble_advertising_restart_without_whitelist function, I no longer get the issue and it works correctly.&lt;/p&gt;
&lt;p&gt;Full modified function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t ble_advertising_restart_without_whitelist(ble_advertising_t * const p_advertising)
{
    ret_code_t ret;

    (void) sd_ble_gap_adv_stop(p_advertising-&amp;gt;adv_handle);

    p_advertising-&amp;gt;whitelist_temporarily_disabled = true;
    p_advertising-&amp;gt;whitelist_in_use               = false;
    p_advertising-&amp;gt;adv_params.filter_policy       = BLE_GAP_ADV_FP_ANY;
    // Set correct flags.
    //ret = flags_set(p_advertising, BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
    //VERIFY_SUCCESS(ret);

    ret = ble_advertising_start(p_advertising, p_advertising-&amp;gt;adv_mode_current);
    if ((ret != NRF_SUCCESS) &amp;amp;&amp;amp; (p_advertising-&amp;gt;error_handler != NULL))
    {
        p_advertising-&amp;gt;error_handler(ret);
    }

    return NRF_SUCCESS;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It is unclear which config is causing the issue or how to resolve this error without modified the Nordic SDK source code, since ble_advertising_start() seems to set the rest of the parameters correctly.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Have you evaluated the main.c file above using the example I referenced?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing advertising modes from IDLE to FAST SDK V15.0</title><link>https://devzone.nordicsemi.com/thread/138282?ContentTypeID=1</link><pubDate>Fri, 29 Jun 2018 12:41:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af347805-53ac-43fb-b229-446369b620ef</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;In ble_advertising_restart_without_whitelist(),&amp;nbsp; sd_ble_gap_adv_set_configure() returns NRF_ERROR_INVALID_PARAM.&lt;/p&gt;
&lt;p&gt;According to the doumentation, sd_ble_gap_adv_set_configure() returns NRF_ERROR_INVALID_PARAM if:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;nbsp;- Invalid configuration of p_adv_params. See @ref ble_gap_adv_params_t.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&amp;nbsp;- Use of whitelist requested but whitelist has not been set, see @ref sd_ble_gap_whitelist_set.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Did you remember to disable the whitelist setting in m_advertising.adv_modes_config.ble_adv_whitelist_enabled?&lt;/p&gt;
&lt;p&gt;Could you run the chip in debug mode and compare the settings of m_advertising for a non-working and a working case* ?&lt;/p&gt;
&lt;p&gt;*working case: advertising without whitelist&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing advertising modes from IDLE to FAST SDK V15.0</title><link>https://devzone.nordicsemi.com/thread/137254?ContentTypeID=1</link><pubDate>Fri, 22 Jun 2018 13:48:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ddef1683-5072-49af-af29-f887151ca3e4</guid><dc:creator>amorgan</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/joakim_2d00_jakobsen"&gt;Joakim Jakobsen&lt;/a&gt; Was my reply helpful or any updates?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing advertising modes from IDLE to FAST SDK V15.0</title><link>https://devzone.nordicsemi.com/thread/136615?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 18:21:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bacf0c95-64ef-42a2-8d19-7d5f04fd2779</guid><dc:creator>amorgan</dc:creator><description>&lt;p&gt;I have duplicated the issue using the SDK v15.0.0 example: ble_app_template using IAR (using ble_app_template_pca10040e_S112 with a Rigado dev board similar to the pca10040). Attached is the modified main.c file.&lt;br /&gt;&lt;br /&gt;I changed it so that instead of going into a sleep mode, it tries to restart without advertising. This produces the same error. Maybe I&amp;#39;m doing something fundamentally wrong, but this seems to duplicate the similar behavior in my application code.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The only section that should be different than the original example is the sleep_mode_enter() function.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/1565.main.c"&gt;/cfs-file/__key/communityserver-discussions-components-files/4/1565.main.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing advertising modes from IDLE to FAST SDK V15.0</title><link>https://devzone.nordicsemi.com/thread/136573?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 13:44:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9c903cd-a92f-4613-9c34-267d0e21c9cf</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;That sounds strange.&lt;/p&gt;
&lt;p&gt;Is is possible for you to upload your code? So that I can get a better overview of what is going on.&lt;/p&gt;
&lt;p&gt;If your code contains any sensitive information and you don&amp;#39;t want to upload your code to the public forum, it is possible to turn the case private first.&lt;/p&gt;
&lt;p&gt;Best regards, &lt;br /&gt;Joakim.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>