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

How can I use nRF Toolbox to switch it to bootloader and do OTA together in nRF5_SDK_12.2.0?

Hi all,

I have use nRF5_SDK_11.0.0_89a8197 and S130 before and use nRF Toolbox to do switch it to bootloader and do OTA, just use one APP. However, now I'm using nRF5_SDK_12.2.0_f012efa and S132 on nRF52832 and also need to do the OTA, I found that it need to use nRF Connect to send 0x01 to the make the device switch to bootloader, only finish it then I can use nRF Toolbox to do OTA. It use two app and this seems to not so convenient.

Now I have add a another characteristic(0x1532) according to the DFU service in nRF5_SDK_11.0.0_89a8197. The on_write function from the BLE_GATTS_EVT_WRITE event in ble_dfu_on_ble_evt function has been modified by me as follow:

`static void on_write(ble_dfu_t * p_dfu, ble_evt_t const * p_ble_evt)
{
    const ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write;
    if((p_evt_write->handle == p_dfu->control_point_char.cccd_handle)||
			 (p_evt_write->handle == p_dfu->dfu_pkt_handles.value_handle))
    {       				
				if((p_evt_write->len == BLE_CCCD_VALUE_LEN)&&(p_evt_write->handle == p_dfu->control_point_char.cccd_handle))
				{
						// CCCD written, update indications state
						p_dfu->is_ctrlpt_notification_enabled = ble_srv_is_notification_enabled(p_evt_write->data);

						if (p_dfu->evt_handler != NULL)
						{
								ble_dfu_evt_t evt;

								if (p_dfu->is_ctrlpt_notification_enabled)
								{
										evt.type = BLE_DFU_EVT_INDICATION_ENABLED;;
								}
								else
								{
										evt.type = BLE_DFU_EVT_INDICATION_DISABLED;;
								}

								p_dfu->evt_handler(p_dfu, &evt);
						}
				}
				if (p_evt_write->handle == p_dfu->dfu_pkt_handles.value_handle)
				{
						// DFU Packet written
							resp_send(p_dfu, DFU_OP_ENTER_BOOTLOADER, DFU_RSP_SUCCESS);
							enter_bootloader(p_dfu);
				}	
		}
		else
		{
			return;
		}
}`

I can see "Starting DFU" log on the DFU APP and the LED1 and LED3 is on, it states that the device is in bootloader mode and it is advtising as DfuTarg. But the APP wouldn't connect the device again and upload the ZIP to transfer it to the device. Could anyone tell me how to do? Thanks a lot.

Related