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

Enter Bootloader from App SDK15

I am struggling with getting a Secure UART(Serial) DFU operation to function correctly when I attempt to enter the bootloader with a call from my app. I am using the basic Secure Serial Bootloader example from SDK15. The bootloader enters DFU and correctly updates an app image when I use a button to enter the DFU. It also works great when I have NO app flashed in the device. But when I try to call the boot/DFU process from within my app I get a "No ping response after opening COM port" error from nrfutil.

My trigger is a cmd (thru the UART) that I detect. I then close my UART and disable any timers that I have used, as well as terminating the use of any other peripherals. I then delay about 100mS and then execute the following lines of code:

  nrf_power_gpregret_set(nrf_power_gpregret_get() | BOOTLOADER_DFU_START);
  nrf_power_gpregret2_set(BOOTLOADER_DFU_SKIP_CRC);
  nrf_delay_ms(50);
  NVIC_SystemReset();

Then, from a cmd shell window I execute the nrfutil dfu process with:

PS C:\..\Wayne\> nrfutil dfu serial -pkg app_v109_pkg.zip -p COM5 -b 115200 -fc 0

I get the following response:

***************************************************************************************************

PS C:\..\Wayne\> nrfutil dfu serial -pkg app_v109_pkg.zip -p COM5 -b 115200 -fc 0
  [------------------------------------]    0%
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\nrfutil.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "c:\python27\lib\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "c:\python27\lib\site-packages\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\python27\lib\site-packages\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\python27\lib\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\python27\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "c:\python27\lib\site-packages\nordicsemi\__main__.py", line 745, in serial
    do_serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, True)
  File "c:\python27\lib\site-packages\nordicsemi\__main__.py", line 680, 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 90, in _dfu_send_image
    self.dfu_transport.open()
  File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 211, in open
    raise NordicSemiException("No ping response after opening COM port")
pc_ble_driver_py.exceptions.NordicSemiException: No ping response after opening COM port
PS C:\..\Wayne\>

***************************************************************************************************

When I enter the bootloader with BTN 4/Reset and the very same cmd line:

(PS C:\..\Wayne\> nrfutil dfu serial -pkg app_v109_pkg.zip -p COM5 -b 115200 -fc 0)

All works just fine.

What am I missing?

Thanks for your help.

(I have seen several other postings about 'buttonless' DFU and followed them closely.)