2 years, 9 months ago.

Problem with nRF52-DK board and mbed OS 5.1


Following the announcement of mbed 5.1, I tried to run the blinky application on nRF52. However, it did not work and I guess now the board is bricked!

Here is what I did:

  • Installed python 2.7, mbed 5.1 and GCC (gcc-arm-none-eabi-4_9-2015q2-20150609-win32)
  • I followed the instructions on the nRF52-DK platform page to update bootloader to version 0219
  • I created a new mbed project "mbed new blinky"
  • Created a main.cpp file and typed in the blinky source

include the mbed library with this snippet

#include "mbed.h"
#include "rtos.h"

DigitalOut led1(LED1);

// main() runs in its own thread in the OS
// (note the calls to Thread::wait below for delays)
int main() {
    while (true) {
        led1 = !led1;
  • Compiled the code using "mbed compile -t GCC_ARM -m NRF52_DK". The code compiled with no issues and an ELF and a HEX file was generated
  • Converted the EFL file to BIN using "arm-none-eabi-objcopy.exe -O binary blinky.elf blinky.bin"
  • Finally, connected the nRF52-DK to USB, copied the blinky.bin file to the drive recognized as mbed.

Once the copy was finished, the drive dismounted and mounted again on its own. I take it that it means the .bin file was now flashed. However, the LED1 did not blink as expected. I disconnected and reconnected the board a few time, repeated the flashing process but could not resolve the issue.

I also tried to reflash the bootloader using the same 0219 version but it now also fails (i.e. it does not reach the state where the LED1 remains constantly on). I don't know if the board is bricked or it simply cannot reflash the same bootloader version.

Any idea what I did wrong?

Question relating to:

The nRF52 Development Kit is a single-board development kit for Bluetooth Smart, ANT and 2.4GHz proprietary applications using the nRF52 Series SoC. This kit supports both development for nRF52832 SoCs.

Hello, Hello, I want to use pk_encryption and decryption using nRF52832.. I cant access mbedtls_pk_parse_public_keyfile because of dirent.h error. please suggest some solution to successfully encrypt and decrypt data using RSA in nRF52. Thank You.

posted by sonal kale 09 Feb 2018
Comment on this question

1 Answer

2 years, 9 months ago.

Hello Arash,

You don't have to convert the hex file to a bin file, just copy and paste the hex file to the drive exposed by the board. I've tested your program and it work just fine with the NRF52_DK, what is the revision of your board ? Mine is 10040.

I've tried your manipulation it doesn't work as expected because the softdevice from Nordic is not in it but it certainly didn't brick the board.

Just copy the hex file generated and it should work.

Hello Vincent,

Thanks a lot for your quick reply. I tried copying the hex file but it didn't work either: the device restarts (i.e. gets dismounted and mounted again) and I get fail.txt file in it. The text inside it is "SWD ERROR". If I leave it there, after 30 seconds it restart again and in the fail.txt I see "TIMOUT"

Also, the HEX file is rather huge for such a small program (530 KB). Is it supposed to be so big? I mean, for a large project is this going to work? Or maybe the file is not really copied to the flash and then programmed but rather you program the flash as the file is being streamed over USB.

Oh, btw, the revision of the board is 1.1.0 (2016.22)

posted by Alef Sin 09 Aug 2016


Yes the program is supposed to be this big but its an hex file not a binary file. If the Ihex file is converted to a binary then it's size is 190K and 110K in this space is taken by the softdevice (the BLE stack from Nordic). Other space is used by the BLE abstraction, the OS and a lot of space is taken by the standard library for I/Os (this code is in the final binary, in a latter version of the OS, things not used will not be in the final binary).

While it is a lot, when you will design and code a "real world" application the overhead of mbed-os will be less visible and acceptable.

What is your version of windows ? I bet it is windows 10. The Nordic DAP firmware had an issue like your last time I tried on windows 10 (works fine on 7).

As a temporary workaround you can use the J-Link IF as a bootloader: If your brave enough to track the issue with the mbed IF Nordic, please raise an issue in their repository:

posted by Vincent (pan-) Coubard 09 Aug 2016


Thanks a lot! Indeed, I am using Windows 10 and your solution to use the J-Link IF worked nicely. I'll raise the issue with the mbed IF Nordic.

posted by Alef Sin 09 Aug 2016

Thank you, you dont know how much of time you just saved for me, I'm tired and broken right now!

posted by Tomislav B 02 Jun 2017

To post an answer, please log in.