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

How BLE scan is done in the DFU (OTA) example?

Hi,

For nRF52840 BLE, in the DFU (OTA) example (buttonless OTA):

../nRF5_SDK_15.3.0_59ac345/examples/ble_peripheral/ble_app_buttonless_dfu

How scanning is done? Or where and which function initializes scan parameters?  Something similar to 

nrf_ble_scan_init_t init_scan;
m_scan.scan_params.window = m_iCommandScanWindow_MS; //MIN_SCAN_WINDOW;
m_scan.scan_params.interval = SCAN_INTERVAL;
m_scan.scan_params.timeout = 0;
m_scan.scan_params.scan_phys = 0 ;

err_code = nrf_ble_scan_init(&m_scan, &init_scan, scan_evt_handler);

Is there any way that I can modify the scanning interval and scanning timeout?

Thank You,

David Zhou

Parents Reply Children
  • Vidar,

    Ok, DFU controller is at the host side. So I guess the CONNECT button on the DFU controller is connecting to the advertisement by the Device. BUT how and when the BLE device starts the firmware update process without scanning? I am still missing this point. Please explain. On the Host side (Andriod), clicks DFU icon, opens firmware .zip file, and reads firmware data into buffer, THEN it trys to connect DFU Target, (THIS SHALL BE THE DEVICE SIDE). It finds the services, ..., then JUMPing to DFU bootloader. SO where and how the DFU controller is connected to the DEVICE:

    Connected to DA:D5:58:B8:6F:C1

    If the device is not scanning? Sorry, I am missing something here.

    Regards,

    David

    //=============================================

    I 12:00:10.042 [DFU] Firmware file opened successfully
    V 12:00:10.042 [DFU] Connecting to DFU target...
    D 12:00:10.044 [DFU] gatt = device.connectGatt(autoConnect = false)
    I 12:00:10.051 [DFU] Connected to DA:D5:58:B8:6F:C1
    V 12:00:10.052 [DFU] Discovering services...
    D 12:00:10.052 [DFU] gatt.discoverServices()
    I 12:00:10.055 [DFU] Services discovered
    D 12:00:10.075 [DFU] wait(1000)
    I 12:00:10.631 Connection parameters updated (interval: 198.75ms, latency: 0, timeout: 4000ms)
    W 12:00:11.066 [DFU] Application with buttonless update found
    V 12:00:11.066 [DFU] Jumping to the DFU Bootloader...
    V 12:00:11.066 [DFU] Enabling indications for 8ec90003-f315-4f60-9fb8-838830daea50
    D 12:00:11.066 [DFU] gatt.setCharacteristicNotification(8ec90003-f315-4f60-9fb8-838830daea50, true)
    D 12:00:11.067 [DFU] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x02-00)
    I 12:00:11.302 [DFU] Data written to descr.8ec90003-f315-4f60-9fb8-838830daea50, value (0x): 02-00
    V 12:00:11.302 [DFU] Notifications enabled for 8ec90003-f315-4f60-9fb8-838830daea50
    A 12:00:11.307 [DFU] Indications enabled
    D 12:00:11.309 [DFU] wait(1000)
    V 12:00:12.324 [DFU] Writing to characteristic 8ec90003-f315-4f60-9fb8-838830daea50
    D 12:00:12.324 [DFU] gatt.writeCharacteristic(8ec90003-f315-4f60-9fb8-838830daea50)
    A 12:00:12.693 [DFU] Enter bootloader sent (Op Code = 1)
    I 12:00:12.695 [DFU] Notification received from 8ec90003-f315-4f60-9fb8-838830daea50, value (0x): 20-01-01
    A 12:00:12.695 [DFU] Response received (Op Code = 1, Status = 1)
    D 12:00:16.906 [Callback] Connection state changed with status: 8 and new state: DISCONNECTED (0)
    E 12:00:16.906 Error 8 (0x8): GATT CONN TIMEOUT
    I 12:00:16.906 Disconnected

Related