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

How to program an nRF51822 using SWDIO/CLK?

Hej,

that might sound like a dumb question, but what is the minimal setup to program an nRF51822 SoC using the SWDIO/CLK ports?

  1. What external hardware is required?
  2. What software is required to built and flash a new firmware?
    • What about the mbed SDK? Can I use it with a minimal setup?

I'm essentially looking for a minimal setup, which allows me to power and flash an nRF51822 based installation.

Sincerely, Oliver

  • Q1: You need a programmer. We use J-link from Segger, but in theory you could use any Cortex M0 programmer that supports the SWD interface. You need four pins, VDD, GND, SWDIO and SWDCLK to program it.

    Q2: Both the nRF51x22-EK and the nRF51822-mBED kit comes with an onboard programmer so you can get one of those an you'll be ready to test, evaluate and develop code. We have most code examples built for Keil uVision, but there's also some code examples available on mBED and for GCC based platforms. Keil supports compiling application code for up to 32 k for free, so if your application is small, that would be a good place to start.

  • Also as a small note the newer version of the nRF51822 does not require a pull down on the SWD clock line but you may find out some modules out there that use older nRF51882 that requires a 12K ohm pull down resistor on the clock line. just be aware of it. I know Raytac modules do. Cheers.

  • Thanks for the heads up. One more question, comes the nRF51 Dongle also with an onboard programmer or do I have to get an external one? What external programmer would you recommend that is not to expensive (hobbyist)? I do have a breakout-board containing a nRF51822 which I want to flash. Else I would love to buy something similar, a minimal break-out board featuring a nRF51822.

  • Well it all comes down to what you mean by minimal: minimal effort or minimal cost/hardware.

    I'm using an NRF51822 as a supervisory micro + BTLE link for a system with the main application processor running Linux.

    I use two GPIO lines to hook up to the NRF51822 SWD lines which is how the NRF firmware is loaded/updated.

    This link implements the ARM SWD interface, which is a bit cryptic. This allows me to access all the address space of the NRF including being able to read/write GPIOs/ADCs etc and, of course, write the flash.

    If you just want to get a low cost debugger going, then there are many examples on the web that use FTDI chips, eval boards or low-cost SWDs. eg. www.gniibe.org/.../diy-swd-debugger-ftdi2232.html

  • I mean minimal in terms of hardware. Something like a "Hello World" for the nRF51822. A starting point I can use to do stuff, but not such a bloated DevKit. And for the programmer I just search something to buy (shouldn't be that expansive) which I can use in a plug'n'play fashion to flash my device. Something like the CC-Debugger for the nRF. I already have a minimal nRF device which I want to flash, but I'm also very interested in alternative devices.

Related