This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Program bluetooth for nrf51822 yunjia board with STLink-v2

Hello everyone,

i'm kinda new to microcontroller programming and feel like i bit of more than i can chew. I bought a variant of the nrf51822 chip ( and thought it would be easier to get it to run with BLE.

For the start I wanted to run the example programs provided in Keil from Nordic, since I don't have the Nordic Developer board, programming seems to be a bit more challenging. Following different guides that support my available resources like STLink-V2, using SWD andOpenOCD seemed most promising. Using the following:

openocd -f interface/stlink-v2.cfg  -f target/nrf51.cfg   or
openocd cat -f C:/openocd/openocd-0.9.0/tcl/RIOT/boards/yunjia-nrf51822/dist/openocd.cfg


telnet 4444
nrf51 mass_erase
flash write_image erase "../ble_app_hrs.hex" 0

With this the nrf is programmed, I bought the BLE400 board later since I couldnt be sure that the programming worked and also because I thought it would make programming easier (what was wrong). The blinky example (\ARM\Device\Nordic\nRF51822\Board\PCA10001\blinky_example\arm\blinky.uvproj) is working, so I know the programming is ok.

What isn't working are bluetooth examples. I try to get ble_app_hrs.hex running, which as I understand needs the softdevice programmed additionally. I had some orientation from here:

But it seems softdevice (I tried s110_nrf51_8.0.0_softdevice.hex) just gets overwritten when using:

program softdevice.hex

program app.hex


or vice versa.

So the normal functionality of the bluetooth heart rate example doesn't seem to work, no leds are blinking. Functionality:

I don't get any errors, the programming seems to run normally. Does anyone have a tip how get BLE running on this chip?

Or do I have to buy a new programming device? A problem is that I do not have any debugging feedback to see what went wrong.

My setup:

image description

Chip description: N51822, QFAAC0, 1311AH

  • Take a look here. I posted a link to stackexchange with all the steps to program a board with keil Link

    Keil provides everything to program the board

    If you want to use the ble part. You first need to flash the softdevice. If you then flash you own code you need to flash only the part that isnt used by the softdevice or you will erase it from the flash. Take a look at the softdevice specification for more information. In Keil you can use "Erase full chip" for the softdevice, and "Erase selected" for your own code.

  • Yo. Can you post a link to the exact device you have? The SDK examples are made for the DK, and do not always run out of the box with other boards. There exists three chip revisions, and the custom boards do not always have an external 32 Khz oscillator. The SDK examples use this oscillator, and will hang if it is not present.

Reply Children
No Data