This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf52832 stopped advertsing after some time

hello,

i am using nrf52832 with sdk 15.2 using ble_app_uart example and my beacon stops axdvertsing after sometime can someone help me how can make it advertise continosuly my advertsing init function looks like this

void advertising_init(void)
{
ret_code_t err_code;

/* This needs to be static because of SoftDevice API requirements. */

ble_gap_adv_data_t m_adv_data =
{
.adv_data =
{
.p_data = m_enc_advdata,
.len = 31,
}
};

device_addrP=device_addr;
sd_ble_gap_addr_get(device_addrP);


/* Encode flags. */

m_enc_advdata[0] = 0x0A;
m_enc_advdata[1] = BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME;
m_enc_advdata[2] = 0x31;
m_enc_advdata[3] = 0x31;
m_enc_advdata[4] = 0x34;
m_enc_advdata[5] = 0x42;
m_enc_advdata[6] = 0x2D;
m_enc_advdata[7] = 0x31;
m_enc_advdata[8] = 0x37;
m_enc_advdata[9] = 0x36;
m_enc_advdata[10] = 0x32;
m_enc_advdata[11] = 0x02;
m_enc_advdata[12] = BLE_GAP_AD_TYPE_FLAGS;
m_enc_advdata[13] = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
m_enc_advdata[14] = 0x10;
m_enc_advdata[15] = BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA;
m_enc_advdata[16] = 0xFF;
m_enc_advdata[17] = 0x20;
m_enc_advdata[19] = device_addr[1];
m_enc_advdata[18] = device_addr[2];

ble_gap_adv_params_t adv_params;

// Set advertising parameters.
memset(&adv_params, 0, sizeof(adv_params));

adv_params.primary_phy = BLE_GAP_PHY_1MBPS;
adv_params.duration = APP_ADV_DURATION;
adv_params.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
adv_params.p_peer_addr = NULL;
adv_params.filter_policy = BLE_GAP_ADV_FP_ANY;
adv_params.interval = APP_ADV_INTERVAL;

err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &adv_params);
APP_ERROR_CHECK(err_code);
}

i also adding the advertising packtes like this also

void my_sensor_data()

{

    m_enc_advdata[19]=data;

}

while(1)

{

my_sensor_data();

}

can someone help me with this??

thanks and regards

ps anu

  • Hello,

    i am using nrf52832 with sdk 15.2 using ble_app_uart example and my beacon stops axdvertsing after sometime can someone help me how can make it advertise continosuly my advertsing init function looks like this

    Please elaborate on the behavior you are seeing. Does the device reset when advertising stops? Does it happen after having advertised for a specific time every time? Do you see any other unexpected behavior when this happens?

    adv_params.duration = APP_ADV_DURATION;

    What is the value of your APP_ADV_DURATION define? It should be 0 to configure continuous advertising.

    For future reference, please use the Insert -> Code option when sharing code here on DevZone. It drastically increases the readability of your code.

    Best regards,
    Karl

Related