9 years, 3 months ago.

Using SWD on Own PCB?

I am now starting to explore on how to take my design and get it ready for (very small-scale, in-house) production onto my own PCB. I have used the FRDM-K22F board.

I have done some preliminary research and it seems SWD is a very good option. I would need to program a couple tenths of boards. What are some guidelines and/or instructions for using SWD on your own PCB? What are some hardware requirements and how can I debug my board? Can I still connect to serial like I did with mbed using a J-LINK JTAG adapter or similar?

1 Answer

9 years, 3 months ago.

This is for the KL25Z, but the K22F is the same (I do use this method on my K22F).

http://developer.mbed.org/cookbook/Prototype-To-Hardware-KL25Z

Haven't tried debug, however as the MCU is connected in the same manor, I can't see a problem.

Thank you, that is very useful! How can I find out what hardware my K22F processor will need in order to be able to run on its own? Do I need clocks, capacitors, resistors, etc?

And if I understood correctly when he says "compile and save directly," it means I drag and drop like I normally do once I connect the processor to my SWD programmer?

posted by eum c 31 Jan 2015

If you follow that method it will be exactly as if you had a normal mbed board, so yeah drag and drop should work properly.

The data sheet/reference manual should list the basic requirements. Generally you need decoupling capacitors on the power pins and often a pull up resistor on the reset pin. Clock wise the mbed library expects a crystal (check the K22F board (schematics) to see which one it uses), but if you want you can import mbed-src and delete the normal mbed lib. Then in targets/cmsis/target_freescale/k22f/system_k22f.c/h (names almost correct) you can use one of the different presets, or make your own setup for clock. This way it is possible to not have an external crystal. But generally a crystal + its caps is probably easier.

posted by Erik - 31 Jan 2015