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

Advertising data can destroy device ?

Hi.

Why longer advertising data destroy device ?

When I set length of advertising data to 20bytes in advertising_init(), device will crash and I can't download new firmware anymore and nothing can detect NRF51DK connected to PC via USB.

I have set SHORT_NAME and MANUFACTURE_DATA.

static void advertising_init(char * data)
{   
        uint32_t        err_code;
        ble_advdata_t   advdata;
        uint8_t         flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
				ble_advdata_t scanrsp;			
				
				ble_uuid_t adv_uuids[] = {{BLE_JACKX_SERVICE_UUID, BLE_UUID_TYPE_BLE}};

        // Build and set advertising data
        memset(&advdata, 0, sizeof(advdata));
        advdata.name_type               = BLE_ADVDATA_SHORT_NAME;//BLE_ADVDATA_FULL_NAME;
        advdata.include_appearance      = false;
        advdata.flags.size              = sizeof(flags);
        advdata.flags.p_data            = &flags;
			  
				 ble_advdata_manuf_data_t        manuf_data; // Variable to hold manufacturer specific data				
				manuf_data.company_identifier       = 0x0; // Nordics company ID
				manuf_data.data.p_data              = (uint8_t*)data;     
				manuf_data.data.size                = 18;
				advdata.p_manuf_specific_data = &manuf_data;
				
        memset(&scanrsp, 0, sizeof(scanrsp));
        scanrsp.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
        scanrsp.uuids_complete.p_uuids  = adv_uuids;
				
        err_code = ble_advdata_set(&advdata, NULL);							
        APP_ERROR_CHECK(err_code);

        // Initialize advertising parameters (used when starting advertising).
        memset(&m_adv_params, 0, sizeof(m_adv_params));

				m_adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
				m_adv_params.p_peer_addr = NULL;
				m_adv_params.fp          = BLE_GAP_ADV_FP_ANY;
				m_adv_params.interval    = APP_ADV_INTERVAL;//APP_CONFIG_ADV_INTERVAL;
				m_adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;//0;//APP_ADV_TIMEOUT_IN_SECONDS;//APP_CONFIG_ADV_TIMEOUT;           
							
}

Related