Monday, October 21, 2013

Cheap Arm Programmer

So you have a custom ARM Cortex-m0 (or other) board you want to program. Perhaps, like me, it’s a custom board using Nordic Semiconductors nRF51422/822/922. You may have bought an Evaluation Kit with a built in J-Link debugger. However, once you move to a custom board you now face the problem of programming it.
I bought both the nRF51422-EK and nRF51422-DK. Each kit was $100 USD. The EK did what I wanted, the DK “requires” the nRFgo development kit which is $400 dollars. What you might not know is that this board provides only power and the nRF51422-DK comes with a Segger J-Link lite. The J-link Lite is what I’ve been using to program my custom boards. I think $100 dollars for a programmer is ridiculous. My AVR was $50 dollars and that allows me to do everything.
Enter CMSIS-DAP. It seems this is intended to add debug functionality and firmware updating to embedded applications but looks like you can use it as a standalone programmer without any restrictions (like with the J-Link EDU; Cost effective but limited to Educational).
So pick yourself up a $14 Freescale Freedom FRDM-KL25Z. Cheaper than an Arduino and way more powerful with a 3 axis accelerometer, a tri colour LED and a capacitive sensor. It has two microcontrollers – the main one and a little one running OpenSDA. With OpenSDA you can load up a CMSIS-DAP firmware from Freescale and program other boards. Credit to for the idea

Here is how:
  1. Cut J11 Trace. This disables programming the main KL25Z microcontroller.DSC_9767
  2. Install a 1mm pitch, 10 Pin header at J6. Little bit difficult to solder due to the fine pitch.DSC_9766
  3. Break Pin 7 off – This is the Key pin. This isn’t needed if you don’t have a blocked pin on your ribbon cable. DSC_9770
  4. Hold RST while plugging it in. This loads it into OpenSDA firmware upload mode.DSC_9768
  5. See a new drive image
  6. Download Freescale Quickstart here and copy CMSIS-DAP_OpenSDA.S19 to the Bootloaderimage
  7. Unplug and plug back in. Now Freescale is in CMSIS-DAP mode.
  8. Connect your custom board DSC_9763
  9. Set to CMSIS-DAP (I’m using Keil) image
  10. Switch to SW programming and not JTAG image
And now you can program. The one caveat is that it won’t autoreset my board. I have to disconnect.
There are other firmwares for programming but they are locked to Freescale Devices. The CMSIS-DAP isn’t. The trade off is that you lose the Serial to USB lines on the OpenSDA programmer. Oh well.


  1. Hi Keith,
    thanks for sharing! The Serial-to-USB lines are anyway connected to the KL25Z on the FRDM board, and as you disconnected the KL25Z, they are not usable. Well, you could connect the lines to the Rx/Tx of the target board, but that's probably not easy. The bigger problem is that OpenSDA CMSIS-DAP and as well Segger OpenSDA does not implement the USB-to-Serial in their firmware. And the Segger firmware is very restrictive too (see as it does not allow to debug other boards (per license agreement). It looks like CMSIS-DAP really is the only open solution. Or OpenOCD (I still have not found enough time to look into OpenOCD).

  2. i have a custom kl24z board, i cut the j11 trace and soldered the swd connection using wires. I tried with USBDM but i will try this, thanks

    1. USBDM (I think) and OpenSDA Segger J-link (tested) doesn't work with anything but Freescale microcontrollers. The CMSIS-DAP works with the Nordic I have so should work with others and the Nordic one is highly specialized.

    2. kl24z is a Freescale micro. I figured out i have problems with the crystal oscillator circuitry, once i solve that in the iterative design, i will test all three. seems like its best to stick with the CMSIS-DAP then.

    3. I solved the problems i had and been able to use both frdm-kl25z and frdm-kl05z to debug my new custom kl24z board using gnu-arm(arm-none-eabi-) tools, openocd, eclipse and processor expert plugin using CMSIS-DAP firmware. I now have a cheap debugger. There is one problem with plain eclipse CDT, you got only 2 hardware breakpoints

  3. Hello,

    thanks for sharing this!
    What if you give a chance to CMSIS-DAP interface which is available on mbed? There are implemented 3 endpoints, means you don't loose Serial-to-USB. I have been porting CMSIS-DAP to other freedom boards. So far KL46 is functional, other boards will come soon as well.


  4. I forgot to add a link where you can download the mbed interface for KL25Z:

    1. Thanks to everyone contributed! This is exactly what I`ve been looking for.
      The mbed FW now can communicate with a host PC through a "USB Virtual Serial Port".
      Do you know whether it`s possible to connect the serial lines to an external MCU aswell ?
      Are they avail on the 10-pin header ?
      Note: the compatible header I found is not with 1 but 1.27 mm pitch. I think a picture with the signals on the 10-pin connector would be of help also...

  5. Im looking to build a project with a kinetis M4 chip selected for my mcu. Im wondering if this will program any kinetis chip, because the mcuoneclipse site ran into issues with other boards not that $15 is the end of the world.