...
Note: The MCU may be kept in reset by GPIO1_IO5 of the Host. Release it if needed:
gpioset -c /dev/gpiochip0 5=1
Recovery after bad programming
It is possible to get the mcu into a locked state where openocd reports an “unknown” state, see lines 13 following:
Code Block |
---|
root@solidsense-n8:~# openocd -f /etc/openocd.cfg
Open On-Chip Debugger 0.12.0+dev-00150-g91bd43134-dirty (2025-04-07-18:10)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
imx_gpio GPIO nums: swclk = 14, swdio = 15
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : imx_gpio GPIO JTAG/SWD bitbang driver
Info : imx_gpio mmap: pagesize: 4096, regionsize: 131072
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x2ba01477
Error: [nrf52.cpu] Could not find MEM-AP to control the core
****** WARNING ******
nRF52 device has AP lock engaged (see UICR APPROTECT register).
Debug access is denied.
Use 'nrf52_recover' to erase and unlock the device.
Warn : target nrf52.cpu examination failed
Info : starting gdb server for nrf52.cpu on 3333
Info : Listening on port 3333 for gdb connections |
Recovery from this state is possible by nrf52_recover
command:
Code Block |
---|
Open On-Chip Debugger
> targets
TargetName Type Endian TapName State
-- ------------------ ---------- ------ ------------------ ------------
0* nrf52.cpu cortex_m little nrf52.cpu unknown
> nrf52_recover
Waiting for chip erase...
nrf52.cpu device has been successfully erased and unlocked.
[nrf52.cpu] Cortex-M4 r0p1 processor detected
[nrf52.cpu] target has 6 breakpoints, 4 watchpoints
[nrf52.cpu] clearing lockup after double fault
Polling target nrf52.cpu failed, trying to reexamine
[nrf52.cpu] Cortex-M4 r0p1 processor detected
[nrf52.cpu] target has 6 breakpoints, 4 watchpoints
> targets
TargetName Type Endian TapName State
-- ------------------ ---------- ------ ------------------ ------------
0* nrf52.cpu cortex_m little nrf52.cpu halted
> nrf5 mass_erase
nRF52833-xxAA(build code: A0) 512kB Flash, 128kB RAM
Mass erase completed.
> exit |