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

not able to enter DFU Mode with secure bootloader example

I am not able to enter DFU Mode with secure bootloader example.

I use IAR and NRF Connect with Programmer to flash

Following are the steps I followed

1. Build Secure bootloader for serial UART ( enabled NRF_DFU_DEBUG_VERSION to remove link error)

2. Build blinky with MBR

3. Create settings file for blinky with MBR using the following command:

nrfutil settings generate --family NRF52840 --application blinky_pca10056_mbr.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 settings.hex

Note: Generating a DFU settings page with backup page included.
This is only required for bootloaders from nRF5 SDK 15.1 and newer.
If you want to skip backup page generation, use --no-backup option.

Generated Bootloader DFU settings .hex file and stored it in: settings.hex

Bootloader DFU Settings:
* File: settings.hex
* Family: NRF52840
* Start Address: 0x000FF000
* CRC: 0x5BBAFFAB
* Settings Version: 0x00000001 (1)
* App Version: 0x00000001 (1)
* Bootloader Version: 0x00000001 (1)
* Bank Layout: 0x00000000
* Current Bank: 0x00000000
* Application Size: 0x00000608 (1544 bytes)
* Application CRC: 0xA6B0AE53
* Bank0 Bank Code: 0x00000001
* Softdevice Size: 0x00000000 (0 bytes)
* Boot Validation CRC: 0x00000000
* SD Boot Validation Type: 0x00000000 (0)
* App Boot Validation Type: 0x00000000 (0)

4. I then used the NRF Connect to program 4 files: settings, blinky_mbr, secure bootloader and mbr(mbr taken from test image folder)

Observation:
1. The blinky app runs normally
2. If I hold down button 4 and power-cycle, LEDs 1 and 3 are lit.After sometime, normal mode where app runs is entered and the app runs

I guess there is a hardfault and DFU mode is not entered. Instead after some time, maybe due to watchdog reset, normal app runs. I am unable to understand what I am missing here


Queries:
1. How to enter DFU mode?
2. Is it OK to use nrf Connect programmer to program all at once
3. How to enable RTT / UART logs on IAR? In the sdk_config file, I only see NRF_LOG_ENABLED. No macros related to UART / RTT

Note that I just want to check getting into bootloader mode as a first step and it is not working. Hence not getting into creating my own private -public key-pair

Parents Reply Children
  • I just saw that the HW version was not matching. I made it to 0 in my bootloader code and it successfully updated!!

    Below is the command I used:

    Code\nRF_OriginalSDK\nRF5_SDK_15.3.0_59ac345_TRY\BUILDS\190503\dfu>nrfutil dfu serial -pkg dfu_test.zip -p COM5 -b 115200 -fc 1

    Traceback (most recent call last):
    File "C:\Python27\Scripts\nrfutil-script.py", line 9, in <module>
    load_entry_point('nrfutil==5.2.0', 'console_scripts', 'nrfutil')()
    File "c:\python27\lib\site-packages\click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
    File "c:\python27\lib\site-packages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
    File "c:\python27\lib\site-packages\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "c:\python27\lib\site-packages\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "c:\python27\lib\site-packages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "c:\python27\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
    File "c:\python27\lib\site-packages\nordicsemi\__main__.py", line 1042, in serial
    timeout)
    File "c:\python27\lib\site-packages\nordicsemi\__main__.py", line 956, in do_serial
    dfu.dfu_send_images()
    File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu.py", line 129, in dfu_send_images
    self._dfu_send_image(self.manifest.application)
    File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu.py", line 97, in _dfu_send_image
    self.dfu_transport.send_init_packet(data)
    File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 256, in send_init_packet
    self.__execute()
    File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 421, in __execute
    self.__get_response(DfuTransportSerial.OP_CODE['Execute'])
    File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 502, in __get_response
    raise NordicSemiException('Extended Error 0x{:02X}: {}'.format(resp[3], data))
    pc_ble_driver_py.exceptions.NordicSemiException: Extended Error 0x06: The hardware version of the device does not match the required hardware version for the update.

    Code\nRF_OriginalSDK\nRF5_SDK_15.3.0_59ac345_TRY\BUILDS\190503\dfu>nrfutil dfu serial -pkg dfu_test.zip -p COM5 -b 115200 -fc 1
    [####################################] 100%
    Device programmed.

    Tips for those who face similar issues:

    1. The command I used to create package:

    nrfutil pkg generate --hw-version 0 --sd-req 0x00 --application-version 1 --key-file private.key –application blinky_pca10056_mbr_new.hex dfu_test.zip

    2. The command I used to generate the bootloader_settings file:

    nrfutil settings generate --family NRF52840 --application blinky_mbr.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 settings.hex

    I have uploaded the updated secure bootloader hex with HW version 0 instead of the default 52 in the sdk_config.h

    secure_bootloader_uart_mbr_pca10056.hex

    3. I installed Python 2.7.11.

        3.7 version should not be installed. nrfutil version was 5.2.0

    4. Connect all UART Pins: RX 8, TX 6, CTS 7, RTS 5, GND and VCC

    5. Don't forget to add MBR and Booloader_settngs file apart from the app and booloader hex. Total 4 files

    6. Use the new nRF Connect-Programmer

  • Also, LEDs 1 and 3 glow indicating the board has entered Bootloader mode

Related