This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

USB-serial DFU without softdevice doesn't work using SDK 17.1.0.

I have an issue with DFU via USB CDC ACM.
I would like to update the firmware using open bootloader over USB without softdevice.
I already tried to follow the thread: devzone.nordicsemi.com/.../nordic-q-a/43698/bootloader-serial-dfu-without-softdevice-sdk-15?ReplySortBy=CreatedDate&ReplySortOrder=Ascending and also I've tried to follow the nrfutil/bootloader documentation.
My design is based on $SDK_path/nRF5_SDK_17.1.0_ddde560/examples/dfu/open_bootloader and the blink app. I have tried to use the precompilend one as well as compiled from source by myself (mbr version).

My steps and output:

Clear nrf52 flash memory and UICR:
bartek@iMac open_bootloader % make erase
nrfjprog -f nrf52 --eraseall
Erasing user available code and UICR flash areas.
Applying system reset.

I thing for the open bootloader I don't need this step, but anyway I have generated the key:
bartek@iMac open_bootloader % nrfutil keys generate private.key
bartek@iMac open_bootloader % nrfutil keys display --key pk --format code private.key --out_file public_key.c

Then I have coppied generated key from the public_key.c into the dfu_public_key.c from the example/dfu and maked the project:
bartek@iMac open_bootloader % make
Linking target: _build/nrf52840_xxaa_debug.out
text data bss dec hex filename
66460 276 45940 112676 1b824 _build/nrf52840_xxaa_debug.out
Preparing: _build/nrf52840_xxaa_debug.hex
Preparing: _build/nrf52840_xxaa_debug.bin

Generate basic settings:
bartek@iMac open_bootloader % nrfutil settings generate --family NRF52840 --application my_blink_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: 0xC9728D3D
* Settings Version: 0x00000001 (1)
* App Version: 0x00000001 (1)
* Bootloader Version: 0x00000001 (1)
* Bank Layout: 0x00000000
* Current Bank: 0x00000000
* Application Size: 0x00000744 (1860 bytes)
* Application CRC: 0x86FFD574
* 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)

generate the package:
bartek@iMac open_bootloader % nrfutil pkg generate --hw-version 52 --application-version 1 --application my_blink_mbr.hex --key-file private.key --sd-r
eq 0 my_blink_mbr.zip
Zip created at my_blink_mbr.zip

flash the mbr:
bartek@iMac open_bootloader % make flash_mbr

nrfjprog -f nrf52 --program ../support/sdk/nRF5_SDK_17.1.0_ddde560/components/softdevice/mbr/hex/mbr_nrf52_2.4.1_mbr.hex --sectorerase
Parsing image file.
Erasing page at address 0x0.
Applying system reset.
Checking that the area to write is not protected.
Programming device.
nrfjprog -f nrf52 --reset
Applying system reset.
Run.

flash the bootloader:
bartek@iMac open_bootloader % make flash
DONE nrf52840_xxaa_debug
Flashing: _build/nrf52840_xxaa_debug.hex
nrfjprog -f nrf52 --program _build/nrf52840_xxaa_debug.hex --sectorerase
Parsing image file.
Erasing page at address 0xE0000.
Erasing page at address 0xE1000.
Erasing page at address 0xE2000.
Erasing page at address 0xE3000.
Erasing page at address 0xE4000.
Erasing page at address 0xE5000.
Erasing page at address 0xE6000.
Erasing page at address 0xE7000.
Erasing page at address 0xE8000.
Erasing page at address 0xE9000.
Erasing page at address 0xEA000.
Erasing page at address 0xEB000.
Erasing page at address 0xEC000.
Erasing page at address 0xED000.
Erasing page at address 0xEE000.
Erasing page at address 0xEF000.
Erasing page at address 0xF0000.
WARNING: A UICR write operation has been requested but UICR has not been
WARNING: erased. Please verify that the result is correct.
Applying system reset.
Checking that the area to write is not protected.
Programming device.
nrfjprog -f nrf52 --reset
Applying system reset.
Run.

Load the package:
bartek@iMac open_bootloader % nrfutil dfu usb-serial -pkg my_blink_mbr.zip -p /dev/tty.usbmodemD28CF7D29DCC1 -b 115200 -fc 1
[------------------------------------] 0%
Traceback (most recent call last):
File "/usr/local/bin/nrfutil", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/nordicsemi/__main__.py", line 1023, in usb_serial
timeout)
File "/usr/local/lib/python3.7/site-packages/nordicsemi/__main__.py", line 978, in do_serial
dfu.dfu_send_images()
File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu.py", line 127, in dfu_send_images
self._dfu_send_image(self.manifest.application)
File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu.py", line 88, in _dfu_send_image
self.dfu_transport.open()
File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 217, in open
self.__get_mtu()
File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 366, in __get_mtu
self.mtu = struct.unpack('<H', bytearray(response))[0]
TypeError: 'NoneType' object is not iterable

And the RTT logs:
<info> app: Open USB bootloader started
<debug> app: In nrf_bootloader_init
<debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
<debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
<debug> nrf_dfu_settings: Using settings page.
<debug> nrf_dfu_settings: Copying forbidden parts from backup page.
<debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
<info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
<debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
<debug> app: Enter nrf_bootloader_fw_activate
<info> app: No firmware to activate.
<info> app: Boot validation failed. No valid app to boot.
<debug> app: DFU mode because app is not valid.
<info> nrf_bootloader_wdt: WDT is not enabled
<debug> app: in weak nrf_dfu_init_user
<debug> app: timer_stop (0x20000048)
<info> app: Entering DFU mode.
<info> app_timer: RTC: initialized.
<debug> app: Initializing transports (found: 1)
<debug> nrf_dfu_serial_usb: Initializing drivers.
<debug> nrf_dfu_serial_usb: Starting USB
<debug> nrf_dfu_serial_usb: USB Transport initialized
<debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
<debug> app: Enter main loop
<info> nrf_dfu_serial_usb: USB power detected
<info> nrf_dfu_serial_usb: USB ready
<warning> nrf_dfu_serial_usb: Could not read from CDC. Error: 0x92.


My configuration:
Board: NRF52840DK PCA10056
SDK: nRF5_SDK_17.1.0_ddde560
Compiler: gcc-arm-none-eabi-9-2019-q4-major-mac
OS: macOS Big Sur 11.3
Nrf Util: nrfutil version 6.1.3
Python: 3.7.12
IDE: VS code + GCC + SDK.
Softdevice: No Softdevice.

system_profiler SPUSBDataType USB:
Open DFU Bootloader:
Product ID: 0x521f
Vendor ID: 0x1915 (Nordic Semiconductor ASA)
Version: 1.00
Serial Number: D28CF7D29DCC
Speed: Up to 12 Mb/s
Manufacturer: Nordic Semiconductor
Location ID: 0x14320000 / 37
Current Available (mA): 500
Current Required (mA): 100
Extra Operating Current (mA): 0

Thank you in advance
Parents
  • Hello,

    The first thing I see is the warning from the UICR not being erased. I suggest that you program the bootloader, the mbr and the bootloader settings *** without resetting the device. In fact, there is no need to reset the nRF before you have programmed all the components. 

    *** I also see that you don't program the settings.hex file that you generated. Is that on purpose?

    Lastly, did you change the USB cable to the other USB port on the DK before you tried to perform the DFU? Please note that the USB bootloader uses the USB peripheral on the DK, while if you want to use the UART bootloader, then you should not change the USB port on the DK (but you would need to use the serial bootloader, not the USB bootloader. 

    Best regards,

    Edvin

  • Thank you for a quick reply,

    I also see that you don't program the settings.hex file that you generated. Is that on purpose?

    Preparing the description of the issue I have forgotten about one step:

    mergehex --merge settings.hex  _build/nrf52840_xxaa_debug.hex --output output.hex.

    So the procedure I am following is:

    bartek@iMac open_bootloader % nrfjprog -f nrf52 --eraseall
    Erasing user available code and UICR flash areas.
    Applying system reset.

    bartek@iMac open_bootloader % nrfjprog -f nrf52 --program ../support/sdk/nRF5_SDK_17.1.0_ddde560/components/softdevice/mbr/hex/mbr_nrf52_2.4.1_mbr.hex --sectorerase

    Parsing image file.
    Erasing page at address 0x0.
    Applying system reset.
    Checking that the area to write is not protected.
    Programming device.

    This time additionallly I have called erease uicr befor writing the bootloader

    bartek@iMac open_bootloader % nrfjprog -f NRF52 --eraseuicr

    Erasing UICR flash area.
    Applying system reset.

    And the program the bootloader with settings merged into output.hex

    bartek@iMac open_bootloader % nrfjprog -f nrf52 --program output.hex --sectorerase

    Parsing image file.
    Erasing page at address 0xE0000. <up to address 0xFF000>
    WARNING: A UICR write operation has been requested but UICR has not been
    WARNING: erased. Please verify that the result is correct.
    Applying system reset.
    Checking that the area to write is not protected.
    Programming device.

    The program entered bootloader after pushing the reset button.

    open_bootloader % nrfutil dfu usb-serial -pkg my_blink_mbr.zip -p /dev/tty.usbmodemD28CF7D29DCC1 -b 115200 -fc 1
    [------------------------------------] 0%
    Traceback (most recent call last):
    File "/usr/local/bin/nrfutil", line 8, in <module>
    sys.exit(cli())
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/__main__.py", line 1023, in usb_serial
    timeout)
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/__main__.py", line 978, in do_serial
    dfu.dfu_send_images()
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu.py", line 127, in dfu_send_images
    self._dfu_send_image(self.manifest.application)
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu.py", line 88, in _dfu_send_image
    self.dfu_transport.open()
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 217, in open
    self.__get_mtu()
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 366, in __get_mtu
    self.mtu = struct.unpack('<H', bytearray(response))[0]
    TypeError: 'NoneType' object is not iterable

    and the RTT output:

    <info> app: Open USB bootloader started
    <debug> app: In nrf_bootloader_init
    <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> nrf_dfu_settings: Using settings page.
    <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <debug> app: Enter nrf_bootloader_fw_activate
    <info> app: No firmware to activate.
    <debug> nrf_dfu_validation: CRC check of app failed. Return 1
    <debug> app: App is valid
    <warning> nrf_dfu_settings: No additional data erased
    <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <debug> app: Running nrf_bootloader_app_start with address: 0x00001000
    <debug> app: Disabling interrupts. NVIC->ICER[0]: 0x0
    <info> app: Open USB bootloader started
    <debug> app: In nrf_bootloader_init
    <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> nrf_dfu_settings: Using settings page.
    <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <debug> app: Enter nrf_bootloader_fw_activate
    <info> app: No firmware to activate.
    <debug> nrf_dfu_validation: CRC check of app failed. Return 1
    <debug> app: App is valid
    <debug> app: DFU mode requested via pin-reset.
    <info> nrf_bootloader_wdt: WDT is not enabled
    <debug> app: in weak nrf_dfu_init_user
    <debug> app: timer_stop (0x20000048)
    <info> app: Entering DFU mode.
    <info> app_timer: RTC: initialized.
    <debug> app: Initializing transports (found: 1)
    <debug> nrf_dfu_serial_usb: Initializing drivers.
    <debug> nrf_dfu_serial_usb: Starting USB
    <debug> nrf_dfu_serial_usb: USB Transport initialized
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> app: Enter main loop
    <info> nrf_dfu_serial_usb: USB power detected
    <info> nrf_dfu_serial_usb: USB ready
    <warning> nrf_dfu_serial_usb: Could not read from CDC. Error: 0x92.

    Lastly, did you change the USB cable to the other USB port on the DK before you tried to perform the DFU? Please note that the USB bootloader uses the USB peripheral on the DK, while if you want to use the UART bootloader, then you should not change the USB port on the DK (but you would need to use the serial bootloader, not the USB bootloader. 

    I have connected the J3 (nRF USB). This one is named in the MacOS /dev/tty.usbmodemD28CF7D29DCC1. In the target application I am using USB CDC ACM for configuring my application. Moreover I am planning to run the bootloader via the application menu.

  • bartek@iMac open_bootloader % nrfjprog --eraseall
    Erasing user available code and UICR flash areas.
    Applying system reset.

    bartek@iMac open_bootloader % nrfjprog --program ../support/sdk/nRF5_SDK_17.1.0_ddde560/components/softdevice/mbr/hex/mbr_nrf52_2.4.1_mbr.hex --verify
    Parsing image file.
    Reading flash area to program to guarantee it is erased.
    Checking that the area to write is not protected.
    Programming device.
    Verifying programming.
    Verified OK.

    bartek@iMac open_bootloader % nrfjprog --program my_blink_mbr.hex
    Parsing image file.
    Reading flash area to program to guarantee it is erased.
    Checking that the area to write is not protected.
    Programming device.

    bartek@iMac open_bootloader % nrfjprog --program _build/nrf52840_xxaa_debug.hex --verify
    Parsing image file.
    Reading flash area to program to guarantee it is erased.
    Checking that the area to write is not protected.
    Programming device.
    Verifying programming.
    Verified OK.

    bartek@iMac open_bootloader % nrfjprog --reset
    Applying system reset.
    Run.

    In this moment it seems tho program freezes - LED2 is constantly enlighted.

    bartek@iMac open_bootloader % nrfutil pkg generate --application my_blink_mbr.hex --sd-req 0x00 --application-version 1 --hw-version 52 --key-file private.key dfu_img.zip
    Zip created at dfu_img.zip

    bartek@iMac open_bootloader % nrfutil dfu usb-serial -pkg dfu_img.zip -p /dev/tty.usbmodemD28CF7D29DCC1 -b 115200 -fc 1
    [------------------------------------] 0%
    Traceback (most recent call last):
    File "/usr/local/lib/python3.7/site-packages/serial/serialposix.py", line 322, in open
    self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
    FileNotFoundError: [Errno 2] No such file or directory: '/dev/tty.usbmodemD28CF7D29DCC1'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 199, in open
    baudrate=self.baud_rate, rtscts=self.flow_control, timeout=self.DEFAULT_SERIAL_PORT_TIMEOUT)
    File "/usr/local/lib/python3.7/site-packages/serial/serialutil.py", line 244, in __init__
    self.open()
    File "/usr/local/lib/python3.7/site-packages/serial/serialposix.py", line 325, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
    serial.serialutil.SerialException: [Errno 2] could not open port /dev/tty.usbmodemD28CF7D29DCC1: [Errno 2] No such file or directory: '/dev/tty.usbmodemD28CF7D29DCC1'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "/usr/local/bin/nrfutil", line 8, in <module>
    sys.exit(cli())
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/__main__.py", line 1023, in usb_serial
    timeout)
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/__main__.py", line 978, in do_serial
    dfu.dfu_send_images()
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu.py", line 127, in dfu_send_images
    self._dfu_send_image(self.manifest.application)
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu.py", line 88, in _dfu_send_image
    self.dfu_transport.open()
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 203, in open
    ". Reason: {1}".format(self.com_port, e.strerror))
    pc_ble_driver_py.exceptions.NordicSemiException: Serial port could not be opened on /dev/tty.usbmodemD28CF7D29DCC1. Reason: could not open port /dev/tty.usbmodemD28CF7D29DCC1: [Errno 2] No such file or directory: '/dev/tty.usbmodemD28CF7D29DCC1'

    However using the ls command I cannot see the USB DFU device.
    After power-cycle:

    bartek@iMac open_bootloader % nrfutil dfu usb-serial -pkg dfu_img.zip -p /dev/tty.usbmodemD28CF7D29DCC1 -b 115200 -fc 1
    [------------------------------------] 0%
    Traceback (most recent call last):
    File "/usr/local/bin/nrfutil", line 8, in <module>
    sys.exit(cli())
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "/usr/local/lib/python3.7/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/__main__.py", line 1023, in usb_serial
    timeout)
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/__main__.py", line 978, in do_serial
    dfu.dfu_send_images()
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu.py", line 127, in dfu_send_images
    self._dfu_send_image(self.manifest.application)
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu.py", line 88, in _dfu_send_image
    self.dfu_transport.open()
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 217, in open
    self.__get_mtu()
    File "/usr/local/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 366, in __get_mtu
    self.mtu = struct.unpack('<H', bytearray(response))[0]
    TypeError: 'NoneType' object is not iterable
    This doesn't throw any warnings when I do it. What nrfjprog version do you have? (nrfjprog --version)
    bartek@iMac open_bootloader % nrfjprog --version
    nrfjprog version: 10.12.1
    JLinkARM.dll version: 6.88a
  • Try updating your nrfjprog to the latest version (10.15.0). nRF Command Line Tools

    fizyk said:
    In this moment it seems tho program freezes - LED2 is constantly enlighted.

    At this point, your application is not expected to run. It will be stuck in DFU mode, because the bootloader settings are not programmed, which is fine. You want it to be in DFU mode now.

    If, when you update nrfjprog, you still get the same error, are you sure you are using the correct serial port? The name of the serial port may change when you plug the cable into the USB peripheral port instead of the debugger port. Please check what serial port the device is listed under after plugging in the USB peripheral port on the DK.

    Best regards,

    Edvin

  • Thank you for reply;

    Try updating your nrfjprog to the latest version (10.15.0). nRF Command Line Tools

    Updated:

    bartek@iMac open_bootloader % nrfjprog --version
    nrfjprog version: 10.15.0 external
    JLinkARM.dll version: 6.88a

    If, when you update nrfjprog, you still get the same error, are you sure you are using the correct serial port?

    bartek@iMac open_bootloader % system_profiler SPUSBDataType

    Open DFU Bootloader:

    Product ID: 0x521f
    Vendor ID: 0x1915 (Nordic Semiconductor ASA)
    Version: 1.00
    Serial Number: D28CF7D29DCC
    Speed: Up to 12 Mb/s
    Manufacturer: Nordic Semiconductor
    Location ID: 0x14320000 / 35
    Current Available (mA): 500
    Current Required (mA): 100
    Extra Operating Current (mA): 0

    bartek@iMac open_bootloader % ls /dev | grep D28
    cu.usbmodemD28CF7D29DCC1
    tty.usbmodemD28CF7D29DCC1

    bartek@iMac open_bootloader % ls /dev | grep usb
    cu.usbmodemD28CF7D29DCC1
    tty.usbmodemD28CF7D29DCC1

    These are ports related to the nrf USB (3), I am sure I am using proper port.

  • Ok, perhaps there is something else using the USB port? Do you have it selected in nRF Connect for Desktop, some USB terminal or something other than for nrfutil? Try power cycling the board right before you call the "nrfutil dfu usb-serial ..." command to make sure. Can you try using python 3.8? I see that you are currently using 3.7.

    BR,
    Edvin

  • I had to switch to other project, and today I came back to the bootloader, and everything worked fine. I have tried to do it in a number of different ways and no issues occurred.
    Maybe there was some MacOS update in the meanwhile, so seems it could be an OS issue.

    I have tried programming the nrf without merging bootloader with the settings:

    mergehex --merge settings.hex  _build/nrf52840_xxaa_debug.hex --output output.hex.

    Here is my question: what is the difference between these two approaches? I have only noticed the black memory blocks have different size:

    block sizes from top when using output.hex file (bootloader + settings): 135; 92; 135; 92 (described as MBR parameters);
    block sizes from top when using bootloader file without settings: 292; 92; 292; 92 (described as MBR parameters);

Reply
  • I had to switch to other project, and today I came back to the bootloader, and everything worked fine. I have tried to do it in a number of different ways and no issues occurred.
    Maybe there was some MacOS update in the meanwhile, so seems it could be an OS issue.

    I have tried programming the nrf without merging bootloader with the settings:

    mergehex --merge settings.hex  _build/nrf52840_xxaa_debug.hex --output output.hex.

    Here is my question: what is the difference between these two approaches? I have only noticed the black memory blocks have different size:

    block sizes from top when using output.hex file (bootloader + settings): 135; 92; 135; 92 (described as MBR parameters);
    block sizes from top when using bootloader file without settings: 292; 92; 292; 92 (described as MBR parameters);

Children
  • fizyk said:
    what is the difference between these two approaches?

    What exactly are "these two approaches"? Programming with and without merging? Or with or without settings?

    With or without merging shouldn't be a difference. It may be that nRF Connect for desktop is confused if they are written as one file or not when you read it back, but if you read back the hex file using "nrfjprog --readcode flashdump.hex", it shouldn't be any difference.

    With or without settings:

    If you don't program bootloader settings, then the bootloader will generate it's own settings. It may be that the size of the default settings is different from the settings generated from nrfutil.

    BR.
    Edvin

  • Thank you very much! I think this topic can be closed as solved. Cheers!

Related