You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Vipul Rahane <vi...@runtime.io> on 2016/11/22 21:24:13 UTC

Resolving Red Bear nano nrf51 flash locks up

Hello,

Recently while setting up the multiple connection demo, I found weird issues with some of the boards which causes the flash on the boards to get locked up, I know the symptoms but I am not sure about what causes it: 

How do you know it’s locked up ?

/***************************************************************************************/

Vipuls-MacBook-Pro:demos vipul$ newt run slinky-rbn1 0
App image succesfully generated: /Users/vipul/runtime/demos/bin/targets/slinky-rbn1/app/apps/slinky/slinky.img
Loading app image into slot 1
[/Users/vipul/runtime/demos/repos/apache-mynewt-core/hw/bsp/nrf51-blenano/nrf51dk_debug.sh /Users/vipul/runtime/demos/repos/apache-mynewt-core/hw/bsp/nrf51-blenano /Users/vipul/runtime/demos/bin/targets/slinky-rbn1/app/apps/slinky/slinky]
Open On-Chip Debugger 0.10.0-dev-snapshot (2016-10-12-14:16)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'swd'
cortex_m reset_config sysresetreq
adapter speed: 1000 kHz
GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin10 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /Users/vipul/runtime/demos/bin/targets/slinky-rbn1/app/apps/slinky/slinky.elf...done.
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 : clock speed 1000 kHz
Info : SWD DPIDR 0x0bb11477
Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : accepting 'gdb' connection on tcp/3333
Info : nRF51822-QFAC(build code: A1) 256kB Flash
undefined debug reason 7 - target needs reset
0xfffffffe in ?? ()
nrf51.cpu: target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0xfffffffe msp: 0xfffffffc
nrf51.cpu: target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0xfffffffe msp: 0xfffffffc
(gdb) bt
#0  0xfffffffe in ?? ()
#1  <signal handler called>
#2  0x00000000 in ?? ()
Cannot access memory at address 0x0
#3  0x00000000 in ?? ()
/*************************************************************************************************/

How do you fix it ?

/*************************************************************************************************/

In one terminal window:

Vipuls-MacBook-Pro:demos vipul$ openocd -f interface/cmsis-dap.cfg -f target/nrf51.cfg -c init
Open On-Chip Debugger 0.10.0-dev-snapshot (2016-10-12-14:16)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'swd'
cortex_m reset_config sysresetreq
adapter speed: 1000 kHz
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 : clock speed 1000 kHz
Info : SWD DPIDR 0x0bb11477
Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints

In a different terminal window:

Vipuls-MacBook-Pro:apache-mynewt-core vipul$ telnet 127.0.0.1 4444
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> nrf51.cpu mww 1073865988 2
> nrf51.cpu mww 1073865996 1
> nrf51.cpu mww 1073866004 1
> Connection closed by foreign host.

What this does is:

nrf51.cpu mww 1073865988 2 :  /****** Write to NVMC CONFIG register (0x4001e504): 0x02 to enable Erase *****/

nrf51.cpu mww 1073865996 1:   /****** Write to NVMC ERASEALL register (0x4001e50c): 0x01 to Erase all *****/

 nrf51.cpu mww 1073866004 1:  /****** Write to register NVMC ERASEUICR register (0x4001e514): 0x01 to Erase UICR ******/ 

/*************************************************************************************************/

I revived couple of devices using this. I am going to try this approach for some of the nano2s as well. They have nrf52 chips in them. 

Note: I had tried erasing the flash on these devices in gdb using "monitor flash erase_address 0 0x40000” which does not have any effect.

Just wanted to let the community know incase anyone faces similar issues.

Regards,
 Vipul Rahane