Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Installing nRF Connect SDK

Carefully read the [Nordic nRF Connect SDK documentation] Documentation for installation instructions. At a bare minimum on a Linux host they boil down to the following steps:

...

OpenOCD uses a server-client architecture, it is therefore recommended to operate at least two concurrent terminals to the board, e.g. one UART Console and one SSH, or 2x SSH.
Open a third console for interactive debugging to monitor the UART between MCU and Linux.

Take MCU out of reset

The MCU may be kept in reset by GPIO1_IO5 of the Host. Release it:

Code Block
# check status of control gpios (reset, power)
gpioget -c /dev/gpiochip0 5 6
"5"=inactive "6"=active

# release reset
gpioset -c /dev/gpiochip0 5=1

Start OpenOCD

A suitable configuration file for SolidSense N8 with FWM7BLZ22W MCU is provided below:

...

This example provides a CLI on the UART that can be accessed from Linux running on the N8:

Code Block
oot@solidsenseroot@solidsense-n8:~# microcom -s 115200 /dev/ttymxc3

uart:~$ *** Booting nRF Connect SDK v2.9.1-60d0d6c8d42d ***
*** Using Zephyr OS v3.7.99-ca954a6216c9 ***
help
Please press the <Tab> button to see all available commands.
You can also use the <Tab> button to prompt or auto-complete all commands or its subcommands.
You can try to call commands with <-h> or <--help> parameter for more information.

Shell supports following meta-keys:
  Ctrl + (a key from: abcdefklnpuw)
  Alt  + (a key from: bf)
Please refer to shell documentation for more details.

Available commands:
  clear    : Clear screen.
  device   : Device commands
  devmem   : Read/write physical memory
             Usage:
             Read memory at address with optional width:
             devmem <address> [<width>]
             Write memory at address with mandatory width and value:
             devmem <address> <width> <value>
  gpio     : GPIO commands
  help     : Prints the help message.
  history  : Command history.
  kernel   : Kernel commands
  ot       : OpenThread subcommands
             Use "ot help" to get the list of subcommands
  rem      : Ignore lines beginning with 'rem '
  resize   : Console gets terminal screen size or assumes default in case the
             readout fails. It must be executed after each terminal width change
             to ensure correct text display.
  retval   : Print return value of most recent command
  shell    : Useful, not Unix-like shell commands.
uart:~$

microcom can be exited pressing ctrl+x.

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