<?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>How to broadcast raw data in beacon mode?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83588/how-to-broadcast-raw-data-in-beacon-mode</link><description>Hello, 
 I am using PCA10040 DK for the programming with ble_app_beacon_pca10040_s132 example code. I want to broadcast my 20 bytes of data with my 0xFFE0 UUID. 
 In this example, I am trying to modify the m_beacon_info[] buffer with my custom data and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Jan 2022 14:28:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83588/how-to-broadcast-raw-data-in-beacon-mode" /><item><title>RE: How to broadcast raw data in beacon mode?</title><link>https://devzone.nordicsemi.com/thread/348084?ContentTypeID=1</link><pubDate>Mon, 17 Jan 2022 14:28:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:817bf2f0-7e5c-436e-b395-3ceaebfe7d67</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Glad to hear that. :) Good Luck.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to broadcast raw data in beacon mode?</title><link>https://devzone.nordicsemi.com/thread/347905?ContentTypeID=1</link><pubDate>Mon, 17 Jan 2022 06:04:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fce37bad-49f3-440d-895c-b848b402840f</guid><dc:creator>GeekGeek1192</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;It worked. Now I am able to tx the raw data over BLE in beacon mode without using the ble_advdata_encode() function.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to broadcast raw data in beacon mode?</title><link>https://devzone.nordicsemi.com/thread/347830?ContentTypeID=1</link><pubDate>Fri, 14 Jan 2022 16:46:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:142b585a-56c8-4dfb-875c-f4bd100a5e8b</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Ashish,&lt;/p&gt;
&lt;p&gt;You can add &amp;#39;&amp;#39;Debug&amp;#39;&amp;#39; in your preprocessor definition.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1642177772386v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;One thing is you have to uncomment the &lt;strong&gt;APP_ERROR_CHECK(err_code)&lt;/strong&gt; from the code. It needs in the code so that developer can recognize what function does not execute properly.&lt;/p&gt;
&lt;p&gt;For example, if we comment out &lt;strong&gt;APP_ERROR_CHECK(err_code)&lt;/strong&gt; after&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;err_code= sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;m_adv_data, &amp;amp;m_adv_params)&lt;/strong&gt;; it will not crash but the advertisement will not be set according to configuration.&lt;/p&gt;
&lt;p&gt;Because we do not know whether &lt;strong&gt;NRF_SUCCESS (==0)&lt;/strong&gt; or some error. then the following line of codes will not work properly.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; if(err_code == NRF_SUCCESS)&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; {&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; NRF_LOG_INFO(&amp;quot;sd_ble_gap_adv_set_configure init successful !&amp;quot;);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; }else&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; {&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; NRF_LOG_INFO(&amp;quot;sd_ble_gap_adv_set_configure init failed !&amp;quot;);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; }&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You can see the consequence after doing these changes in your application and let us know.&lt;/p&gt;
&lt;p&gt;Hope it helps. Have a nice weekend.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Kazi Afroza Sultana&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to broadcast raw data in beacon mode?</title><link>https://devzone.nordicsemi.com/thread/347676?ContentTypeID=1</link><pubDate>Fri, 14 Jan 2022 04:41:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bb87081-5204-49d9-ba9a-a947a48588ac</guid><dc:creator>GeekGeek1192</dc:creator><description>&lt;p&gt;fatal error and the device keep on restarting... I have done the below changes . now I am able to transmit my custom data over BLE so that this can be able to see on NRF connect app in RAW data...&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
uint8_t BC_advertData[31] =
{
// Flags; this sets the device to use limited discoverable
// mode (advertises for 30 seconds at a time) instead of general
// discoverable mode (advertises indefinitely)
0x02,   // length of this data      //[0]
GAP_ADTYPE_FLAGS,                   //[1] //GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,
0x04,// [2]
0x03,   // length of this data          // [3]
GAP_ADTYPE_16BIT_MORE,      // some of the UUID&amp;#39;s, but not all // [4]
LO_UINT16(Default_UUID),            // [5]
HI_UINT16(Default_UUID),            // [6]
0x17, // length of this data including the data type byte       // [7]
GAP_ADTYPE_MANUFACTURER_SPECIFIC, // manufacturer specific adv data type // [8]
 0x01, // mac 1                 [09]
 0x02, // mac 2                 [10]
 0x03, // mac 3  //             [11]
 0x04, // mac 4//               [12]
 0x05, // mac 5 //              [13]
 0x06, // mac 6 //              [14]
 0x40, // Temperature Msb   //  [15]
 0x89, // Temperature lsb //    [16]
 0x15, // Humidity Msb //       [17]
 0x58, // Humidity lsb //       [18]
 0x12, // Pressure Msb //       [19]
 0x34, // Pressure lsb //       [20]
 0x22, // Surface Temp Msb  //  [21]
 0xF4, // Surface Temp lsb //   [22]
 0x32, // Battery         //    [23]
 0xFF, // ON/OFF Duration MSB   [24]        //Ambient Light MSB
 0xFF, // ON/OFF Duration NEXT  [25]        //Ambient Light next
 0xFF, // ON/OFF Duration LSB   [26]         //Ambient Light LSB
 0x00, // Motion Event Flag //  [27]
 0x00, //  ON/OFF COUNT MSB     [28]
 0x00, //  ON/OFF COUNT NEXT    [29]
 0x00 //   ON/OFF COUNT LSB     [30]
};

/**@brief Struct that contains pointers to the encoded advertising data. */
static ble_gap_adv_data_t m_adv_data =
{
    .adv_data =
    {
        //.p_data = m_enc_advdata,
        .p_data = BC_advertData,
        .len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX
    },
    .scan_rsp_data =
    {
        .p_data = NULL,
        .len    = 0

    }
};


static void advertising_init(void)
{
    uint32_t      err_code;
   
   ble_gap_addr_t device_addr;
 
  
    memset(&amp;amp;m_adv_params, 0, sizeof(m_adv_params));

    m_adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
    m_adv_params.p_peer_addr     = NULL;    // Undirected advertisement.
    m_adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
    m_adv_params.interval        = NON_CONNECTABLE_ADV_INTERVAL;
    m_adv_params.duration        = 0;       // Never time out.
   

    //err_code = ble_advdata_encode(&amp;amp;advdata, m_adv_data.adv_data.p_data, &amp;amp;m_adv_data.adv_data.len);
    //APP_ERROR_CHECK(err_code);
    //if(err_code == NRF_SUCCESS)
    //{
    //       NRF_LOG_INFO(&amp;quot;ble_advdata_encode init successful !&amp;quot;);
    // }else
    // {
    //      NRF_LOG_INFO(&amp;quot;ble_advdata_encode init failed !&amp;quot;);
    // }
    //err_code  =    sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV,,4);               // +4dB Tx power was set for transmission    
    //APP_ERROR_CHECK(err_code);
        sd_ble_gap_addr_get(&amp;amp;device_addr);
	BC_advertData[MAC_1]=device_addr.addr[5];			 //MAC ADDRESS
	BC_advertData[MAC_1+1]=device_addr.addr[4];
	BC_advertData[MAC_1+2]=device_addr.addr[3];
	BC_advertData[MAC_1+3]=device_addr.addr[2];
	BC_advertData[MAC_1+4]=device_addr.addr[1];
	BC_advertData[MAC_1+5]=device_addr.addr[0];
     err_code = sd_ble_gap_adv_set_configure(&amp;amp;m_adv_handle, &amp;amp;m_adv_data, &amp;amp;m_adv_params);
    //APP_ERROR_CHECK(err_code);

   if(err_code == NRF_SUCCESS)
    {
     NRF_LOG_INFO(&amp;quot;sd_ble_gap_adv_set_configure init successful !&amp;quot;);
     }else
     {
      NRF_LOG_INFO(&amp;quot;sd_ble_gap_adv_set_configure init failed !&amp;quot;);
     }
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to broadcast raw data in beacon mode?</title><link>https://devzone.nordicsemi.com/thread/347519?ContentTypeID=1</link><pubDate>Thu, 13 Jan 2022 08:21:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20165715-fcd3-4dbd-bc64-2497aa6d299f</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Asish,&lt;/p&gt;
&lt;p&gt;Is there any error_code shows (err_code !=0) non-zero value after calling your function?&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Kazi Afroza Sultana&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>