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.
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.
Ok, so you use the correct USB port, then.
Did you check the Warning regarding the UICR:
WARNING: A UICR write operation has been requested but UICR has not been
WARNING: erased. Please verify that the result is correct.
There is a lot of text here, but what does it output if you only use these commands (replace app.hex with your application .hex file).
nrfjprog --eraseall
nrfjprog --program ..\..\..\..\..\components\softdevice\mbr\hex\mbr_nrf52_2.4.1_mbr.hex --verify
nrfjprog --program app.hex
nrfjprog --program _build\nrf52840_xxaa.hex --verify
nrfjprog --reset
This doesn't throw any warnings when I do it. What nrfjprog version do you have? (nrfjprog --version)
After these commands, my nRF is in bootloader mode, and I can perform the DFU using a pkg that I generated using this command (from the SDK\examples\dfu\secure_bootloader\pca10056_usb\armgcc)
nrfutil pkg generate --application files\app.hex --sd-req 0x00 --application-version 1 --hw-version 52 --key-file ..\..\..\private.key files\dfu_img.zip
(You don't need bootloader settings as long as you intend for the bootloader to go to DFU mode).
Best regards,
Edvin
This doesn't throw any warnings when I do it. What nrfjprog version do you have? (nrfjprog --version)
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