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

Application update fails after flashing SoftDevice

We are using nrfutil v4.0.0 to update the nRF52 module. So far we've been using SDK_15.3.0 with SoftDevice s140_nrf52_6.1.1 and the updates work fine for zip files containing APP + SD, where the APP is new but the SD is the same. Now, I want to upgrade to SDK nRF5_SDK_17.0.2 which includes SoftDevice s140_nrf52_7.2.0 but I am having a hard time understanding what is happening. I've tried the following sequence.

  1. First updating BL only, generated with --sd-req containing both old and new SD_IDs: 0xB6,0x0100. This works fine.
  2. Trying to update SD and APP (same zip file) also generated with --sd-req 0xB6,0x0100. The SD update seems to work fine but the APP update fails. See log below.

nrfutil -v -v dfu serial -p /dev/ttymxc1 -pkg ./nrf52-bl.zip -cd 5
2020-12-01 08:17:06,958 Using board at serial port: /dev/ttymxc1
2020-12-01 08:17:07,058 Sending Bootloader image.
2020-12-01 08:17:13,135 Sending init packet...
2020-12-01 08:17:13,414 Sending firmware file...
2020-12-01 08:17:16,284 Image sent in 3.14915800095s
Device programmed.

nrfutil -v -v dfu serial -p /dev/ttymxc1 -pkg ./nrf52-sd-app.zip -cd 5
2020-12-01 10:57:38,645 Using board at serial port: /dev/ttymxc1
2020-12-01 10:57:38,711 Sending SoftDevice image...
2020-12-01 10:57:44,754 Sending init packet...
2020-12-01 10:57:45,031 Sending firmware file...
2020-12-01 10:58:03,414 Image sent in 18.6601550579s
2020-12-01 10:58:03,438 Sending Application image.
Traceback (most recent call last):
  File "/usr/bin/nrfutil", line 11, in <module>
    load_entry_point('nrfutil==4.0.0', 'console_scripts', 'nrfutil')()
  File "/usr/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/nordicsemi/__main__.py", line 858, in serial
    do_serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, True)
  File "/usr/lib/python2.7/site-packages/nordicsemi/__main__.py", line 795, in do_serial
    dfu.dfu_send_images()
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 129, in dfu_send_images
    self._dfu_send_image(self.manifest.application)
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 90, in _dfu_send_image
    self.dfu_transport.open()
  File "/usr/lib/python2.7/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


Then I've tried two other approaches. Option 1, creating a single zip file containing BL+SD+APP which also doesn't work and fails with another error: pc_ble_driver_py.exceptions.NordicSemiException: Response Code InvalidObject. Log below.

2020-12-01 11:14:16,252 Using board at serial port: /dev/ttymxc1
2020-12-01 11:14:16,314 Sending SoftDevice+Bootloader image.
2020-12-01 11:14:22,348 Sending init packet...
2020-12-01 11:14:22,632 Sending firmware file...
Traceback (most recent call last):
  File "/usr/bin/nrfutil", line 11, in <module>
    load_entry_point('nrfutil==4.0.0', 'console_scripts', 'nrfutil')()
  File "/usr/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/nordicsemi/__main__.py", line 858, in serial
    do_serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, True)
  File "/usr/lib/python2.7/site-packages/nordicsemi/__main__.py", line 795, in do_serial
    dfu.dfu_send_images()
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 117, in dfu_send_images
    self._dfu_send_image(self.manifest.softdevice_bootloader)
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 102, in _dfu_send_image
    self.dfu_transport.send_firmware(data)
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 299, in send_firmware
    self.__execute()
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 370, in __execute
    self.__get_response(DfuTransportSerial.OP_CODE['Execute'])
  File "/usr/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 454, in __get_response
    get_dict_key(DfuTransport.RES_CODE, resp[2])))
pc_ble_driver_py.exceptions.NordicSemiException: Response Code InvalidObject


Option 2, creating 2 zip files one with BL+SD and another one with the APP only. This option works for both updates. However, I noticed that I am not able to update the device again using the zip file SD+APP, where the SD and APP are the same versions currently running. It fails with "No ping response after opening COM port" the same as the first log above. I'd like to understand what is happening and why I'm not able to update SD+APP together as it should be possible to do so.

Notes:
* I'm using such an old version of nrfutil because that is the version deployed in production
* I can adapt the update script to use the approach BL+SD and then APP as this is a solution that works. However, I'd like to understand what is happening to have control of the situation.

  • Hello,

    A major Softdevice update requires a new bootloader to be included in the update as well. This makes it so that the Softdevice and bootloader are updated in one go (SoftDevice and bootloader), and thus guaranteeing that the activated bootloader always stays API compatible with the current Softdevice. Please see the "DFU package combinations" chapter of the nrfutil documentation for more details on this.

    That said, I'm not sure why the BL+SD+APP update failed in your case considering that the same "BL+SD only" update got accepted. I did not manage to replicate this here. Attached below is the packages I used to test with. Maybe you could you go over those an see if there may be any relevant differences in how we create the packages (version numbers, etc)?

    OTA DFU test from SDK v15.3.0 to v17.0.2

    1004.dfu_from_15.3.0_to_17_0_2.zip

  • Hello Vidar,

    Thanks for testing it out and sending the files.

    Just to confirm, the application on full_image.hex is evoking the bootloader, correct?

    I've tried to update from the SDKv15.3.0 using my hex file to the SDK v17.0.2 using your zip files. They all fail with the error "Response Code InvalidObject" (same log as above).

    I've tried to update from full_image.hex (flashed with JTAG) to your SDK v17.0.2 zip files. In those cases, they fail with the error "No ping response after opening COM port" (same log as above).

    Finally, I also tried to update from full_image.hex (flashed with JTAG) to my SDK v17.0.2 BL+SD (the only file that works on my test setup), and unfortunately, this test also fails with the error "No ping response after opening COM port" (same log as above).

    Could this be related to the nrfutil tool version?

  • Hello,

    I saw 'pc_ble_driver_py' referenced in the log you posted, and assumed you were doing OTA DFU over BLE at first, not serial DFU. So I was testing BLE DFU. Now with serial DFU am able to replicate the the same, and the reason is that nrfutil sends the ping request before the new SD+BL have had time to get activated. Having a delay between SD+BL and the APP update fixes the problem.

  • Hello,

    That is correct I'm using serial. Where exactly you added the delay? I'm assuming in the nrfutil code somewhere since SD+BL+APP fails and SD+BL in one package and APP in other works.

  • Hello,

    I did not modify nrfutil, the delay was that I manually started the APP update after having completed the SD+BL update.

Related