"Cannot erase protected sector at 0x0" on Nano 2


#1

Hi,
I am using a Nano 2 on Windows 10 with PlatformIO, which uses OpenOCD to download the hex file firmware to the Nano.

I am getting this error when I try to flash the firmware using PlatformIO and OpenOCD.

GNU ARM Eclipse 64-bits Open On-Chip Debugger 0.10.0-00114-g8419536 (2017-04-18-21:56)

Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
adapter speed: 10000 kHz
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.0
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : reduce speed request: 10000kHz to 5000kHz maximum
Info : clock speed 10000 kHz
Info : SWD DPIDR 0x2ba01477
Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x000008e4 msp: 0x20000400
** Programming Started **
auto erase enabled
Warn : Unknown device (HWID 0x000000c7)
Info : Padding image section 0 with 1692 bytes
Info : Padding image section 1 with 2360 bytes
__Error: Cannot erase protected sector at 0x0__
__Error: failed erasing sectors 0 to 35__
embedded:startup.tcl:476: Error: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 532
at file "embedded:startup.tcl", line 476

Any idea how I can fix this?
Thanks,
/-/


#2

It seams that you are going to download firmware to protected sectors. What is the exact command executed when flash the firmware?


#3

I have solved it now. I needed to download the soft device firmware first and then everything worked correctly.
thanks
/-/


#4

Much glad yo’ve solved the problem! :+1: