<?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>alternate advertising packets with nRF52832, sdk15.0.0 , sd132 v6.0.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/38319/alternate-advertising-packets-with-nrf52832-sdk15-0-0-sd132-v6-0-0</link><description>I need to change, on a time basis, the advertising packet : 
 Let&amp;#39;s say for X seconds it has to work as a &amp;quot;iBeacon&amp;quot; 
 
 BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED 
 Advertising interval 100ms 
 
 
 , while for other X seconds as a scannable</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 14 Sep 2018 06:42:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/38319/alternate-advertising-packets-with-nrf52832-sdk15-0-0-sd132-v6-0-0" /><item><title>RE: alternate advertising packets with nRF52832, sdk15.0.0 , sd132 v6.0.0</title><link>https://devzone.nordicsemi.com/thread/148722?ContentTypeID=1</link><pubDate>Fri, 14 Sep 2018 06:42:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9230c771-a013-425c-8ec1-d8a12b82211d</guid><dc:creator>brokenArrow</dc:creator><description>&lt;p&gt;SOLVED.&lt;/p&gt;
&lt;p&gt;issue was a wrong initialization in the data structures passed in the&lt;/p&gt;
&lt;p&gt;&amp;nbsp;err_code = ble_advdata_encode(&amp;amp;advdata, m_adv_data.adv_data.p_data, &amp;amp;m_adv_data.adv_data.len);&lt;/p&gt;
&lt;p&gt;when changing from iBeacon to custom advertising and vice versa.&lt;/p&gt;
&lt;p&gt;(the m_adv_data.adv_data.p_data&amp;nbsp; and m_adv_data.adv_data.len are static, retaining a wrong data size when toggling from one another kind of packets)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;in the end it worked, on a time slice base, alternating the 2 packets (using just the same handler).&lt;/p&gt;
&lt;p&gt;the only thing is that I have to call every time&amp;nbsp;sd_ble_gap_adv_stop() before the&amp;nbsp;ble_advdata_encode-sd_ble_gap_adv_set_configure&amp;nbsp; and&amp;nbsp;sd_ble_gap_adv_start() calls.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: alternate advertising packets with nRF52832, sdk15.0.0 , sd132 v6.0.0</title><link>https://devzone.nordicsemi.com/thread/148040?ContentTypeID=1</link><pubDate>Mon, 10 Sep 2018 13:17:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40815416-3096-4e78-991e-ffa7cc14adaa</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;What is the value of your &amp;quot;APP_IBCN_DURATION&amp;quot; ? Could you try setting it to 0 ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: alternate advertising packets with nRF52832, sdk15.0.0 , sd132 v6.0.0</title><link>https://devzone.nordicsemi.com/thread/148029?ContentTypeID=1</link><pubDate>Mon, 10 Sep 2018 13:00:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd430151-53ed-4552-b226-8c824f1f5981</guid><dc:creator>brokenArrow</dc:creator><description>&lt;p&gt;still I get the error:&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app: FW_VER= nRF52DK_00.02.01&lt;br /&gt;&amp;lt;info&amp;gt; app: log_init&lt;br /&gt;&amp;lt;info&amp;gt; app: timers_init&lt;br /&gt;&amp;lt;info&amp;gt; app: buttons_leds_init&lt;br /&gt;&amp;lt;info&amp;gt; app: power_management_init&lt;br /&gt;&amp;lt;info&amp;gt; app: ble_stack_init&lt;br /&gt;&amp;lt;info&amp;gt; app: services_init&lt;br /&gt;&amp;lt;info&amp;gt; app: advertising_init&lt;br /&gt;&amp;lt;info&amp;gt; app: XX Demo started.&lt;br /&gt;&amp;lt;info&amp;gt; app: Fast advertising.&lt;/p&gt;
&lt;p&gt;...after 3 sec...&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app: stopping standard ADV&lt;br /&gt;&amp;lt;info&amp;gt; app: init iBeacon&lt;br /&gt;&amp;lt;error&amp;gt; app: Fatal error&lt;br /&gt;&amp;lt;warning&amp;gt; app: System reset&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;i&amp;#39;m wondering if the two different configurations are &amp;quot;compatible&amp;quot; :&lt;/p&gt;
&lt;p&gt;the custom advertisement is&amp;nbsp; this:&lt;pre class="ui-code" data-mode="text"&gt;static void advertising_init(void)
{
    ret_code_t             err_code;
    ble_advertising_init_t init;
    ble_advdata_manuf_data_t  manuf_data_res; // Variable to hold manufacturer specific data


    //manuf_data.company_identifier         = 0x0059; // Nordics company ID
    manuf_data_res.company_identifier       = 0xffff; //interoperability default value; not to be used in shipping end product
    manuf_data_res.data.p_data              = (uint8_t *)SerialNumber;
    manuf_data_res.data.size                = sizeof(SerialNumber)-1;

    memset(&amp;amp;init, 0, sizeof(init));

    init.advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    //init.advdata.name_type               = BLE_ADVDATA_SHORT_NAME;
    //init.advdata.short_name_len          = 8;
    //init.advdata.include_appearance      = true;
    init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;   
    init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    init.advdata.uuids_complete.p_uuids  = m_adv_uuids;


    init.srdata.name_type               = BLE_ADVDATA_NO_NAME;    
    init.srdata.include_appearance      = true;  
    init.srdata.p_manuf_specific_data   = &amp;amp;manuf_data_res;
    //init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);//more_adv_uuids
    //init.srdata.uuids_complete.p_uuids = m_adv_uuids;
       

    init.config.ble_adv_fast_enabled  = true;
    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout  = APP_ADV_DURATION;

    init.evt_handler = on_adv_evt;

    err_code = ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(&amp;amp;m_advertising, APP_BLE_CONN_CFG_TAG);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;while the beacon struct is written above in the first code snippet.&lt;/p&gt;
&lt;p&gt;any comment?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: alternate advertising packets with nRF52832, sdk15.0.0 , sd132 v6.0.0</title><link>https://devzone.nordicsemi.com/thread/148012?ContentTypeID=1</link><pubDate>Mon, 10 Sep 2018 12:21:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:846542a2-e1ad-4fec-86a1-3a3679b600a6</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The SoftDevice V6.0.0 can&amp;nbsp;&lt;/span&gt;&lt;span&gt;only configure one advertising set. Therefore, when starting the non-connectable advertising(iBeacon), the advertising handle should be the same as for the connectable advertising. (i.e. use m_advertising.adv_handle for both).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In your function, IBeacon_init() should configure the adv set like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;    err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_advertising.adv_handle, &amp;amp;m_adv_data, &amp;amp;m_adv_params);
    APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The function iBeacon_start() should look like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void iBeacon_start(void)
{
    ret_code_t err_code;

    err_code = sd_ble_gap_adv_start(m_advertising.adv_handle, APP_BLE_CONN_CFG_TAG);
    APP_ERROR_CHECK(err_code);

    err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And in&amp;nbsp;timer_timeout_handler(), restart standard ADV like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;      else  
      {
        
        NRF_LOG_INFO(&amp;quot; restart standard ADV&amp;quot;);
        err_code = sd_ble_gap_adv_stop(m_advertising.adv_handle);
        if (err_code != NRF_ERROR_INVALID_STATE)
        {
            APP_ERROR_CHECK(err_code);
        }
        err_code = ble_advertising_restart_without_whitelist(&amp;amp;m_advertising);
        if (err_code != NRF_ERROR_INVALID_STATE)
        {
            APP_ERROR_CHECK(err_code);
        }

        flag =1;
      }&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;PS: I don&amp;#39;t see that you set your&amp;nbsp;timerCounter back to 0 anywhere, so it might overflow after awhile. You can also just adjust the timeout value for how often timer_timeout_handler is called, so&amp;nbsp;you could consider removing the&amp;nbsp;timerCounter.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Sigurd&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: alternate advertising packets with nRF52832, sdk15.0.0 , sd132 v6.0.0</title><link>https://devzone.nordicsemi.com/thread/147853?ContentTypeID=1</link><pubDate>Fri, 07 Sep 2018 17:05:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e342bca-c90d-4f9f-b357-192b59fd6572</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;I know they added a snazzy way to timeslice two completely different BLE personalities together in recent SD but haven&amp;#39;t had need to learn about it.&lt;/p&gt;
&lt;p&gt;But, for what your needs appear to be, yes you can just run a timer and update the struct for the advertisement info and re-init advertisements. You don&amp;#39;t have to stop advertising as you have shown.&amp;nbsp; Doing that only will increase the power consumption. You only need to stop adverts if you change the advertising interval.&lt;/p&gt;
&lt;p&gt;Just remember iBeacon adverts won&amp;#39;t show up in iOS CoreBluetooth they will only show in CoreLocation.&amp;nbsp; But I suspect you already knew that. And, Android doesn&amp;#39;t care what you call it so no concerns there.&lt;/p&gt;
&lt;p&gt;If you use radio notifications you can easily make it synchronous with the advertisements.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>