interoberlin / nRF51-playground

Playground for our nRF51822 Bluetooth Low Energy experiments
https://www.interoberlin.de/blog/category/projects/ble/
9 stars 2 forks source link

Error: Cannot erase protected sector at 0x0 #2

Closed matthiasbock closed 9 years ago

matthiasbock commented 9 years ago
$ openocd -f openocd.cfg -c "program main.bin 0x0; verify"
Open On-Chip Debugger 0.10.0-dev-g8590315 (2015-08-20-20:37)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : FTDI SWD mode enabled
Warn : Transport "swd" was already selected
cortex_m reset_config sysresetreq
adapter speed: 1000 kHz
Info : clock speed 1000 kHz
Info : SWD IDCODE 0x0bb11477
Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0x00012b98 msp: 0x20001c48
** Programming Started **
auto erase enabled
Info : nRF51822-QFAC(build code: A1) 256kB Flash
Error: Cannot erase protected sector at 0x0
Error: failed erasing sectors 0 to 0
embedded:startup.tcl:454: Error: ** Programming Failed **
in procedure 'program' 
in procedure 'program_error' called at file "embedded:startup.tcl", line 510
at file "embedded:startup.tcl", line 454
nerilex commented 9 years ago

maybe an

make erase

can help you to resolve this issue.

matthiasbock commented 9 years ago

It does, thank's for your comment. This problem was related to the chip's memory protection unit (MPU). A "nrf51 mass_erase" makes the flash writeable again.