This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to erase nrf51822 softdevice or app code

I write NRF_UART0->ENABLE = 0x00 in my app in first line code, but now nrf51822 can connect but cannot Download and erase;

  1. in keil it report:

**JLink Warning: Could not read memory location 0x20000000 when trying to set soft RAM BP Cannot setup Breakpoint at Address

  1. I try nRFgo Studio to erase all, but :

image description when I try push "Recover" button, it tell me: Recover failed Invalid operation

  1. I try nrfjprog to erase, but :

image description

  1. I try jlink-flash, but

Failed to download RAMCode. Failed to prepare for programming. Failed to download RAMCode! Erase Thread exited Erase failed.

Is there other method to erase my app-code or softdevice? Did "NRF_UART0->ENABLE = 0x00" caused the ic cannot download(I test it in another nrf51822,it cannot download and erase, and report the same error)。

my softdevice is s130_nrf51_2.0.1_softdevicehex.; my ic is nrf51822_xxac, 32kram, 256+1K flash;

  • No, writing to NRF_UART0 or other registers cannot brick the device, don't worry. Most probably just your USB cable or other wiring causes errors to JTAG/SWD line. Try different USB port, different PC, different (shorter and thicker/better) USB cable, unplug all jump-wires and other connectors from the target...

  • I am sure jlink has no problem, becase it work ok in orther 51822_board. And I write NRF_UART0 in two board, the same problem arise. Although it doesn't seem possible, but I have no board to test " write NRF_UART0".

    I want to konw Is there other method to erase 51822, I have test all the method what I know in two PC with two jlink.

  • As I say, if you really believe that malfunctioning of JTAG/SWD interface relates to NRF_UART0 register then it indicates rather some electrical problem. Have you tried with different wiring, USB port etc.? Like really revised entire set-up not only changing one wire to another from the same box and claiming "neah, it didn't help"?! What HW do you use? If it would be a problem of nRF51 chip then you could reproduce it on nRF5 DK board. If so then you can use another SEGGER J-Link (or similar SWD compatible) programmer, attach to DEBUG IN port and try to erase the target this way (bypassing internal SEGGER J-Link OB). There are many things you can try and while there might be a failure of the chip or relation to some FW features you have enabled in your code it's so unlikely that I would never claim it unless I tried very hard all other ways!

  • The problem have resolved in 11:55 AM with a new jlink(V9) with new driver(V6.20). my old jlink is V8 and driver is V4.98e. I have test several times, now can sure that the Jlink(V8) with V4.98e can download and debug the app-code in general, but if the code cause some problems (erase error flash area, power off so quick, the app-code don't match the device-soft, and so on), the jlink(V8) cannot work.

    You are right, Thank you;

  • Great, so let's close the question and mark the solution!;)

Related