Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Getting Secure Bootloader example in SDK 15 to run

I'm trying to learn the DFU process and how to include it in a project under development using SDK 15 and the nRF52 DK.  I programmed the DK with the S132 Softdevice and the pca10040_ble bootlader.  I'm using an Android tablet running nRF Connect to test.   I can see DFUTARG and connect (LED 3 goes on).  I copied one of the DFU test files to the tablet, hrs_application_s132.zip.  When I press the DFU button in nRF Connect, a menu comes up to select what type of file.  I chose Distribution packet (ZIP).  A menu then comes up for "Open From" and a list of locations for the file.  I picked SD card on the tablet where I copied the .zip file.  I can see the .zip file, but when I select it all I get is a display of the contents of the .zip file, and they appear grayed out.

What am I missing to get the DFU running?

Thanks,  Max

  • : I have seen issues with the file manager system on some Android devices , i.e that it opens .zip files instead of selecting the .zip file itself. Sometimes its related to the native file manager system and sometimes its related to a 3rd party one. Here are the links to some similar cases: 

    https://devzone.nordicsemi.com/f/nordic-q-a/18538/why-is-zip-for-dfu-in-nrf-toolbox-not-selectabel/71562#71562

    https://devzone.nordicsemi.com/f/nordic-q-a/17628/dfu-application-error

    So if you're using a 3rd party file manager, then try using the native one. If you're using the native one, try downloading a 3rd party one and use that instead. 

    Best regards

    Bjørn 

     

  • Bjorn,

    Thanks.  I'm using a Samsung Galaxy Tab A running Android 7.1.1.  It seems I cannot uninstall the Samsung default file manager.  I did install Total Commander referenced in one of the links above.  It appears in the nRF Connect menu to "Open from" and allows me to select the .zip file and start the DFU.   I see a graph pop up briefly to monitor the download.  However, it quickly disconnects and doesn't appear to have downloaded the app.

    I also tried the Google Drive option that also appears on the "Open from" list (after placing the zip file out on my Google Drive).  This behaves similar to the Total Commander.  DFU tries to start the download and also disconnects.

    So at least it seems the DFU is attempting to start with the .zip file from the SDK.  Still not getting the DFU completed.  Let me know if you're aware of other things to try.

    Max

  • : Great, then we're one step closer to getting this working. Could you post the log output from the nRF Connect mobile app when the DFU fails and the device disconnects? You should see the log if you swipe from left to right in the nRF Connect app.  

  • Bjorn,

    I tried saving the log file and inserting it here.  I hope it works ....haven't done this before.  Let me know if it tells you something meaningful.

    Max

    nRF Connect, 2018-05-08
    DfuTarg (D8:0A:B5:E5:69:E1)
    V	20:25:27.863	Connecting to D8:0A:B5:E5:69:E1...
    D	20:25:27.864	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE)
    D	20:25:28.193	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    D	20:25:28.199	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	20:25:28.199	Connected to D8:0A:B5:E5:69:E1
    V	20:25:28.210	Discovering services...
    D	20:25:28.210	gatt.discoverServices()
    D	20:25:28.709	[Callback] Services discovered with status: 0
    I	20:25:28.709	Services discovered
    V	20:25:28.732	Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    - Central Address Resolution [R] (0x2AA6)
    Generic Attribute (0x1801)
    Secure DFU Service (0xFE59)
    - DFU Packet [WNR] (8ec90002-f315-4f60-9fb8-838830daea50)
    - DFU Control Point [N W] (8ec90001-f315-4f60-9fb8-838830daea50)
       Client Characteristic Configuration (0x2902)
    D	20:25:28.732	gatt.setCharacteristicNotification(8ec90001-f315-4f60-9fb8-838830daea50, true)
    V	20:26:09.935	[DFU] DFU service started
    V	20:26:09.936	[DFU] Opening file...
    I	20:26:10.864	[DFU] Firmware file opened successfully
    V	20:26:10.864	[DFU] Connecting to DFU target...
    D	20:26:10.864	[DFU] gatt = device.connectGatt(autoConnect = false)
    I	20:26:11.081	[DFU] Connected to D8:0A:B5:E5:69:E1
    V	20:26:11.081	[DFU] Discovering services...
    D	20:26:11.081	[DFU] gatt.discoverServices()
    I	20:26:11.081	[DFU] Services discovered
    D	20:26:11.083	[DFU] wait(1000)
    V	20:26:12.092	[DFU] Requesting new MTU...
    D	20:26:12.093	[DFU] gatt.requestMtu(517)
    I	20:26:12.175	[DFU] MTU changed to: 247
    V	20:26:12.175	[DFU] Enabling notifications for 8ec90001-f315-4f60-9fb8-838830daea50
    D	20:26:12.175	[DFU] gatt.setCharacteristicNotification(8ec90001-f315-4f60-9fb8-838830daea50, true)
    D	20:26:12.175	[DFU] gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x01-00)
    I	20:26:12.175	[DFU] Data written to descr.8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 01-00
    V	20:26:12.175	[DFU] Notifications enabled for 8ec90001-f315-4f60-9fb8-838830daea50
    A	20:26:12.175	[DFU] Notifications enabled
    D	20:26:12.175	[DFU] wait(1000)
    V	20:26:13.200	[DFU] Writing to characteristic 8ec90001-f315-4f60-9fb8-838830daea50
    D	20:26:13.200	[DFU] gatt.writeCharacteristic(8ec90001-f315-4f60-9fb8-838830daea50)
    I	20:26:13.200	[DFU] Data written to 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 06-01
    I	20:26:13.203	[DFU] Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 60-06-01-00-01-00-00-00-00-00-00-00-00-00-00
    A	20:26:13.213	[DFU] Command object info received (Max size = 256, Offset = 0, CRC = 00000000)
    V	20:26:13.213	[DFU] Writing to characteristic 8ec90001-f315-4f60-9fb8-838830daea50
    D	20:26:13.213	[DFU] gatt.writeCharacteristic(8ec90001-f315-4f60-9fb8-838830daea50)
    I	20:26:13.249	[DFU] Data written to 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 02-00-00
    I	20:26:13.249	[DFU] Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 60-02-01
    A	20:26:13.249	[DFU] Packet Receipt Notif disabled (Op Code = 2, Value = 0)
    V	20:26:13.249	[DFU] Writing to characteristic 8ec90001-f315-4f60-9fb8-838830daea50
    D	20:26:13.249	[DFU] gatt.writeCharacteristic(8ec90001-f315-4f60-9fb8-838830daea50)
    I	20:26:13.258	Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value: (0x) 60-06-01-00-01-00-00-00-00-00-00-00-00-00-00
    A	20:26:13.258	"Response for: Read Object Info
    Status: Success
    Max object size: 256 bytes
    Current offset: 0 bytes
    CRC-32: 00000000" received
    I	20:26:13.260	Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value: (0x) 60-02-01
    A	20:26:13.260	"Response for: Set PRN value
    Status: Success" received
    I	20:26:13.260	Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value: (0x) 60-01-01
    A	20:26:13.260	"Response for: Create Object
    Status: Success" received
    I	20:26:13.275	[DFU] Data written to 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 01-01-8A-00-00-00
    I	20:26:13.275	[DFU] Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 60-01-01
    A	20:26:13.275	[DFU] Command object created
    V	20:26:13.275	[DFU] Writing to characteristic 8ec90002-f315-4f60-9fb8-838830daea50
    D	20:26:13.275	[DFU] gatt.writeCharacteristic(8ec90002-f315-4f60-9fb8-838830daea50)
    I	20:26:13.275	[DFU] Data written to 8ec90002-f315-4f60-9fb8-838830daea50, value (0x): 12-87-01-0A-41-08-01-12-3D-08-01-10-34-1A-05-A8-01-FE-95-03-20-00-28-00-30-00-38-F0-DB-02-42-24-08-03-12-20-87-8E-B0-33-B7-F4-3E-55-F6-48-53-6A-1C-9D-53-7F-3F-A3-28-36-9B-58-44-36-3F-5A-B2-5D-42-77-42-9A-48-01-10-00-1A-40-D8-F1-F5-7A-E9-FD-42-2B-DB-57-73-65-2C-9E-A6-AD-BF-C9-D9-36-01-C3-D3-F2-0D-25-4D-14-34-AB-A0-F9-3A-5A-E0-43-24-9F-E8-60-95-69-78-22-FC-9D-F0-56-C9-86-24-BE-50-31-69-A0-0D-6D-21-19-82-70-50-AD
    A	20:26:13.275	[DFU] Command object sent (CRC = 4DE1CD4E)
    V	20:26:13.275	[DFU] Writing to characteristic 8ec90001-f315-4f60-9fb8-838830daea50
    D	20:26:13.275	[DFU] gatt.writeCharacteristic(8ec90001-f315-4f60-9fb8-838830daea50)
    I	20:26:13.304	Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value: (0x) 60-03-01-8A-00-00-00-4E-CD-E1-4D
    A	20:26:13.304	"Response for: Calculate Checksum
    Status: Success
    Current offset: 138 bytes
    CRC-32: 4DE1CD4E" received
    I	20:26:13.310	[DFU] Data written to 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 03
    I	20:26:13.310	[DFU] Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 60-03-01-8A-00-00-00-4E-CD-E1-4D
    A	20:26:13.310	[DFU] Checksum received (Offset = 138, CRC = 4DE1CD4E)
    V	20:26:13.310	[DFU] Writing to characteristic 8ec90001-f315-4f60-9fb8-838830daea50
    D	20:26:13.310	[DFU] gatt.writeCharacteristic(8ec90001-f315-4f60-9fb8-838830daea50)
    I	20:26:13.340	[DFU] Data written to 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 04
    I	20:26:13.469	Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value: (0x) 60-04-05
    A	20:26:13.469	"Response for: Execute
    Status: Invalid object" received
    I	20:26:13.473	[DFU] Notification received from 8ec90001-f315-4f60-9fb8-838830daea50, value (0x): 60-04-05
    E	20:26:13.473	[DFU] Remote DFU error: INVALID OBJECT
    V	20:26:13.473	[DFU] Disconnecting...
    D	20:26:13.519	[DFU] gatt.disconnect()
    I	20:26:13.519	[DFU] Disconnected
    D	20:26:13.519	[DFU] gatt.refresh() (hidden)
    D	20:26:13.522	[DFU] gatt.close()
    D	20:26:13.522	[DFU] wait(600)
    

  • HI Max, 

    towards the end, just before the disconnect, you'll see the following error message

    E 20:26:13.473 [DFU] Remote DFU error: INVALID OBJECT

    This means that the public key in the bootloader and the private key used to sign the DFU image does not match. Could you try to follow the steps outlined on this Infocenter page on how to test the bootloader.

Related