Hi to everybody,
after adding ANT+ functionality to an application, now i need to define a DFU procedure to upgrade the device.
This is the environment:
SDK 16.0.0
Development tool: Segger embedded studio 5.68
DFU mode: via UART using nrfutil
I need to upgrade the bootloader, the softdevice and the application.
I modified the bootloader commenting the following lines in the module nrf_dfu_validation.c
//else if (SD_PRESENT && (SD_ID_GET(MBR_SIZE) != SD_ID_GET(sd_start_addr)))
//{
// NRF_LOG_ERROR("The new SoftDevice is of a different family than the present SoftDevice. Compatibility cannot be guaranteed.");
// result = false;
//}
After recompiling the bootloader, i prepared the DFU package using the following command:
nrfutil pkg generate --hw-version 53 --bootloader-version 2 --application-version 1 --sd-req 0xCA,0xB9 --sd-id 0xB9 --key-file private.pem --sd-boot-validation NO_VALIDATION --app-boot-validation NO_VALIDATION --bootloader .\files\secure_bootloader_uart_mbr_rover_ant.hex --softdevice .\files\ANT_s340_nrf52840_6.1.1.hex --application [APPLICATION NAME] {ZIP FILE NAME]
I then tried to run the upgrade with the following command:
nrfutil dfu serial -pkg [ZIP FILE NAME] -p COM5 -fc FALSE -b 230400 -cd 1 -prn 50
about at the 71% of the upgrade i have the following error:
[#########################-----------] 71% 00:00:24
Traceback (most recent call last):
File "C:\Users\gianluca.REDOX\AppData\Local\Programs\Python\Python39\Scripts\nrfutil-script.py", line 33, in <module>
sys.exit(load_entry_point('nrfutil==6.1.3', 'console_scripts', 'nrfutil')())
File "C:\Users\gianluca.REDOX\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "C:\Users\gianluca.REDOX\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "C:\Users\gianluca.REDOX\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\gianluca.REDOX\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\gianluca.REDOX\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\gianluca.REDOX\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "C:\Users\gianluca.REDOX\AppData\Local\Programs\Python\Python39\lib\site-packages\nordicsemi\__main__.py", line 1063, in serial
do_serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, serial_number, True,
File "C:\Users\gianluca.REDOX\AppData\Local\Programs\Python\Python39\lib\site-packages\nordicsemi\__main__.py", line 978, in do_serial
dfu.dfu_send_images()
File "C:\Users\gianluca.REDOX\AppData\Local\Programs\Python\Python39\lib\site-packages\nordicsemi\dfu\dfu.py", line 115, in dfu_send_images
self._dfu_send_image(self.manifest.softdevice_bootloader)
File "C:\Users\gianluca.REDOX\AppData\Local\Programs\Python\Python39\lib\site-packages\nordicsemi\dfu\dfu.py", line 100, in _dfu_send_image
self.dfu_transport.send_firmware(data)
File "C:\Users\gianluca.REDOX\AppData\Local\Programs\Python\Python39\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 302, in send_firmware
self.__execute()
File "C:\Users\gianluca.REDOX\AppData\Local\Programs\Python\Python39\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 421, in __execute
self.__get_response(DfuTransportSerial.OP_CODE['Execute'])
File "C:\Users\gianluca.REDOX\AppData\Local\Programs\Python\Python39\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 504, in __get_response
raise NordicSemiException('Response Code {}'.format(
pc_ble_driver_py.exceptions.NordicSemiException: Response Code InvalidObject
If i prepare a single package for the bootloader upgrade and a common package for the softdevice and application upgrade, everything works fine, but i have to restart the device in
bootloader mode twice.
Here the commands i use for packages preparing
bootloader:
nrfutil pkg generate --hw-version 53 --bootloader-version 2 --bootloader .\files\secure_bootloader_uart_mbr_rover_ant.hex --sd-req 0xCA --key-file private.pem --sd-boot-validation NO_VALIDATION --app-boot-validation NO_VALIDATION [ZIP FILE NAME]
softdevice + application:
nrfutil pkg generate --hw-version 53 --softdevice .\files\ANT_s340_nrf52840_6.1.1.hex --application-version 1 --application [APPLICATION HEX FILE NAME] --sd-req 0xCA --sd-id 0xB9 --key-file private.pem --sd-boot-validation NO_VALIDATION --app-boot-validation NO_VALIDATION [ZIP FILE NAME]
I note that upgrading the softdevice + application, at a centain point, the upgrade suspends for few seconds, i think in corrispondence of the device's reboot at the end of softdevice upgrade. This doesn't happen with the complete package, the error happens before.
I also tried to recompile the bootloader setting to 0 the macro NRF_DFU_APP_DOWNGRADE_PREVENTION without results.
Do i made som mistakes?
Thank you very much.
I set the macro NRF_DFU_APP_DOWNGRADE_PREVENTION to 0 in the