USBDM: a nice solution to flash MCU via SWD using the FRDM-KL25Z

Turn the freedom board KL25Z in a USBDM Debugger interface allows to program various Freescale MCU and other compatible ones (look here):

  • RS08
  • HCS08,
  • HC12,
  • Coldfire V1-4 microcontrollers
  • MC56F800xx Digital Signal Controllers (very limited range of devices).
  • Kinetis ARM-cortex

First of all it is necessary to prepare the hardware as shown in the previous article regarding the KL25Z as an OpenSDA programmer using the P&E Micro firmware (vedi qui). Prepare the board with the necessary hardware changes, but do not load the OpenSDA firmware, follow instead these steps:

Download the USBDM driver at this link:

opensda

Then, when the driver is installed, open this link (check for the last version) for the USBDM software:

download programs
Start the setup and during the procedure be sure to enable the installation of the components related to your development environment (in my case Codewarrior 10.6.4), and also the programmer Stand-alone, as I prefer simplicity, or as a plan B in case the development environment is not able to integrate the required plug-ins:

setup

When the setup is completed you just have to prepare your FRDM-KL25Z to proceed with the USBDM firmware update. Browse the default folder for installed software on your PC, you will findPGOand inside this folder the USBDM application one: inside this folder i will find “FlashImages” folder and then MKxx” referring to the micro board in the family. On my computer the full path is “C: \ Program Files (x86)\ pgo\USBDM 4.12.1.70\FlashImages\MKxx”.

Within this folder, we find the “OpenSDAvX.X.bin” file where X stands for the version available at the time. Keep this file handy!

usbdm flash application

It’s now time to connect the board to the computer with a USB cable, hold down the reset button a second or two, this will boot into bootloader mode and will appear as a USB mass storage device (Bootloader). If you have activated the internet, opening “sda_info.htm” file you can check the bootloader versions currently loaded in the flash app. However, we’re going to upgrade everything, to transform the board into a programmer “semi-universal” via SWD.

20160426_152446

So you just need to upload the file “OpenSDAvX.X.bin” in the mass storage device, wait a few seconds, then power cycle the device. At this point, as a confirmation of the successful firmware update, Windows will warn you that “new hardware is found and USBDM drivers will be automatically (probably) loaded, and the device will be recognized as a programmer from CodeWarrior and the stand-alone flash programmer.

Be careful: with Windows 7 and Windows 10 for still unknown reasons this process failed to update the firmware of the board as last step, however, I had here a computer with Windows XP and in that case it worked immediately. This step must be done only once, so I did not study in deep this strange problem.

To check if everything is working fine, you can connect the SWD connector to the target device, plug the board to the usb port and start the stand-alone flash programmer (with my setup in “C:\Program Files (x86)\pgo\USBDM 4.12.1.70\UsbdmFlashProgrammer.exe”):

stand alone usbdm flash programmer test

First of all, in the “Interface” tab via the “Detect” button I checked for a proper recognition of the KL25Z board detected as a SWD programmer. Next step, in the “Target” tab (rightmost image) using the “Detect Chip” function I do a quick check of the device that I have connected via SWD, in this example it is properly recognized as ID and correctly selected from the devices list.

However, initially it was not so simple, because the micro “MKV10” was not recognized, being present in the list but not fully configured. I tried to configure it manually by entering all parameters as per datasheet, but without success. I decided to contact the developer of USBDM, Peter O’Donoghue, who was by chance facing the same problem: so in less than 24 hours we have solved and now it works perfectly! Surely, with older micro or simply with more luck you will not have my same problem.

Stay tuned!

You can find more info at this link:
https://mcuoneclipse.com/2013/04/27/debug-external-processors-with-usbdm-and-freedom-board/

Leave a Reply

Your email address will not be published. Required fields are marked *