nRF51 mbed compiler works with nRF52 target

02 Jul 2015

I just received my nRF52 development kit and immediately tried the mbed compiler using the nRF51 as a target (since there doesn't seem to be a bootloader specifically for the nRF52). I was able to blink an led and get data streamed to the serial monitor from an MPU9250 connected to the I2C bus. The curious thing is that the sensor fusion rate was only 1080 Hz compared to 380 Hz for the nRF51. I would have expected at least four times the rate since the cpu speed alone is four time faster on the nRF52 not to mention the FPU. Is it possible the nRF51 compiler doesn't take advantage of the optimizations possible with a proper compiler specifically designed for the nRF52? Overall this performance was somewhat disappointing. 1 kHz is plenty fast for sensor fusion, that's OK. But I expected a factor of ten increase in speed. Why should it not be so?

02 Jul 2015

Thanks for reporting this experiment. We haven't ourselves had the chance yet to play with the nRF52; good to know that nRF51 binaries (and soft-device) work unchanged on it.

nRF51 is a Cortex-M0 capable only of the ARMv6 instruction set. nRF52 is Cortex-M4, which is ARMv7 and may even have a FPU. You're correct in expecting that compiling for cortexM4 should yield an improvement beyond the step-up of clock-speed.

We'll try to get include nRF52 supported officially, and then you can expect these improvements to come naturally.

02 Jul 2015

Hi Rohit,

AFAIK, the nRF52 does have a FPU, which I am anxious to take for a ride.

Is there an estimate of when proper binaries for the nRF52 might become available?

02 Jul 2015

If you work offline you can try exporting the mbed-src lib, and compiling it for the NRF52. Who knows, might just work :P.

02 Jul 2015

I am a complete idiot when it comes to Eclipse or Keil toolchains. They are just complicated enough to thwart every attempt I have made to install let alone use them!

11 Jul 2015

Hi Kris,

How is everything going ? I want to let you know that the new IMM-NRF52832 will be pin compatible with the IMM-NRF51x22 series so you can upgrade your hardware to the nRF52 without changing you PCB layout. IDAP-Link will also have support for the nRF52 soon. For Eclipse setup try my blog page I have improve the project settings to make it easier to get going with Eclipse GCC support for nRF52 is also ready.


16 Jul 2015

Hi Hoan,

I tried to set up Eclipse following your blog but wasn't able to get anything close to what you have and I couldn't make it work. I did succeed in getting Keil set up and was able to compile a blink program but couldn't get any result when I flashed the nRF51822 mkit. Still trying to find some path forward.

I have not been able to get your boards to work for me except with the blink program you compiled.

I was able to program my custom board using the programmer that comes with the BLE Nano, so at least I have one way to program my boards.

I just ordered the nRF51 DK to try using the external J-Link programmer.

This is a lot harder than programming an Arduino!


17 Jul 2015

to use eclipse, you must start with my Eclipse page to setup Eclipse + GCC compiler. After that you setup the Directory tree by cloning my GitHub repo. It is indeed a lot harder than Arduino. To use the board with mBed compiler, you need to select HRM1017 as target. I tried it. It seems to work.

17 Jul 2015

I'll give it a try with HRM1017. While the RedBearLabs programmer works with mbed, I would prefer to use your IDAP programmer.

I am having a hard enough time with Keil, I can only handle one impossibly difficult toolchain at a time!

18 Jul 2015

IDAP-Link does work with Keil out of the box you know. To use it, select CMSIS-DAP jtag in the configuration instead of JLink.

05 Dec 2015

Hei Kris,

how could you use the blink example on nrf52? You just used drag and drop and go or you uploaded the code via NRFGO?

18 Feb 2016

Hi all, I'm also having trouble with the RF52 DK.

I originally tried with the blinky hex that comes with the Nordic SDK, and couldn't get that working until I found this post,

After re-flashing bootloader, and erasing the chip using nRFGo Studio, I was able to copy the blinky hex to the USB drive and it worked.

Now I'm trying to get a simple blinky going through mbed IDE and not getting any joy.

#include "mbed.h"

DigitalOut myled(p17);

int main() {
    while(1) {
        myled = 1;
        myled = 0;

Am I missing something?


28 Sep 2016

Maybe DigitalOut myled(P0_17);?