<?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>Confusion about new style of manufacturer specific data updating</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57324/confusion-about-new-style-of-manufacturer-specific-data-updating</link><description>Hi, 
 I have a project which was originally written using SDK12, and have updated it to SDK16, I am sorry I know this question seems to have been asked in many different ways already. 
 I have one problem left. 
 I need to dynamically update manufacture</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 Feb 2020 18:21:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57324/confusion-about-new-style-of-manufacturer-specific-data-updating" /><item><title>RE: Confusion about new style of manufacturer specific data updating</title><link>https://devzone.nordicsemi.com/thread/236981?ContentTypeID=1</link><pubDate>Thu, 27 Feb 2020 18:21:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0bd0ddcb-4e8a-468b-be50-294aaa4d3a88</guid><dc:creator>Rob C</dc:creator><description>&lt;p&gt;I agree you&amp;#39;re seeing the Nordic Semi ID, but is is actually 0x0059 (sent LSB first).&amp;nbsp; The next byte you&amp;#39;re seeing is probably your seconds reading 0x00.&lt;/p&gt;
&lt;p&gt;1. I would start by commenting out your main.c line 27 (advertising_update_mfg_data();).&amp;nbsp; Confirm you see the starting data 0x123456 (in addition to the Nordic ID, that is: (0x59, 0x00, 0x12, 0x34, 0x56).&lt;/p&gt;
&lt;p&gt;2. Now, you want to call advertising_update_mfg_data() repeatedly after boot.&amp;nbsp; I think you&amp;#39;ll need to add it to the callback for whatever application timer handles updating the calendar.&amp;nbsp; This should cause your seconds value to increment.&lt;/p&gt;
&lt;p&gt;Rob&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Confusion about new style of manufacturer specific data updating</title><link>https://devzone.nordicsemi.com/thread/236954?ContentTypeID=1</link><pubDate>Thu, 27 Feb 2020 16:12:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35c6f27c-8660-4586-a378-a5036a292003</guid><dc:creator>dalsee</dc:creator><description>&lt;p&gt;Hello Rob,&lt;/p&gt;
&lt;p&gt;I added advertising_update_mfg_data(void) function right below the advertising_init(). But it doesn&amp;#39;t seem to update the new data by time.&lt;/p&gt;
&lt;p&gt;I have a beacon that advertises the current time every 187.5ms(no reason) loaded on manufacturer specific data field. I scanned this beacon through an app, but the data seemed to fixed to 590000 (0x0059 is Nordic manufacturer) and did not showed the updated second data.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " height="66" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Screen-Shot-2020_2D00_02_2D00_27-at-11.04.53-AM.png" width="521" /&gt;&lt;/p&gt;
&lt;p&gt;Could you look at my code? Below is advertising_init() and advertising_update_mfg_data()&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void advertising_init(void)
{
    ret_code_t             err_code;
    ble_advertising_init_t init;     // Struct containing advertising parameters
    // Build advertising data struct to pass into @ref ble_advertising_init.
    memset(&amp;amp;init, 0, sizeof(init));
    
    ble_advdata_manuf_data_t                  manuf_data; // Variable to hold manufacturer specific data
    uint8_t eg_data[]                         = {0x12, 0x34, 0x56};  // Our initial data to advertise then update with current time data.
    manuf_data.company_identifier             = 0x0059;   // Nordics company ID
    manuf_data.data.p_data                    = eg_data;
    manuf_data.data.size                      = sizeof(eg_data);
    init.advdata.p_manuf_specific_data        = &amp;amp;manuf_data;
    
    init.advdata.name_type               = BLE_ADVDATA_SHORT_NAME;  // Use a shortened name
    init.advdata.short_name_len          = 5; // Advertise only first 8 letters of name
    init.advdata.include_appearance      = false;
    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.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);
}


/** Function for updating Timestamp data **/

static void advertising_update_mfg_data(void)
{
    ret_code_t             err_code;

    static ble_advdata_t new_data; // SDK 16.x.x implementation is similar to advertising_init

    // Variables used for manufacturer specific data
    ble_advdata_manuf_data_t p_manuf_specific_data;
    uint8_array_t            adv_manuf_data_array;
    uint8_t                  adv_manuf_data_data[1];
    


    // Configuration of manufacturer specific data
    adv_manuf_data_data[0] = nrf_cal_get_time()-&amp;gt;tm_sec; // For the testing purpose, I only put the second data
    
    
    adv_manuf_data_array.p_data      = adv_manuf_data_data;
    adv_manuf_data_array.size        = sizeof(adv_manuf_data_data);

    p_manuf_specific_data.company_identifier = 0x0059;
    p_manuf_specific_data.data       = adv_manuf_data_array; 
      
    new_data.p_manuf_specific_data   = &amp;amp;p_manuf_specific_data;

    new_data.name_type               = BLE_ADVDATA_SHORT_NAME;
    new_data.short_name_len          = 5;
    new_data.include_appearance      = false;
    new_data.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    new_data.uuids_complete.uuid_cnt = 0;
    new_data.uuids_complete.p_uuids  = m_adv_uuids;

    //SDK16.x.x implementation will handle all buffering and encoding inside the update function
    err_code = ble_advertising_advdata_update(&amp;amp;m_advertising, &amp;amp;new_data, NULL);  
    APP_ERROR_CHECK(err_code);

}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And my main function just looks like this below.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int main(void)
{   
    bool erase_bonds;
    
    /** Calendar example merging starts from here **/
    uint8_t uart_byte;
    uint32_t year, month, day, hour, minute, second;
    NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART = 1;
    while(NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0);
    
    
    nrf_cal_init();
    nrf_cal_set_callback(calendar_updated, 4);
    uart_init();
    
    /** Ble example code starts from here **/
    // Initialize.
    timers_init();
    buttons_leds_init(&amp;amp;erase_bonds);
    power_management_init();
    ble_stack_init();
    gap_params_init();

    gatt_init();
    advertising_init();
    advertising_update_mfg_data();
    services_init();
    conn_params_init();
    peer_manager_init();
    
    // Start execution.
    //NRF_LOG_INFO(&amp;quot;Template example started.&amp;quot;);
    application_timers_start();
    advertising_start(erase_bonds);
    
    /** Calendar example **/
    printf(&amp;quot;\r\nCalendar demo\r\n\n&amp;quot;);
    printf(&amp;quot;s - Set time\r\n&amp;quot;);
    printf(&amp;quot;g - Get time\r\n&amp;quot;);
    printf(&amp;quot;r - Run continuous time updates\r\n\n&amp;quot;);
    
    while (true)
    {
        if(app_uart_get(&amp;amp;uart_byte) == NRF_SUCCESS)
        {
            switch(uart_byte)
            {
                case &amp;#39;s&amp;#39;:
                    run_time_updates = false;
                
                    year = (uint32_t)uart_get_parameter(&amp;quot;Enter year&amp;quot;, 1970, 2100);
                    month = (uint32_t)uart_get_parameter(&amp;quot;Enter month&amp;quot;, 0, 11);
                    day = (uint32_t)uart_get_parameter(&amp;quot;Enter day&amp;quot;, 1, 31);
                    hour = (uint32_t)uart_get_parameter(&amp;quot;Enter hour&amp;quot;, 0, 23);
                    minute = (uint32_t)uart_get_parameter(&amp;quot;Enter minute&amp;quot;, 0, 59);
                    second = (uint32_t)uart_get_parameter(&amp;quot;Enter second&amp;quot;, 0, 59);
                    
                    nrf_cal_set_time(year, month, day, hour, minute, second);
                    
                    printf(&amp;quot;Time set: &amp;quot;);
                    printf(&amp;quot;%s&amp;quot;, nrf_cal_get_time_string(false));
                    printf(&amp;quot;\r\n\n&amp;quot;);
                    break;
                
                case &amp;#39;g&amp;#39;:
                    //print_current_time();
                    printf(&amp;quot;%d\r\n&amp;quot;, nrf_cal_get_time()-&amp;gt;tm_sec);
                    printf(&amp;quot;%d\r\n&amp;quot;, (*nrf_cal_get_time()).tm_min);
                    
                    break;
                
               
            }
        }
    }

    
  
    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also thanks for the prompt reply yesterday !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Confusion about new style of manufacturer specific data updating</title><link>https://devzone.nordicsemi.com/thread/236658?ContentTypeID=1</link><pubDate>Wed, 26 Feb 2020 19:38:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18c3717a-27ce-4596-ab05-da660c109ec4</guid><dc:creator>Rob C</dc:creator><description>&lt;p&gt;Sure!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;- Where to locate ... I&amp;#39;d put it right below your advertising_init() function.&amp;nbsp; Edit your advertising_init() function with the same manufacturer data as&amp;nbsp;advertising_update_mfg_data().&lt;/p&gt;
&lt;p&gt;- How to use... depends on what manufacturer data you are advertising.&amp;nbsp; Lets say you&amp;#39;re measuring temperature and going to send it in two bytes (say in a signed int16).&amp;nbsp; You have a timer which reads the temperature and saves it to a static location (m_temperature) every minute.&amp;nbsp; Right after you read temperature, call&amp;nbsp;advertising_update_mfg_data() to copy the new reading into the advertising data.&amp;nbsp; Watch the bytes being sent in the advertisement change with temperature.&lt;/p&gt;
&lt;p&gt;Replacing &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;your first byte here&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; .... would be something like:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Configuration of manufacturer specific data
    adv_manuf_data_data[0] = ( m_temperature &amp;gt;&amp;gt; 8 );   //high byte
    adv_manuf_data_data[1] = ( m_temperature &amp;amp; 0xFF ); //low byte&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;- Rob&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Confusion about new style of manufacturer specific data updating</title><link>https://devzone.nordicsemi.com/thread/236654?ContentTypeID=1</link><pubDate>Wed, 26 Feb 2020 19:01:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f3c8c63-3029-4d67-abe9-8d46ed5163dd</guid><dc:creator>dalsee</dc:creator><description>&lt;p&gt;Hello, thanks for the solution for the newbie here. However, could you elaborate how I can use this function? Where should I locate this function?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Confusion about new style of manufacturer specific data updating</title><link>https://devzone.nordicsemi.com/thread/232485?ContentTypeID=1</link><pubDate>Tue, 04 Feb 2020 09:28:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:590abcba-1602-4a72-aa4b-460168c0f4b3</guid><dc:creator>billywalton</dc:creator><description>&lt;p&gt;Spot on, that&amp;#39;s worked a treat, thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Confusion about new style of manufacturer specific data updating</title><link>https://devzone.nordicsemi.com/thread/232427?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2020 19:49:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96a179e9-b092-4d40-b1ce-c94fb88b831d</guid><dc:creator>Rob C</dc:creator><description>&lt;p&gt;It is SO much easier to update now!&amp;nbsp; Here&amp;#39;s how I do it.&amp;nbsp; Change the options in new_data to match your init function.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for updating manufacturer data in the Advertising payload.
 */
static void advertising_update_mfg_data(void)
{
    ret_code_t             err_code;

    static ble_advdata_t new_data; // SDK 16.x.x implementation is similar to advertising_init

    new_data.name_type               = BLE_ADVDATA_FULL_NAME;
    new_data.include_appearance      = false;
    new_data.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    new_data.uuids_complete.uuid_cnt = 0;
        
    // Variables used for manufacturer specific data
    ble_advdata_manuf_data_t p_manuf_specific_data;
    uint8_array_t            adv_manuf_data_array;
    uint8_t                  adv_manuf_data_data[2];

    // Configuration of manufacturer specific data
    adv_manuf_data_data[0] = &amp;lt;&amp;lt;&amp;lt;&amp;lt;your first byte here&amp;gt;&amp;gt;&amp;gt;&amp;gt;;
    adv_manuf_data_data[1] = &amp;lt;&amp;lt;&amp;lt;&amp;lt;your second byte here&amp;gt;&amp;gt;&amp;gt;&amp;gt;;

    adv_manuf_data_array.p_data = adv_manuf_data_data;
    adv_manuf_data_array.size = sizeof(adv_manuf_data_data);

    p_manuf_specific_data.company_identifier = BLE_COMPANY_IDENTIFIER;
    p_manuf_specific_data.data = adv_manuf_data_array;
    
    new_data.p_manuf_specific_data = &amp;amp;p_manuf_specific_data;

    //SDK16.x.x implementation will handle all buffering and encoding inside the update function
    err_code = ble_advertising_advdata_update(&amp;amp;m_advertising, &amp;amp;new_data, NULL);  
    APP_ERROR_CHECK(err_code);

}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>