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;           
							
}

Parents
  • Hi,

    I'm not sure if it is the longer advertisement data that is the reason you can't detect the DK. have you tried different COM ports? Can you find the device in Device Manager? Maybe try a different USB cable?

  • I am sure that this is the problem. I tried it many times. If I switch off NRF51DK and leave it few hours, I will sometime can use recovery (nrfjprog --recover). I tried it on 3 different USB and even on different computer, but result is the same...There is not problem with USB, so DK is in Device Manager, but it doesn't mean, that Nordic chip is OK...I tried it even with short data (only 10 bytes) and everything was correct.........I know now, that setting short name and data length to 20 bytes cause error NRF_ERROR_DATA_SIZE, but it shouldn't be reason for total crash, but it happens...If you have this DK, you can try it yourself.

Reply
  • I am sure that this is the problem. I tried it many times. If I switch off NRF51DK and leave it few hours, I will sometime can use recovery (nrfjprog --recover). I tried it on 3 different USB and even on different computer, but result is the same...There is not problem with USB, so DK is in Device Manager, but it doesn't mean, that Nordic chip is OK...I tried it even with short data (only 10 bytes) and everything was correct.........I know now, that setting short name and data length to 20 bytes cause error NRF_ERROR_DATA_SIZE, but it shouldn't be reason for total crash, but it happens...If you have this DK, you can try it yourself.

Children
No Data
Related