我有一个自定义的nrf52芯片上的电路板与社会福利署的引脚暴露。我已经从https://github.com/ntfreak/openocd克隆并安装了最新的openocd。最新版本包含了nrf52芯片的所有最新路径,因此不需要像许多老版本的在线指南中所建议的那样进行任何额外的更改。我能够连接到芯片使用ST-LinkV2 2。当连接时,我可以使用mdw和mdb读写内存位置。我还可以运行一些基本的openocd命令,比如dump_image e.t.c,这证实了设置是好的。但是,“停止”和“程序命令”总是会导致以下错误:
JTAG failure -4
JTAG failure -4
JTAG failure -4
JTAG failure -4
JTAG failure -4
JTAG failure -4
target halted due to debug-request, current mode: Thread
xPSR: 00000000 pc: 00000000 msp: 00000000
jtag status contains invalid mode value - communication failure
Polling target nrf52.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Previous state query failed, trying to reconnect
jtag status contains invalid mode value - communication failure
Polling target nrf52.cpu failed, trying to reexamine
如果我尝试使用闪存image_write,我会得到错误,
JTAG failure
Error setting register
error starting target flash write algorithm
Failed to enable read-only operation
Failed to write to nrf52 flash
error writing to flash at address 0x00000000 at offset 0x00000000
in procedure 'dap'
jtag status contains invalid mode value - communication failure
Polling target nrf52.cpu failed, trying to reexamine
我在网上读过不同的指南,其中一种可能的解决方案涉及到APPPROTECT寄存器,它必须被禁用才能使任何写入闪存。保护,但是应该帮助我们访问这个位置的dap通讯,
dap apreg 1 0x04 0x01
返回一个错误:
invalid subcommand apreg 1 0x04 0x01
请,我想知道是否有人用stlink-v2成功地设计了一个新的空nrf52芯片,以及必要的步骤,或者是否有人遇到过类似的问题。谢谢。
下面是我的配置文件:
#nRF52832 Target
source [find interface/stlink.cfg]
transport select hla_swd
source [find target/nrf52.cfg]
#reset_config srst_nogate connect_assert_srst
发布于 2018-10-10 17:10:36
如果有人遇到这个问题,我会得到一个原始的Jlink-Edu来解决这个问题。我还不得不把微控制器的复位销拉得很高,才能让jlink工作。
发布于 2019-01-25 20:43:16
我以这种方式解决了“受保护的nRF52”芯片问题,在Windows上使用Particle.io调试器https://store.particle.io/products/particle-debugger安装程序从Arduino编写nRF52芯片,如https://www.forward.com.au/pfod/BLE/LowPower/index.html中所述
注意:这里描述的恢复过程不需要安装Arduino。
从http://gnutoolchains.com/arm-eabi/openocd/下载OpenOCD-20181130.7z预编译的windows openocd
https://github.com/ntfreak/openocd上openocd src的最新版本也应该工作,因为它包括了target\arm_adi_v5.c中的apreg。
解压缩,打开cmd提示符解压缩dir,输入cmd
bin\openocd.exe -d2 -f interface/cmsis-dap.cfg -f target/nrf52.cfg
响应
Info : auto-selecting first available session transport "swd". To override use '
transport select <transport>'.
adapter speed: 1000 kHz
cortex_m reset_config sysresetreq
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: FW Version = 1.10
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x2ba01477
Error: Could not find MEM-AP to control the core
Info : Listening on port 3333 for gdb connections
打开telnet程序(如teraTerm )并连接到端口4444上的本地主机,即127.0.0.1 telnet端口4444
cmd窗口显示
Info : accepting 'telnet' connection on tcp/4444
在telnet (即teraTerm)类型
nrf52.dap apreg 1 0x04
返回保护的0 <<<芯片
nrf52.dap apreg 1 0x04 0x01
然后
nrf52.dap apreg 1 0x04
返回一个未受保护的<<芯片。
然后动力循环板
现在可以使用arduino ide闪存软件设备并编写低功耗BLE。
发布于 2018-10-09 14:12:33
尽管dap
命令是由openOCD help
列出的,但它不是为必须与ST-help
一起使用的传输hla_swd
实现的。
如果ST-Link是中国的通用类型,它可以是升级至CMSIS-DAP,它使用swd
传输并支持nrf52.dap apreg 1 0x04 0x01
命令来禁用读回保护和擦除闪存。你需要另一个ST链接来实现,或者你可以用在通用STM32F103C8T6板上安装CMSIS-DAP代替。
在此之后,您可以使用ST链接来编程nRF52,也可以继续使用CMSIS来编程STM32单片机。
核心板嵌入的ST-链接也可以是升级为J-Link,它允许在nRFgo Studio中使用“恢复”选项来擦除闪存,它还应该与"nrfjtool“或OpenOCD一起工作。
https://stackoverflow.com/questions/52308978
复制相似问题