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 (github.com/.../Board:-yunjia-nrf51822) 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

and

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

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: devzone.nordicsemi.com/.../

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

program softdevice.hex

program app.hex

reset

or vice versa.

So the normal functionality of the bluetooth heart rate example doesn't seem to work, no leds are blinking. Functionality: devzone.nordicsemi.com/.../group__ble__sdk__app__hrs__eval.html

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

Parents
  • 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.

  • Hello

    First look at your chip and find the revision code. Go to de datasheet of the chip en look just above the schematics at the end. To check your revision code look at the following document Compatibility Matrix

    If you know your version of your chip. you can download the right SDK version here

    Since you already now that the programming goes well, because of the led blink example. We can eliminate a couple of problems. If you program the board you first have to program the softdevice. After you flashed it succesfully. You can flash your main program. Remember to select in keil to program only the selected sectors. Or you will erase the softdevice. Go to Flash -> Configure flash tools -> Debug -> Settings (stlink) -> Flash download -> check erase sectors. For the softdevice you use Erase full chip.

    Ps -->> you have 2 crystals so no need to adjust your code

Reply
  • Hello

    First look at your chip and find the revision code. Go to de datasheet of the chip en look just above the schematics at the end. To check your revision code look at the following document Compatibility Matrix

    If you know your version of your chip. you can download the right SDK version here

    Since you already now that the programming goes well, because of the led blink example. We can eliminate a couple of problems. If you program the board you first have to program the softdevice. After you flashed it succesfully. You can flash your main program. Remember to select in keil to program only the selected sectors. Or you will erase the softdevice. Go to Flash -> Configure flash tools -> Debug -> Settings (stlink) -> Flash download -> check erase sectors. For the softdevice you use Erase full chip.

    Ps -->> you have 2 crystals so no need to adjust your code

Children
No Data
Related