I need to be able to upgrade the firmware in a Kinetis KL25 in the field from another microcontroller. Where can I find the SWD commands to unlock, write, and verify the Kinetis' onboard flash?
If you want to use another MCU to program KL25, I think you have to use GPIO to simulate SWD protocol. For protocol, you can find from ARM site. Resourcing is opened.
Hope my reply can help you.
I was planning to use GPIO as you suggested and have downloaded the ARM Debug Interface specification. Is all of the information needed to write the Kinetis flash memory included in this document, or are there Kenetis specific commands or debug memory interfaces that I need to know about?
The SWD protocol is more easily simulated with the SPI interface on the Kinetis devices, in particular the K20 devices are convenient because they allow variable-length transactions. You can refer to the source for USBDM firmware for example code.
The programming of the Flash is described in the Device Manual and has nothing to do with the SWD protocol. You should also consider using the EZPORT protocol which does not require target code execution. This is also described in the Device manual.
Message was edited by: Peter O Donoghue
As has been pointed out by Paul - The KL series devices don't have EZPORT.
KL25 has not EZPORT in it. So we cannot use such SPI way.
Kinetis SWD has no special requirement. You can use ARM opening protocol and GPIO to simulate.
Missed that - I'm used to the other Kinetis devices.
Pgo and Paul,
So, it sounds like I can access the Kinetis flash memory module using SWD to reprogram the flash. Thanks for your answers!
Hi Milo Street
You've been able to emulate SWD commands?
Did you use libSWD?
While looking for how to do this, I found libSWD, which appears to support such bit-banging:
LibSWD - Serial Wire Debug Open Library
i also have similar requirement to program the flash memory through SWD. I found a document from Freescale AN4835 which talking about how to connect to the SWD. But after I connect, how to do the erase, program section, read operations? How to send all those flash commands through SWD?
Thank you in advance.
Another solution for that field upgrade would be to use a FRDM board with the MSD bootloader. This works out of the box, see Using the Freedom Board as SWD Programmer | MCU on Eclipse
Retrieving data ...