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

I can DFU with segger but directly downloading secure bootloader hex file onto nRF52840 won't let me dfu?

Hi devzone,

I learnt DFU through USB by performing the following steps:

1. build and run "secure bootloader usb" project with segger through J-link port J2.

2. flash a signed zip package using nrfutil through usb port J3.

And it was successful.

However if I replace step one with

Segger interface -> Target -> "connect J-link" and then "Erase all" and then "Download File -> Download intel Hex File" and select the hex file the project had built and flash onto the board then reset J-link,

Then do step 2 (nrfutil zip file through J3)

It cannot flash. giving the following errors:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/serial/serialposix.py", line 265, 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/ttyACM0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 198, in open
    self.serial_port = Serial(port=self.com_port,
  File "/usr/local/lib/python3.8/site-packages/serial/serialutil.py", line 240, in __init__
    self.open()
  File "/usr/local/lib/python3.8/site-packages/serial/serialposix.py", line 268, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyACM0: [Errno 2] No such file or directory: '/dev/ttyACM0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/nrfutil", line 11, in <module>
    load_entry_point('nrfutil==6.0.1', 'console_scripts', 'nrfutil')()
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/nordicsemi/__main__.py", line 993, in usb_serial
    do_serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, serial_number, False,
  File "/usr/local/lib/python3.8/site-packages/nordicsemi/__main__.py", line 949, in do_serial
    dfu.dfu_send_images()
  File "/usr/local/lib/python3.8/site-packages/nordicsemi/dfu/dfu.py", line 127, in dfu_send_images
    self._dfu_send_image(self.manifest.application)
  File "/usr/local/lib/python3.8/site-packages/nordicsemi/dfu/dfu.py", line 88, in _dfu_send_image
    self.dfu_transport.open()
  File "/usr/local/lib/python3.8/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 202, in open
    raise NordicSemiException("Serial port could not be opened on {0}"
pc_ble_driver_py.exceptions.NordicSemiException: Serial port could not be opened on /dev/ttyACM0. Reason: could not open port /dev/ttyACM0: [Errno 2] No such file or directory: '/dev/ttyACM0'

Symptom:

after Build and run command, LED1 and 3 are lit, DFU works.

After hex download, no LEDs are lit. DFU doesn't work. I tried reset button, reset button + button 4 and power cycle to no avail.

The hex are built with the same key.

How to do secure bootloader step one through hex download with SEGGER? Is nrfjprog the only alternative?

PS: The reason I have to use hex download is I have a bootloader spliced with bl setting and application that i want to download to the chip, so with one flash i have a functional app running, also give gateway for future DFU.

Parents
  • Hi,

    Please be aware that the example is created to work with an MBR flashed into the chip. Without the MBR the bootloader won't work. The MBR is included when you flash using Segger Embedded Studio. You can find the additional file in Project Options -> Loader -> Additional Load File.

    If you want to flash using Jlink Commander or using nrfjprog, you would need to flash the mbr (either before or after) with the bootloader hex file. 

Reply
  • Hi,

    Please be aware that the example is created to work with an MBR flashed into the chip. Without the MBR the bootloader won't work. The MBR is included when you flash using Segger Embedded Studio. You can find the additional file in Project Options -> Loader -> Additional Load File.

    If you want to flash using Jlink Commander or using nrfjprog, you would need to flash the mbr (either before or after) with the bootloader hex file. 

Children
No Data
Related