Using the Freedom Board as JTAG Programmer
Join the DZone community and get the full member experience.Join For Free
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 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 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 cable to a microcontroller on another board.
for this i need:
- the opensda firmware with bootloader.
- a 10pin arm cortex jtag 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 jtag 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 debug header, and both boards needs to be connected by a 10pin arm cortex debug cable.
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:
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:
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:
added the jtag 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.
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:
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.
Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Send Email Using Spring Boot (SMTP Integration)
Application Architecture Design Principles
How Web3 Is Driving Social and Financial Empowerment
Top Six React Development Tools