I love the Freescale Freedom boards because they are low-cost, and I do not need a special debug device, as they have the on-board OpenSDA. It is using a small Kinetis-K20 which acts as
JTAG SWD debugging probe. Why not using the Freedom board to program another board?
OpenSDA features a MSD (Mass Storage Device) Bootloader application. With this I can copy a S19 file to the ‘programmer’ and program another board. The Freedom boards come with an unpopluated
JTAG SWD header which can be used to debug the processor with a Multilink or J-Link debug probe. The idea is to disconnect the processor on the board from OpenSDA, and connect it instead with a JTAG SWD cable to a microcontroller on another board.
For this I need:
- The OpenSDA Firmware with Bootloader.
- A 10pin ARM Cortex
JTAGSWD debug header to populate the one on the Freedom board.
- To cut J11 trace on the Freedom board to isolate the microcontroller from OpenSDA.
- A 10pin ARM Cortex
JTAGSWD debug cable to connect the two boards.
P&E has recently (17th April 2013) updated the firmware. That package has the latest firmware files and supports the new FRDM-K20D50M which I’m using here. The firmware is available from http://www.pemicro.com/opensda.
Required Hardware Changes
The Freedom board needs a 10pin
JTAG SWD debug header, and both boards needs to be connected by a 10pin ARM Cortex Debug cable.
:idea: See Completing the FRDM-KL25Z Board for part numbers for the header and mating cables.
By default, the Freedom boards come without the 10pin ARM Cortex debug header populated. So I need to add and solder such a header on J6:
:!: Use a good and fine soldering tip. The pads are very close to each other, so if using too much solder or not carefully solder the connector, there can be shortcuts between the pins. I recommend to carefully inspect the soldered pins.
Next step is to cut the J11 trace on the board. J11 needs to be used to remove the SWD clock to the target microcontroller on ‘programmer’ Freedom board. With this I cut off the resident microcontroller from OpenSDA on the same board:
So I need to cut the connection between J11 on the backside of the board:
I recommend to cut the trace and install a dual-pin header/jumper:
:idea: Cutting the J11 trace is only needed for the Freedom ‘programmer’ board. If I want to program another Freedom board with the programmer, the ‘target’ board only needs the 10pin ARM Cortex Header populated. I have not modified the target board otherwise. If using a custom target board, then all what it needs is that ARM Cortex header for the connection.
Connecting the Boards
I connect the two boards with the 10pin flat cable, making sure pin 1 connects to pin 1:
:idea: The debug cable provides 3.3V for the target board. In the case of the Freedom board, that’s sufficient to power the target board. Otherwise make sure you power properly the target board.
Programming with MSD
The ‘programmer’ boards needs to have the MSD (Mass Storage Device) Bootloader loaded:
- Power the board with reset button pressed
- Wait until it enumerates as ‘Bootloader’ device
- Copy the MSD-FRDM-KL25Z_Pemicro_v109.SDA to it
- Re-power the board (without reset button pressed)
The MSD Bootloader accepts S19 files (see S-Record Generation with gcc for ARM/Kinetis how to create S19 files with ARM GNU gcc).
Now I can drag&drop or copy files to the bootloader device, and it will program the target board microcontroller (instead the resident microprocessor):
Programming a different Freedom Board
So far I have programmed with a KL25Z board another KL25Z Freedom board. But what about a programming a different ARM microcontroller, e.g. the K20 on the FRDM-K20D50M? This board has an SWD connector too:
JTAG SWD header:
And then I hooked up the two boards:
Unfortunately, that did not work :-(. The OpenSDA green LED was flashing an error code, and failed to program the K20 on the other board.
I tried the same thing, this time with my FRDM-KL05Z:
Result is the same: this combination does not work.
:idea: It seems that OpenSDA is checking the target processor, and only allows to program the same processor as on the Freedom board. I only have one FRDM-K20D50M and one FRDM-KL05Z, so I cannot check if it is possible to program the same device. Given what works with the FRDM-KL25Z, I would think that it is possible to program the same microcontroller from the FRDM-K20D50M, and same for the FRDM-KL05Z.
So far I have used the MSD Bootloader to program the other board. What about using the debugger? The result is the “Error 17926″ which tells that I only can debug the processor on the board:
To bad :-(
With the Freedom board and OpenSDA, I have an inexpensive programmer for my boards. Programmer in the sense of programming a device, but not debugging it. It does not replace a P&E Multilink and it is not as fast as a Multilink, but for hobby projects it is a viable alternative or add-on value of the Freedom Board. Using the Freedom board as programmer seems only to allow to program the same microcontroller. To me, this limitation is in place not to cannibalize programming probe vendors like P&E Multilink or Segger J-Link. On the other end: as it is now, the Freedom board enables me to evaluate the microcontroller, and if I’m going to create my board with that microcontroller, I can program it with the Freedom board too. Debugging and developing things on the Freedom board, and then program a mini-batch of boards with it too. But I better have a Multilink or J-Link at hand when there is a problem I have to debug on that other board. Having the ability to use the Freedom board as a mini-series programmer is a plus in any case.
Happy Programming :-)