

Peter Lawrence has been working on using a PIC as a CMSIS-DAP ARM debugger.

I wanted to see what was feasible in the way of a very-low-cost ARM board. OK, that doesn’t sound original, but stick with me.

The solutions that I’ve seen (Tweeny, McHck, mbed, etc.) are limited to wholesale firmware updates. Press a button, download a new image, and see if it works.

I wanted to implement an integrated CMSIS-DAP debugger (ARM standard that is compatible with multiple OSes). That way, one can do everything from flash updates to single-step debugging.

The brute-force solution would be to plop two ARMs on a board, where one has USB capability and acts as the debugger.

However, that gets pricey. Atmel, for example, is using an AVR32 on their Xplained boards in a debugger role to shave costs, but the AVR32 isn’t exactly a dirt cheap chip either.

Instead, what I did was use a PIC… a PIC16F1454 to be precise. It costs $1.25US in single quantity and goes below a US dollar in 1k+ quantity. Plus, it doesn’t need an oscillator (further lowering total BOM costs).



The firmware solution consists of two halves.

The first is a USB bootloader that also doubles as a USB-to-UART bridge (thereby also saving the cost of a FTDI chip or equivalent).

I’ve published the code (including patches to the Microchip USB Framework) here.

The bootloader lets one download an application into the second half of the PIC’s flash.

For a sample app, I’ve managed to write a CMSIS-DAP implementation that fits entirely in 4kwords of the PIC16F1454’s memory.

One of the ARM targets that I’ve tested it with is a NXP LPC812 (Cortex-M0+), which is a another