Support for the Yunjia NRF51822 board. More...
Support for the Yunjia NRF51822 board.
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).
|Timers||3 (2x 16-bit, 1x 32-bit [TIMER0])|
|ADCs||1x 10-bit (8 channels)|
|Vcc||1.8V - 3.6V|
|Datasheet||Datasheet (pdf file)|
|Reference Manual||Reference Manual|
The Yunjia NRF51822 module comes without any on-board programming and flashing capabilities. It supports however to be programmed using of-the-shelf programmers as Segger's JLink or STM's STLink.
A very simple and affordable way to program and debug the Yunjia module is to the integrated ST-Link/V2 programmer of any STM32Fx-discovery board. The needed steps are described in the following sections. If you want to use a stand-alone ST-Link adapter, you just simply have to alter the wiring to fit for your programmer, the software part is identical.
First of all make sure the your ST-Link device is detected and can be accessed properly. In Linux you might have to adept your
udev rules accordingly:
now replug the usb cable and flash.
Have a look at the 'Setting up udev rules' section in this README file if you need help.
Second you need to enable the stand-alone ST-Link mode of the discovery board by removing the two
CN2 jumpers, found somewhere in the upper right part of the board. This disconnects the ST-Link programmer from the micro-controller part of the port and enables direct access through the pin-header
CN3, also labeled
The Yunjia NRF51822 module supports the Serial Wire Debug (SWD) interface. To access the device the following four lines need to be connected with the STM32x-discovery board:
The following image shows the wiring for an STM32F0-discovery board (although not the most beautiful...):
Debugging and programming the Yunjia module works well with [[OpenOCD]].
We suggest to use a fairly recent version, best use the upstream version from their git repository. Version 0.9.0-dev-00148-g3a4ec66 is reported to work.
To program the Yunjia NRF51822 module, just go to your RIOT application and type:
and voila, the new firmware should be flashed onto your device.
As the Yunjia module does not provide a reset button, RIOT includes a target to reset the board. To do that, just type
and your board will reboot.
The debugging setup comprises of two parts: a GDB server and a GDB client. To usual workflow is to start the GDB server first and then connect to it with some kind of front-end (e.g. command line, IDE, ...).
To start the GDB server, just type
This will start a local GDB server on
If you are fine with working with the GDB command line client, you can start debugging your device by just typing
in a second terminal window. This will automatically connect to your previously opened GDB server and will also load your corresponding .elf file.
Alternatively you can configure your IDE (e.g. eclipse or similar) to connect directly to the GDB server. See here for more information on how to configureEclipse
For OpenOCD to work correctly, you need the following configuration file (which you can also find in
You can now program your device by doing the following:
openocd -d3 -f RIOTDIR/boards/yunjia- nrf51822/dist/openocd.cfg
telnet 127.0.0.1 4444
First you have to start OpenOCD as described in the section above.
Then enter the following in a new terminal:
The UART pins are configured in
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
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:
openocd -f boards/yunjia-nrf51822/dist/openocd.cfg.
telnet 127.0.0.1 4444.
This should have erased the whole memory of the device.
|Board specific definitions for the Yunjia NRF51822 board. |
|Peripheral MCU configuration for the Yunjia NRF51822 board. |