The NRF51822 module by Yunjia Technology is a minimalistic but very low-
priced module utilizing Nordics NRF51822QFAA SoC. The SoC features 16Kb of RAM,
256Kb of flash ROM and comes on top of the usual micro-controller peripherals
with a 2.4GHz radio that supports both Nordics proprietary ShockBurst as well as
Bluetooth Low Energy (BLE).
The board is available for example on [ebay](http://www.ebay.com/sch/i.html?_from=R40&_trksid=p2050601.m570.l1313.TR0.TRC0.H0.Xnrf51822&_nkw=nrf51822&_sacat=0)
or at [aliexpress](http://www.aliexpress.com/wholesale?SearchText=nrf51822&catId=0&initiative_id=SB_20140804233951) for something around 8-10 USD.
wrote xxx bytes from file PATH-TO-YOUR-BINARY/YOUR-BINARY.bin in xx.yys
(x.yyy KiB/s)
> reset
```
### Debugging manually
First you have to start OpenOCD as described in the section above.
Then enter the following in a new terminal:
```
$ arm-none-eabi-gdb -tui "<your binary ELF>"
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x000119ce in ?? ()
(gdb) load
Loading section .text, size 0x2284 lma 0x16000
Loading section .ARM.exidx, size 0x8 lma 0x18284
Loading section .data, size 0x458 lma 0x1828c
Loading section .jcr, size 0x4 lma 0x186e4
Transfer rate: x KB/sec, xxxx bytes/write.
(gdb) monitor reset halt
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0
(gdb) break main
Breakpoint 3 at 0x123123: file ../main.c, line xx.
(gdb) continue
Continuing.
```
### Using UART
The UART pins are configured in [`boards/yunjia-nrf51822/include/periph_conf.h`](https://github.com/RIOT-OS/RIOT/blob/master/boards/yunjia-nrf51822/include/periph_conf.h).
The default values are PIN 1: `UART_RX` and Pin 2: `UART_TX` _(also compare
schematic above)_.
The BLE400 development board contains a CP2102 accessible through
/dev/tty.SLAB_USBtoUART. You have to edit periph_conf.h to use it with UART_RX
pin 11 and UART_TX pin 9.
The default Baud rate is `115 200`.
### Troubleshooting
#### Protected at factory (error writing to flash at address 0x000... )
This step may be executed before the first programming of the board. OpenOCD
provides the "nrf51 mass_erase" command to remove the protected flag on the
boot-loader region. RIOT does not use the proprietary Nordic "soft-device". This
is how to run the mass erase:
1. Open two terminal windows.
2. In one window, go to the RIOT root folder and run the regarding OpenOCD