ST-LINK NRF51822 and OPENOCD [closed]

bishop gravatar image

asked 2015-01-03 18:08:07 +0200

Hello Everyone! I want to program nrf51822. I'm using open OCD 0.9. I created openocd.cfg file:

source [find interface/stlink-v2.cfg]
transport select hla_swd
source [find target/nrf51.cfg]

and started openocd-x64-0.9.0-dev-141103193059.exe

After it started daemon. I connected to it via telnet port - 4444.

Prompt this commands:

> flash banks
#0 : nrf51.flash (nrf51) at 0x00000000, size 0x00040000, buswidth 1, chipwidth 1
#1 : nrf51.uicr (nrf51) at 0x10001000, size 0x000000fc, buswidth 1, chipwidth 1
> halt
target state: halted
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x81000003 pc: 0x000141b8 msp: 0x20003c70
> flash write_image blinky_gcc_xxaa.hex 0
Failed to write sector @ 0x00000800
error writing to flash at address 0x00000000 at offset 0x00000000
in procedure 'flash'

What's a probplem?

edit retag flag offensive reopen delete report spam

Closed as "the question is answered, right answer was accepted" by Stian at 2015-01-07 12:37:28 +0200

2 answers

Sort by » oldest newest most voted
bishop gravatar image

answered 2015-01-03 20:10:27 +0200

I resolved this issue! I prompt this:

> nrf51 mass_erase

and after it programming done well.

edit flag offensive delete publish link more
hnhoan gravatar image

answered 2015-01-03 19:26:06 +0200

try using the "program" command instead.

program blinky_gcc_xxaa.hex verify
edit flag offensive delete publish link more


Thank you for answer, but this solution is not works.

program blinky_gcc_xxaa.hex verify

target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0xc1000000 pc: 0x00012b98 msp: 0x20001c48
** Programming Started **
auto erase enabled
nRF51822-QFAA(build code: G0) 256kB Flash
failed erasing sectors 0 to 2
** Programming Failed **
shutdown command invoked
bishop ( 2015-01-03 19:41:47 +0200 )editconvert to answer

User menu

    or sign up

Recent questions

Question Tools



Asked: 2015-01-03 18:08:07 +0200

Seen: 5,076 times

Last updated: jan. 03 '15