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

PCA10100 usb secured bootloader

To the kind attention of Nordic support team,

I didn't find in SDK16 any SES version of secured usb bootloader for PCA10100 (tell me if I'm wrong). I mainly modified PCA10056's sdk_config.h (secured usb) project file in order to disable hardware CC310, watching at how flags are set in PCA10040's sdk_config.h (ble secued) project file. I also modified flash_placement.xml, considering nRF52833 flash memory, disabled dual banking behaviour and used nRF52833 start up files. I uploaded the result project, for you to give a look at your convenience if not so much trouble (at least sdk_config.h and flash_placement.xml files), it is a very clean self contained folder containing standard usb secured bootloader compiled to run in PCA10100 DK.

bootloader3.7z

As you can see after building and run, I see using device manager that the SDFU USB peripheral is available for usb updating:

The problem is that when I try to do firmware update I got error messages, so that I cannot really understand if I got the USB bootloader compiled with the very right parameters,

or my problem is coming from a bad usage of nrfutil/ nrfutil version

These are commands I use (please don't pay too attention to names, I quickly copied and pasted changing some name by purpose). I have to say that this procedure worked as a charmed when I was working using nRF52840.

emBuild -config "NRF52833_XXAA" ./xxx.emProject -clean
emBuild -config "Release" ../bootloader/bootloader_usb/build/secure_bootloader_usb_mbr_pca10100.emProject -clean

rem build exe files (main xxx project, usb bootloader)

emBuild -config "NRF52833_XXAA" ./xxx.emProject 2>nul
emBuild -config "Release" ../bootloader/bootloader_usb/build/secure_bootloader_usb_mbr_pca10100.emProject

// merge mbr and main project file

mergehex --merge %NRF_SDK%/components/softdevice/mbr/hex/mbr_nrf52_2.4.1_mbr.hex %XXX%/nRF52833_xxx.hex --output %XXX%/nRF52833_xxx_mbr.hex

// generate settings
nrfutil.exe settings generate --family NRF52 --application %XXX%/nRF52833_xxx.hex --application-version 3 --bootloader-version 2 --bl-settings-version 1 %BOOTLOADER_SETTINGS%/settings_nrf52833_xxaa_app.hex

// merge bootloader and settings

mergehex -m %USB_BOOTLOADER_NAME%/secure_bootloader_usb_mbr_pca10100.hex %BOOTLOADER_SETTINGS%/settings_nrf52833_xxaa_app.hex -o %BOOTLOADER_SETTINGS%/nrf52833_xxaa_bl_w_settings.hex

nrfjprog -f nrf52 --eraseall --snr %SWD_SNR_833%
nrfjprog -f nrf52 --reset --snr %SWD_SNR_833%
nrfjprog -f nrf52 --program %BOOTLOADER_SETTINGS%/nrf52833_xxaa_bl_w_settings.hex -r --snr %SWD_SNR_833%
//rem nrfjprog -f nrf52 --program %NRF_SDK%/components/softdevice/mbr/hex/mbr_nrf52_2.4.1_mbr.hex -r --snr %SWD_SNR_833%
nrfjprog -f nrf52 --program %XXX%/nRF52833_xxx_mbr.hex -r --snr %SWD_SNR_833%
nrfjprog -f nrf52 --reset --snr %SWD_SNR_833%

After that I can see that bootloader is apparently getting started correctly when pressing Button 4 after a reset (as you can see in the attached image). And main program is also correctly working. I also checked flash memory layout using nRFConnect and it seems to be quite ok. Of course, I leave to you last word, otherwise there would be no point in asking your kind opinion about this thing:

But then, something like that is failing (I'm pretty sure to use private key that is corresponding to the public one I use to compile the bootloader project):

nrfutil.exe pkg generate --hw-version 52 --sd-req 0 --application-version 4 --application %XXX%/nRF52833_xxx_mbr.hex --key-file %USB_BOOT_PRIVATE_KEY_PATH%/private.key %DFU_PKG_PATH%/keyboard_dfu_pkg.zip

nrfutil.exe dfu usb-serial -pkg %DFU_PKG_PATH%/keyboard_dfu_pkg.zip -p %USB_COM_SECURED_BOOTLOADER_RUNNING%

This is what I get when using nrfutil version 6.1.0:

Traceback (most recent call last):
File "c:\users\astella\appdata\local\programs\python\python38\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\astella\appdata\local\programs\python\python38\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\astella\AppData\Local\Programs\Python\Python38\Scripts\nrfutil.exe\__main__.py", line 7, in <module>
File "c:\users\astella\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "c:\users\astella\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\users\astella\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\astella\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\astella\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\astella\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\users\astella\appdata\local\programs\python\python38\lib\site-packages\nordicsemi\__main__.py", line 1014, in usb_serial
do_serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, serial_number, False,
File "c:\users\astella\appdata\local\programs\python\python38\lib\site-packages\nordicsemi\__main__.py", line 970, in do_serial
dfu.dfu_send_images()
File "c:\users\astella\appdata\local\programs\python\python38\lib\site-packages\nordicsemi\dfu\dfu.py", line 127, in dfu_send_images
self._dfu_send_image(self.manifest.application)
File "c:\users\astella\appdata\local\programs\python\python38\lib\site-packages\nordicsemi\dfu\dfu.py", line 95, in _dfu_send_image
self.dfu_transport.send_init_packet(data)
File "c:\users\astella\appdata\local\programs\python\python38\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 256, in send_init_packet
self.__execute()
File "c:\users\astella\appdata\local\programs\python\python38\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 421, in __execute
self.__get_response(DfuTransportSerial.OP_CODE['Execute'])
File "c:\users\astella\appdata\local\programs\python\python38\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


This is what I get when using nrfutil version 5.2.0:

Traceback (most recent call last):
File "nordicsemi\__main__.py", line 1464, in <module>
File "click\core.py", line 764, in __call__
File "click\core.py", line 717, in main
File "click\core.py", line 1137, in invoke
File "click\core.py", line 1137, in invoke
File "click\core.py", line 956, in invoke
File "click\core.py", line 555, in invoke
File "nordicsemi\__main__.py", line 1001, in usb_serial
File "nordicsemi\__main__.py", line 956, in do_serial
File "nordicsemi\dfu\dfu.py", line 129, in dfu_send_images
File "nordicsemi\dfu\dfu.py", line 97, in _dfu_send_image
File "nordicsemi\dfu\dfu_transport_serial.py", line 256, in send_init_packet
File "nordicsemi\dfu\dfu_transport_serial.py", line 421, in __execute
File "nordicsemi\dfu\dfu_transport_serial.py", line 505, in __get_response
pc_ble_driver_py.exceptions.NordicSemiException: Response Code InvalidObject
[27580] Failed to execute script __main__

Parents Reply Children
No Data
Related