static uint32_t dfu_char_add(ble_dfu_t * p_dfu, const ble_dfu_init_t * p_dfu_init) { /**@snippet [Adding proprietary characteristic to S110 SoftDevice] */ ble_gatts_char_md_t char_md; ble_gatts_attr_md_t cccd_md; ble_gatts_attr_t attr_char_value; ble_uuid_t ble_uuid; ble_gatts_attr_md_t attr_md; memset(&cccd_md, 0, sizeof(cccd_md)); BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm); cccd_md.vloc = BLE_GATTS_VLOC_STACK; memset(&char_md, 0, sizeof(char_md)); char_md.char_props.notify = 1; char_md.char_props.write = 1; //dfu chenyaojie char_md.char_props.read = 1; char_md.p_char_user_desc = NULL; char_md.p_char_pf = NULL; char_md.p_user_desc_md = NULL; char_md.p_cccd_md = &cccd_md; char_md.p_sccd_md = NULL; ble_uuid.type = p_dfu->uuid_type; ble_uuid.uuid = 0x0001; memset(&attr_md, 0, sizeof(attr_md)); BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm); BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); attr_md.vloc = BLE_GATTS_VLOC_STACK; attr_md.rd_auth = 0; attr_md.wr_auth = 1; attr_md.vlen = 1; memset(&attr_char_value, 0, sizeof(attr_char_value)); attr_char_value.p_uuid = &ble_uuid; attr_char_value.p_attr_md = &attr_md; attr_char_value.init_len = 0; attr_char_value.init_offs = 0; attr_char_value.max_len = BLE_L2CAP_MTU_DEF; return sd_ble_gatts_characteristic_add(p_dfu->service_handle, &char_md, &attr_char_value, &p_dfu->control_point_char); /**@snippet [Adding proprietary characteristic to S110 SoftDevice] */ } uint32_t ble_dfu_init(ble_dfu_t * p_dfu, const ble_dfu_init_t * p_dfu_init) { uint32_t err_code; ble_uuid_t ble_uuid; ble_uuid128_t nus_base_uuid = BLE_DFU_BASE_UUID; VERIFY_PARAM_NOT_NULL(p_dfu); VERIFY_PARAM_NOT_NULL(p_dfu_init); p_m_dfu = p_dfu; // TODO: find a nicer solution to this // Initialize the service structure. p_dfu->conn_handle = BLE_CONN_HANDLE_INVALID; p_dfu->evt_handler = p_dfu_init->evt_handler; p_dfu->is_waiting_for_disconnection = false; p_dfu->is_ctrlpt_notification_enabled = false; /**@snippet [Adding proprietary Service to S110 SoftDevice] */ // Add a custom base UUID. err_code = sd_ble_uuid_vs_add(&nus_base_uuid, &p_dfu->uuid_type); VERIFY_SUCCESS(err_code); ble_uuid.type = p_dfu->uuid_type; ble_uuid.uuid = BLE_UUID_DFU_SERVICE; // Add the service. err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_dfu->service_handle); /**@snippet [Adding proprietary Service to S110 SoftDevice] */ VERIFY_SUCCESS(err_code); // Add the RX Characteristic. err_code = dfu_char_add(p_dfu, p_dfu_init); VERIFY_SUCCESS(err_code); // err_code = ble_dfu_buttonless_char_add(p_dfu); // VERIFY_SUCCESS(err_code); err_code = nrf_dfu_flash_init(true); VERIFY_SUCCESS(err_code); nrf_dfu_settings_init(); return NRF_SUCCESS; }
this is my code on DFU function, I copy to the example of experimental_ble_app_buttonless_dfu on SDK12.1. I used nrfgo studio to program s130_nrf51_2.0.1_softdevice , boot_setting.hex(used nrfutil to produce ), nrf51822_xxac_s130. and then my cellphone can connect to "DFUTarg" to DFU my application. I can used to cellphone to connect my application finally.
I click to "1" and "2" in the picture,but it can not skip to boot mode(DFUTarg).this is why i do not know.
If i direct to "DFU" download to application,then the cellphone stop at the following screen.
why i can not skip to the boot mode from the application?