Hard Fault in ble_dfu_unbounded.c from SDK 17.1.0 (secure bootloader)

Hi!

I'm using some common bootloader code for different devices. 
One of my devices is a bit different, with an LED library that caused me to increase the BL size in the linker. 
This is not happening on my other devices, which is why I mentioned the different linker.
2 of them also have a modified linker for a small LCD driver. Those work great!

When I debug the application jumping to bootloader with NRF DFU IOS app, 
I get a hard fault in nrf_dfu_set_adv_name(). Name should be "DfuTarg", from my bootloader make file

CFLAGS += -DDEVICE_NAME=\"DfuTarg\" -DNRF_DFU_BLE_ADV_NAME=\"DfuTarg\"
CFLAGS += -DNRF_DFU_DEBUG_VERSION
CFLAGS += -DNRF_DFU_SETTINGS_VERSION=2
CFLAGS += -DNRF_DFU_SVCI_ENABLED
In my application makefile 
CFLAGS += -DNRF_DFU_SVCI_ENABLED -DNRF_DFU_TRANSPORT_BLE=1
CFLAGS += -DNRF_DFU_SETTINGS_VERSION=2

As you can see here, Dfu31280 is showing up instead of DfuTarg, 

Here is the call stack, HardFault is where the PC indicates inside NMI_Handler

  • The bootloader adv name matches on both sides. 

    nrf connect log - 

    [07:34:59.3770] Normal: Starting Secure DFU...
    [07:34:59.3780] Normal: Connected to BMS
    [07:34:59.3780] Normal: Services discovered
    [07:34:59.3780] Normal: Secure DFU Service found
    [07:34:59.3780] Normal: Discovering characteristics in DFU Service...
    [07:34:59.3780] Normal: DFU characteristics discovered
    [07:34:59.3780] Normal: Enabling indications for 8EC90003-F315-4F60-9FB8-838830DAEA50...
    [07:34:59.4380] Normal: Indications enabled for 8EC90003-F315-4F60-9FB8-838830DAEA50
    [07:34:59.4380] Normal: Buttonless DFU indications enabled
    [07:34:59.4380] Warning: Application with buttonless update found
    [07:34:59.4380] Normal: Trying setting bootloader name to Dfu67283
    [07:34:59.4380] Normal: Writing to characteristic 8EC90003-F315-4F60-9FB8-838830DAEA50...
    [07:34:59.4990] Normal: Data written to 8EC90003-F315-4F60-9FB8-838830DAEA50
    [07:34:59.5010] Normal: Indication received from 8EC90003-F315-4F60-9FB8-838830DAEA50, value (0x):200201
    [07:34:59.5010] Normal: Response (Op Code = Set Name, Status = Success) received
    [07:34:59.5010] Normal: Bootloader name changed successfully
    [07:34:59.5010] Normal: Writing to characteristic 8EC90003-F315-4F60-9FB8-838830DAEA50...
    [07:34:59.5600] Normal: Data written to 8EC90003-F315-4F60-9FB8-838830DAEA50
    [07:34:59.5610] Normal: Indication received from 8EC90003-F315-4F60-9FB8-838830DAEA50, value (0x):200101
    [07:34:59.5610] Normal: Response (Op Code = Enter Bootloader, Status = Success) received
    [07:35:00.3380] Normal: Disconnected.
    [07:35:00.3430] Normal: Disconnected by the remote device
    [07:35:00.3430] Normal: Scanning for the DFU Bootloader...
    [07:35:10.3410] Warning: Scanning timed out returning no matching peripherals!
    [07:35:10.3430] Error: DFU Failed with Error: No DFU device found.

    Bootloader RTT log - 

    <debug> nrf_dfu_ble: Initializing BLE DFU transport
    <debug> nrf_dfu_ble: Setting up vector table: 0x000F0000
    <debug> nrf_dfu_ble: Enabling SoftDevice.
    <debug> nrf_dfu_ble: Configuring BLE stack.
    <debug> nrf_dfu_ble: Enabling the BLE stack.
    <debug> nrf_dfu_ble: Setting adv name: Dfu67283, length: 8
    <debug> nrf_dfu_ble: Advertising...
    <debug> nrf_dfu_ble: BLE DFU transport initialized.
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_sd backend.
    <debug> app: Enter main loop

  • In the nRF connect app, if you go back to the Scanning view after the DFU timeout, do you see the device advertising as "Dfu67283"? The log indicates that the phone is unable to find any device advertising with that name.

  • yes. Since this is a new session, it was Dfu34476 , that matches the bootloader RTT log. 
    It does show up in the nRF connect app.

  • Thanks for confirming. Are you able to connect to the device manually if you click the connect button?

Related