在Macbook Pro上安装nrfutil
CPU为intel。
macOS版本已经为12.4的Monterey。
python3 -V
显示python版本为3.10.5。
参考文档:https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nrfutil%2FUG%2Fnrfutil%2Fnrfutil_intro.html
pip3 install --ignore-installed six nrfutil
执行命令
nrfutil --help
貌似OK了!
执行
nrfutil dfu ble --help
试着dfu一把
nrfutil dfu ble -ic NRF52 -pkg tag_tb1_lib12_c_fw_dfu_v22.07.1.3.zip -n "LS_DFU" -f
输入0
,回车。
居然报错了!错误日志:nordicsemi.dfu.package.PackageException: Package /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pc_ble_driver_py/hex/sd_api_v5/connectivity_4.1.2_usb_with_s132_5.1.0_dfu_pkg.zip not found.
?
Google了一圈,最终在DevZone找到了一篇帖子。说是要把-f
参数去掉,改为:
nrfutil dfu ble -ic NRF52 -pkg tag_tb1_lib12_c_fw_dfu_v22.07.1.3.zip -n "LS_DFU"
常见错误
Board not found
斗大的字,板子未找到。未插Dongle或者没插好啦。
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/bin/nrfutil", line 33, in <module>
sys.exit(load_entry_point('nrfutil==6.1.5', 'console_scripts', 'nrfutil')())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nordicsemi/__main__.py", line 1173, in ble
is_jlink = port_is_jlink(port)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nordicsemi/__main__.py", line 1110, in port_is_jlink
raise NordicSemiException('Board not found')
Device not found
连接失败,未找到设备。一般是设备进入DFU未成功,找不到,所以连接失败。
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/bin/nrfutil", line 33, in <module>
sys.exit(load_entry_point('nrfutil==6.1.5', 'console_scripts', 'nrfutil')())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nordicsemi/__main__.py", line 1215, in ble
dfu.dfu_send_images()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nordicsemi/dfu/dfu.py", line 127, in dfu_send_images
self._dfu_send_image(self.manifest.application)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nordicsemi/dfu/dfu.py", line 88, in _dfu_send_image
self.dfu_transport.open()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nordicsemi/dfu/dfu_transport_ble.py", line 475, in open
self.target_device_name, self.target_device_addr = self.dfu_adapter.connect(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nordicsemi/dfu/dfu_transport_ble.py", line 153, in connect
self.verify_stable_connection()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nordicsemi/dfu/dfu_transport_ble.py", line 264, in verify_stable_connection
raise Exception("Connection Failure - Device not found!")