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

Can i set macaddress in bootloader and advertising it?

bootloader.rar(/attachment/d5fd4fbbc7d37433740f6c9468f3110b) bootloader_dfu.rar Hi,all.i want to set same macaddress with my app in bootloader,and advertise it in bootloader,that my phone can know the device is the updating device.Can do it as this?Thanks a lot!

Parents Reply Children
  • Thanks, Hung Bui! i want advertising Mac address in manufdata in "advertising_init" function.but if i do this,device name change from Dfutarg to no name.what's wrong?

  • @wuvo.leo: Could be smth wrong with the advertising packet setup. Make sure you don't use too long name and manufacturing data. Maximum advertising packet size is 31 bytes. If you need more you can use scan response packet. If you still have trouble, please upload your project here.

  • Hi,Hung Bui.Thanks for your reply first. i still have trouble.i paste my function here:


    static void advertising_init(uint8_t adv_flags)
    {
        uint32_t      err_code;
        ble_advdata_t advdata;
        ble_uuid_t    service_uuid;
    	  ble_advdata_manuf_data_t manufdata;
    	  int32_t       uniqueid[2] = {NRF_FICR->DEVICEADDR1, NRF_FICR->DEVICEADDR0};
        uint8_t addrarray[8] = { 0 };
    
        service_uuid.type = m_dfu.uuid_type;
        service_uuid.uuid = BLE_DFU_SERVICE_UUID;
    		
    	  memset(&manufdata, 0, sizeof(manufdata));
        manufdata.company_identifier = 0xFF90;
        manufdata.data.size = 6;
    	
    	  memcpy( (void *)&addrarray,(void *)&uniqueid,sizeof(addrarray) );
    	  addrarray[1] |= 0xc0;
    	  memcpy( (void *)&addrarray[2],(void *)&addrarray[4],4);
    	  manufdata.data.p_data = ((unsigned char*)addrarray);
        memset(&advdata, 0, sizeof(advdata));
    
        advdata.name_type                     = BLE_ADVDATA_FULL_NAME;
        advdata.include_appearance            = false;
        advdata.flags                         = adv_flags;
        advdata.uuids_more_available.uuid_cnt = 1;
        advdata.uuids_more_available.p_uuids  = &service_uuid;
    		advdata.p_manuf_specific_data   = &manufdata;
    
        err_code = ble_advdata_set(&advdata, NULL);
        APP_ERROR_CHECK(err_code);
    }
    

    i used nRF Master Control pannel to find my device,and display my device name "n/a",no connect button.Please help me.Thank you!

  • @wuvo.leo: How does you set the device name ? It should be set in gap_params_init().

    Regarding "no connect button", you need to check the advertising type if it's connectable.

  • i set default device name "DfuTarg"。when i add manufdata in function "advertising_init", MCP find the device and name is "n/a",connect button dispear(android).i didn't edit advertising type that keeping original。Thank you again!

Related