How to recover bricked nRF52832 with ST Link?

Hi,

I was trying to write the s132 SoftDevice from the nRF5_SDK_13.0.0 onto the Sparkfun nRF52832 breakout via OpenOCD and an ST-Link v2 debugger. The SoftDevice flashed and verified successfully. After reset, I am not able to connect to the nRF52832 via SWD any more. How to check if this is a FW or a HW failure? Is there any way to recover using only the hardware above?

I have seen that the nRF Go Tools and nrfjprog support recovery option, but those seem to be working with Segger only. Are there any options for doing the same via ST-Link?

This is the OpenOCD log from failed connection attempts:

Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 10000 kHz
Info : Unable to match requested speed 10000 kHz, using 4000 kHz
Info : Unable to match requested speed 10000 kHz, using 4000 kHz
Info : clock speed 4000 kHz
Info : STLINK v2 JTAG v27 API v2 SWIM v6 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.193663
Error: init mode failed (unable to connect to the target)
in procedure 'init' 
in procedure 'ocd_bouncer'

Error code from more verbose debug output:

Debug: 218 3 stlink_usb.c:1659 stlink_usb_open(): transport: 1 vid: 0x0483 pid: 0x3748 serial: 
Info : 219 6 stlink_usb.c:563 stlink_usb_version(): STLINK v2 JTAG v27 API v2 SWIM v6 VID 0x0483 PID 0x3748
Info : 220 6 stlink_usb.c:1770 stlink_usb_open(): using stlink api v2
Debug: 221 6 stlink_usb.c:762 stlink_usb_init_mode(): MODE: 0x02
Info : 222 7 stlink_usb.c:595 stlink_usb_check_voltage(): Target voltage: 3.193663
Debug: 223 7 stlink_usb.c:817 stlink_usb_init_mode(): MODE: 0x01
Debug: 224 8 stlink_usb.c:442 stlink_usb_error_check(): unknown/unexpected STLINK status code 0xb
Error: 225 8 stlink_usb.c:1779 stlink_usb_open(): init mode failed (unable to connect to the target)
Debug: 226 8 hla_layout.c:47 hl_layout_open(): failed
Debug: 227 8 command.c:626 run_command(): Command failed with error code -4
User : 228 8 command.c:687 command_run_line(): in procedure 'init' 
in procedure 'ocd_bouncer'
Debug: 229 8 command.c:626 run_command(): Command failed with error code -4
User : 230 8 command.c:687 command_run_line(): 
Debug: 231 8 hla_interface.c:117 hl_interface_quit(): hl_interface_quit

The ST-Link interface is working, I've checked it with another platform. If there is no way to recover using ST-Link, I'll get a JLink from work and see if it helps. Thanks in advance!

  • IIRC some of those ST-Links can be reflashed to J-Links via a firmware update from SEGGER. Might be worth a try.

  • But in general it's very unlikely you "bricked" the nRF5x and even less that you've burned it just by flashing Soft Device. Usual problems when you crawl this forum are: bad wiring/other HW problem or not using the latest flashing SW or "go with SEGGER J-Link OB on some nRF5x DK boards or with stand-alone SEGGER programmer and use latest Nordic tools to recover/erase all". Sorry for not being more specific but it's almost impossible to debug this kind of issue over the forum Q&A...

  • Turbo J, thanks for the suggestion! I tried with the official Segger update, it says my ST-Link is not compatible. Was worth a try however, as Segger seems to squeeze more performance from the same STM32 chip than the ST themselves.

    endnode, the main question here is whether it is possible to perform the recover/erase all procedure with ST-link. The wiring is very simple, but the OpenOCD version that supports nRF52 doesn't seem stable to me. I might hack myself a JLink from a small STM32F103 board later, as I found a working hex file somewhere online, but first I'll get a normal JLink from the office for a couple of days and check if it helps.

  • Update: The JLink connected to the board without problem. I ran "nrfjprog --recover". Now the OpenOCD sees the device, but I will not use it for development, because it seems unstable and may brick the board again. I'll use JLink while it is available, until I find a suitable OpenOCD version to work with nrf52. I'm leaving this question open because no fix through OpenOCD was found.

  • There actually is patch for OpenOCD to perform nRF5x recover procedure as it is designed on top of generic ARM registers. See this thread (search in the forum is powerful tool, I hope we can close this Q&A then;).

Related