Unable to perform OTA DFU

Board: nRF52833

SoftDevice: s140

SDK version: 17.0.2

I've added OTA DFU feature to my application. I flashed pca10100_s140_ble bootloader and my application to my board, but my application doesn't work. To debug the error I've followed the solution provided in the link https://devzone.nordicsemi.com/f/nordic-q-a/86402/unable-to-debug-the-application-with-bootloader. I made app_is_valid() function to always return true and flashed on my board, My application works fine. Then I tried to perform OTA DFU using nrf connect for mobile app I'm getting the following error

nRF Connect, 2022-04-10
No name (E3:EA:FD:9B:DB:9F)
I	15:32:24.677	[Server] Server started
V	15:32:24.721	Heart Rate (0x180D)
- Heart Rate Measurement [N] (0x2A37)
   Client Characteristic Configuration (0x2902)
- Body Sensor Location [R] (0x2A38)
- Heart Rate Control Point [W] (0x2A39)
Unknown Service (0000aaa0-0000-1000-8000-aabbccddeeff)
- Unknown Characteristic [N R] (0000aaa1-0000-1000-8000-aabbccddeeff)
   Client Characteristic Configuration (0x2902)
   Unknown Descriptor (0000aab0-0000-1000-8000-aabbccddeeff)
   Characteristic User Description (0x2901)
   Characteristic Presentation Format (0x2904)
- Unknown Characteristic [I W WNR] (0000aaa2-0000-1000-8000-aabbccddeeff)
   Client Characteristic Configuration (0x2902)
User Data (0x181C)
- First Name [R W] (0x2A8A)
- Last Name [R W] (0x2A90)
- Gender [R W] (0x2A8C)
Secure DFU Service (0xFE59)
- Buttonless DFU [I N W] (8ec90003-f315-4f60-9fb8-838830daea50)
   Client Characteristic Configuration (0x2902)
D	15:32:24.721	[Server callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I	15:32:24.722	[Server] Device with address E3:EA:FD:9B:DB:9F connected
I	15:32:24.898	[Server] PHY updated (TX: LE 2M, RX: LE 2M)
V	15:32:24.983	Connecting to E3:EA:FD:9B:DB:9F...
D	15:32:24.983	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, opportunistic = true, preferred PHY = LE 1M) (hidden)
D	15:32:25.022	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I	15:32:25.022	Connected to E3:EA:FD:9B:DB:9F
V	15:32:25.178	Discovering services...
D	15:32:25.178	gatt.discoverServices()
I	15:32:25.257	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
D	15:32:25.369	[Callback] Services discovered with status: 0
I	15:32:25.369	Services discovered
V	15:32:25.392	Generic Access (0x1800)
- Device Name [R] (0x2A00)
- Appearance [R] (0x2A01)
- Peripheral Preferred Connection Parameters [R] (0x2A04)
- Central Address Resolution [R] (0x2AA6)
Generic Attribute (0x1801)
Secure DFU Service (0xFE59)
- Buttonless DFU [I W] (8ec90003-f315-4f60-9fb8-838830daea50)
   Client Characteristic Configuration (0x2902)
I	15:32:25.465	Connection parameters updated (interval: 30.0ms, latency: 0, timeout: 4000ms)
V	15:32:35.757	[DFU] DFU service started
V	15:32:35.757	[DFU] Opening file...
I	15:32:35.876	[DFU] Firmware file opened successfully
V	15:32:35.876	[DFU] Connecting to DFU target...
D	15:32:35.876	[DFU] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferredPhy = LE_1M | LE_2M)
I	15:32:35.876	[DFU] Connected to E3:EA:FD:9B:DB:9F
V	15:32:35.876	[DFU] Discovering services...
D	15:32:35.876	[DFU] gatt.discoverServices()
I	15:32:35.888	[DFU] Services discovered
D	15:32:35.913	[DFU] wait(1000)
W	15:32:36.907	[DFU] Application with buttonless update found
V	15:32:36.907	[DFU] Jumping to the DFU Bootloader...
V	15:32:36.907	[DFU] Enabling indications for 8ec90003-f315-4f60-9fb8-838830daea50
D	15:32:36.907	[DFU] gatt.setCharacteristicNotification(8ec90003-f315-4f60-9fb8-838830daea50, true)
D	15:32:36.907	[DFU] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x02-00)
I	15:32:36.972	[DFU] Data written to descr.8ec90003-f315-4f60-9fb8-838830daea50, value (0x): 02-00
V	15:32:36.972	[DFU] Notifications enabled for 8ec90003-f315-4f60-9fb8-838830daea50
A	15:32:36.972	[DFU] Indications enabled
D	15:32:36.972	[DFU] wait(1000)
V	15:32:37.985	[DFU] Writing to characteristic 8ec90003-f315-4f60-9fb8-838830daea50
D	15:32:37.985	[DFU] gatt.writeCharacteristic(8ec90003-f315-4f60-9fb8-838830daea50)
I	15:32:38.057	[DFU] Notification received from 8ec90003-f315-4f60-9fb8-838830daea50, value (0x): 20-01-01
A	15:32:38.057	[DFU] Enter bootloader sent (Op Code = 1)
A	15:32:38.057	[DFU] Response received (Op Code = 1, Status = 1)
D	15:32:38.057	[DFU] gatt.refresh() (hidden)
D	15:32:38.057	[DFU] gatt.disconnect()
D	15:32:38.057	[DFU] gatt.close()
V	15:32:38.057	[DFU] Scanning for the DFU Bootloader...
D	15:32:42.087	[Server callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
I	15:32:42.087	[Server] Device disconnected
D	15:32:42.200	[Callback] Connection state changed with status: 22 and new state: DISCONNECTED (0)
E	15:32:42.201	Error 22 (0x16): GATT CONN TERMINATE LOCAL HOST
I	15:32:42.201	Disconnected
I	15:32:43.189	[DFU] DFU Bootloader not found. Trying the same address...
V	15:32:43.220	[DFU] DFU service started
I	15:32:43.220	[DFU] Firmware file opened successfully
D	15:32:43.220	[DFU] wait(1000)
D	15:32:44.267	[DFU] wait(1000)
V	15:32:45.221	[DFU] Connecting to DFU target...
D	15:32:45.307	[DFU] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferredPhy = LE_1M | LE_2M)
D	15:33:15.246	[Server callback] Connection state changed with status: 0 and new state: DISCONNECTED (0)
I	15:33:15.246	[Server] Device disconnected
E	15:33:15.306	[DFU] Error 133: Connection timeout
W	15:33:15.307	[DFU] Retrying...
D	15:33:15.307	[DFU] gatt.refresh() (hidden)
D	15:33:15.307	[DFU] gatt.disconnect()
D	15:33:15.307	[DFU] gatt.close()
V	15:33:15.357	[DFU] DFU service started
I	15:33:15.357	[DFU] Firmware file opened successfully
D	15:33:15.357	[DFU] wait(1000)
D	15:33:16.367	[DFU] wait(1000)
V	15:33:17.343	[DFU] Connecting to DFU target...
D	15:33:17.343	[DFU] gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferredPhy = LE_1M | LE_2M)

How can I solve this issue?

Thanks in advance.   

Parents
  • Hello,

    When programming the application directly you also have to include the bootloader settings page (see Generating and displaying bootloader settings). Without the settings page the bootloader will not be able to boot the application.

    e.g.

    $ nrfutil settings generate --family NRF52 --application app.hex --application-version 1 --bootloader-version 1 --bl-settings-version 2 settings.hex

    $ nrfjprog --program settings.hex --sectorerase -r

    Are you able to perform DFU from the bootloader when the application is not present?

    Best regards,

    Vidar

  • Hi Vidar,

    I've included the settings page, still I'm getting the same error.

    I'm not able to perform DFU from the bootloader when the application is not present.

  • Hi,

    Nabeel Ar said:
    I've included the settings page, still I'm getting the same error.

    Yes, but you are able to boot the application, right? You should also revert the changes you made earlier to make sure the bootloader does not boot an invalid app.

    Nabeel Ar said:
    I'm not able to perform DFU from the bootloader when the application is not present.

    What error message do you get then?

  • Hi,

    What error message do you get then?

    It doesn't even advertise as "Dfutarg". So I am not even able to connect to it.

    Yes, but you are able to boot the application, right? You should also revert the changes you made earlier to make sure the bootloader does not boot an invalid app.

    The only change I've done in the bootloader is to make app_is_valid() function always return true. I made this change in order to access the debug terminal. Here My application works fine but I'm not able to perform DFU as I get the error that I mentioned before.

    Then I've reverted the changes that I've made in the bootloader. Now my application doesn't work and I am not even able to debug the error.

    I have two questions here:

    1. What exactly happens when app_is_valid() function calls which stops my application from booting and how can I solve it?

    2. Why I am getting Bootloader not found error in app_is_valid() function always true state and how can I solve it?

    Appreciate your help. Thanks in Advance.

  • Hi,

    Nabeel Ar said:
    It doesn't even advertise as "Dfutarg". So I am not even able to connect to it.

    The device will crash if you have disabled the app_is_valid() check, because then the bootloader will attempt to boot an application that does not exist.

    Nabeel Ar said:
    Then I've reverted the changes that I've made in the bootloader. Now my application doesn't work and I am not even able to debug the error.

    Please start with the unmodified bootloader and verify that you can get DFU to work before trying buttonless DFU.

  • Please start with the unmodified bootloader and verify that you can get DFU to work before trying buttonless DFU.

    I've reverted all the changes I've made. I flashed BL + SD in my DK but it didn't display as Dfutarg. Then I flashed BL + SD + APP it advertises as Dfutarg now. Then I.ve tried to do the OTA DFU process and it works fine. But this only works in my DK, not in my custom device.

    Why is it advertising as Dfutarg after my application is flashed with my BL and SD?

    Why it is working only in my DK, not in my custom device which both has nRF2833 in it.

Reply
  • Please start with the unmodified bootloader and verify that you can get DFU to work before trying buttonless DFU.

    I've reverted all the changes I've made. I flashed BL + SD in my DK but it didn't display as Dfutarg. Then I flashed BL + SD + APP it advertises as Dfutarg now. Then I.ve tried to do the OTA DFU process and it works fine. But this only works in my DK, not in my custom device.

    Why is it advertising as Dfutarg after my application is flashed with my BL and SD?

    Why it is working only in my DK, not in my custom device which both has nRF2833 in it.

Children
Related