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

Parents
  • Hello,

    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

    The iOS DFU lib will send the "Set advertisement name" command to change the advertisement name to be used in DFU mode before sending the "Enter DFU mode" command. Setting a unique adv. name (like "Dfu31280" in this case) is how the phone is automatically able to recconnect to the device after it has entered DFU mode. On android you don't have to do this as it allows you to specify which BLE address you want to connect to.

    Does your application call ble_dfu_buttonless_async_svci_init() at the beginning of main()? If not the function pointer for nrf_dfu_set_adv_name() will not be initialized correctly which will result in  a fault exception when called.

    Best regards,

    Vidar

  • That was good advice Vidar. 
    I added that to my application, and the jump to the bootloader happens successfully with no hardfault. 

    The new issue - The bootloader is using adv name Dfu91426 instead of DfuTarg. 
    The NRF DFU app just hangs after 'Bootloader Enabled' and Fails at 'DFU initialization' 

    <debug> app: Initializing transports (found: 1)
    <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: Dfu91426, 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

  • 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?

  • Interesting. Is there any delay between when the bootloader starts and when advertising begins in your version? The app will time out if advertising does not start within 10 seconds. 

    It is also possible to test DFU without the adv. name change by disabling this configuration here: 


  • No delay. I see the blootloader RTT console immediately advertising.
    I tried turning off the alternative advertising mode - DfuTarg is showing up after the failure and I can connect to it. 

    <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: No advertising name found
    <debug> nrf_dfu_ble: Using default advertising name
    <debug> nrf_dfu_ble: Advertising...
    <debug> nrf_dfu_ble: BLE DFU transport initialized.
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_sd backend.

    nRF console log

    [10:42:11.9130] Normal: Services discovered
    [10:42:11.9130] Normal: Secure DFU Service found
    [10:42:11.9130] Normal: Discovering characteristics in DFU Service...
    [10:42:11.9130] Normal: DFU characteristics discovered
    [10:42:11.9130] Normal: Enabling indications for 8EC90003-F315-4F60-9FB8-838830DAEA50...
    [10:42:11.9550] Normal: Indications enabled for 8EC90003-F315-4F60-9FB8-838830DAEA50
    [10:42:11.9550] Normal: Buttonless DFU indications enabled
    [10:42:11.9550] Warning: Application with buttonless update found
    [10:42:11.9550] Normal: Writing to characteristic 8EC90003-F315-4F60-9FB8-838830DAEA50...
    [10:42:12.1060] Normal: Data written to 8EC90003-F315-4F60-9FB8-838830DAEA50
    [10:42:12.1070] Normal: Indication received from 8EC90003-F315-4F60-9FB8-838830DAEA50, value (0x):200101
    [10:42:12.1070] Normal: Response (Op Code = Enter Bootloader, Status = Success) received
    [10:42:12.8750] Normal: Disconnected.
    [10:42:12.8750] Normal: Disconnected by the remote device
    [10:42:12.8750] Normal: Scanning for the DFU Bootloader...
    [10:42:22.8760] Warning: Scanning timed out returning no matching peripherals!
    [10:42:22.8770] Error: DFU Failed with Error: No DFU device found.

Reply

  • No delay. I see the blootloader RTT console immediately advertising.
    I tried turning off the alternative advertising mode - DfuTarg is showing up after the failure and I can connect to it. 

    <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: No advertising name found
    <debug> nrf_dfu_ble: Using default advertising name
    <debug> nrf_dfu_ble: Advertising...
    <debug> nrf_dfu_ble: BLE DFU transport initialized.
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_sd backend.

    nRF console log

    [10:42:11.9130] Normal: Services discovered
    [10:42:11.9130] Normal: Secure DFU Service found
    [10:42:11.9130] Normal: Discovering characteristics in DFU Service...
    [10:42:11.9130] Normal: DFU characteristics discovered
    [10:42:11.9130] Normal: Enabling indications for 8EC90003-F315-4F60-9FB8-838830DAEA50...
    [10:42:11.9550] Normal: Indications enabled for 8EC90003-F315-4F60-9FB8-838830DAEA50
    [10:42:11.9550] Normal: Buttonless DFU indications enabled
    [10:42:11.9550] Warning: Application with buttonless update found
    [10:42:11.9550] Normal: Writing to characteristic 8EC90003-F315-4F60-9FB8-838830DAEA50...
    [10:42:12.1060] Normal: Data written to 8EC90003-F315-4F60-9FB8-838830DAEA50
    [10:42:12.1070] Normal: Indication received from 8EC90003-F315-4F60-9FB8-838830DAEA50, value (0x):200101
    [10:42:12.1070] Normal: Response (Op Code = Enter Bootloader, Status = Success) received
    [10:42:12.8750] Normal: Disconnected.
    [10:42:12.8750] Normal: Disconnected by the remote device
    [10:42:12.8750] Normal: Scanning for the DFU Bootloader...
    [10:42:22.8760] Warning: Scanning timed out returning no matching peripherals!
    [10:42:22.8770] Error: DFU Failed with Error: No DFU device found.

Children
Related