9 years, 4 months ago.

Turning an mBed device into a CMSIS-DAP SWD programmer

I'd like to program some bare nRF51822 chips, and currently I'm using a Segger Lite SWD programmer. But they're proprietary and no longer available, so I'm looking into using CMSIS-DAP instead, which is supported by OpenOCD.

As far as I can work out, the "main" chips in mBed PCBs are programmed via an "interface" chip which is loaded with firmware that supports CMSIS-DAP, and uses SWD to program the main chip via bit-banging. The source code is here:

https://github.com/mbedmicro/CMSIS-DAP/tree/master/interface/Common/src

My question is, has anybody been able to take that code, and compile it for the main chip, so that it supports CMSIS-DAP too, and bit-bangs SWD out of some of the accessible DIP pins, thus turning the whole thing into a cheap SWD programmer?

If not, how hard do you think it would be?

1 Answer

9 years, 4 months ago.

Hello,

yes it's possible, for freescale chips I ahve seen it around, like : http://keithhack.blogspot.ch/2013/10/cheap-arm-programmer.html or here on mbed, http://developer.mbed.org/users/va009039/notebook/frdm-kl25z-mbed-if/, using FRDM board to flash LPC for example.

There are couple of more I am sure.

I think the first link ("cheap arm programmer") is actually using the mBed interface chip to program the target chip. It requires cutting the connection between the interface chip and the main chip on the PCB and soldering things which is a bit of a pain. I'm trying to leave the mBed PCB intact and use the main chip as the programmer. Not sure about the second link (sorry; monoglot). Thanks anyway though!

posted by Tim H 19 Jan 2015

Yes, the first link is using interface chip, but the second one proves that target chip can be used as interface ;)

posted by Martin Kojtal 19 Jan 2015

Hmm I made an attempt at compiling the CMSIS-DAP code. Unfortunately it uses an internal (out of date?) version of the RTOS and USB stack, both of which include non-GCC assembly. The current mBed RTOS and USB stacks support GCC but the APIs have changed, so it will require some work to get CMSIS-DAP code that builds with GCC.

posted by Tim H 19 Jan 2015

Yes current implementaiton is using KEIL stacks which can be used only by ARMCC compiler.. There is usb and also rtos stack in mbed which are GCC and other tools friendly.

posted by Martin Kojtal 19 Jan 2015