Debugging FRDM-KL05Z with USBDM

I mentioned in “Debug External Processors with USBDM and Freedom Board” post that I had a problem to debug the FRDM-KL05Z with USBDM. Well, after a long night with some sleep, with more thinking and searching, finally I have it resolved: I can debug my FRDM-KL05Z with USBDM 🙂

FRDM-KL05Z Debugging with USBDM

FRDM-KL05Z Debugging with USBDM

The problem was that I received a “Failed to resume target process., Downloading binary to target…’ error message:

Failed to resume target process

Failed to resume target process

This Freescale forum thread has finally lead me to the solution: a wrong USBDM device ID for KL05Z present on the FRDM board :-(.

USBDM Flash Programmer

USBDM comes with standalone flash programmers, and one of it is for ARM based devices:

USBDM 4.10.4 Installed Program Shortcuts

USBDM 4.10.4 Installed Program Shortcuts

The Flash Programmer has a ‘Detect’ functionality, it was not able to detect the KL05Z32 on the FRDM-KL05Z board:

Flash Programmer for ARM

Flash Programmer for ARM

Chip ID

The good thing is that it reports the chip ID. After searching around, I realized that the ID mapping is described in the arm_devices.xml file inside the USBDM installation folder:

arm_devices.xml configuration

arm_devices.xml configuration

That file has the KL05Z32 listed as

      MKL05Z32M4" family="ARM" subfamily="KL05">
         <memoryRef ref="kinetisL4K_Ram" />
         <memoryRef ref="kinetis32K_Flash_B0" />
         <memoryRef ref="kinetisIO_KL" />
         <sdid value="0x05130480" />
         <tclScriptRef ref="Kinetis-KLxx-Scripts" />
         <flashProgramRef ref="Kinetis-KLxx-FlashProgram" />
      </device>

That device ID (0x05130480) does not match what the programmer reported (0x5130402). Testing the ID with the working FRDM-KL25Z, it seems to me that the last nibble is zero, so I changed the above entry to:

      MKL05Z32M4" family="ARM" subfamily="KL05">
         <memoryRef ref="kinetisL4K_Ram" />
         <memoryRef ref="kinetis32K_Flash_B0" />
         <memoryRef ref="kinetisIO_KL" />
         <sdid value="0x05130420" />
         <tclScriptRef ref="Kinetis-KLxx-Scripts" />
         <flashProgramRef ref="Kinetis-KLxx-FlashProgram" />
      </device>

With this, the device is properly detected:

MKL05Z32M4 Detected

MKL05Z32M4 Detected

And with this change, CodeWarrior for MCU10.3 is successfully debugging the FRDM-KL05Z with USBDM:

CodeWarrior MCU10.3 debugging the FRDM-KL05Z with USBDM

CodeWarrior MCU10.3 debugging the FRDM-KL05Z with USBDM

:mrgreen:

Happy OSBDMing 🙂

Advertisements

11 thoughts on “Debugging FRDM-KL05Z with USBDM

  1. Pingback: Debug External Processors with USBDM and Freedom Board | MCU on Eclipse

  2. Pingback: Adding USBDM to CodeWarrior for MCU10.4 | MCU on Eclipse

  3. Hello from Mexico! Yes, I had the same problem. This was solved with CW10.4 . I hope i had seen this post before. But is very interesting the way you solved the problem, thanks for sharing!

    Like

  4. I didn’t understand if you are using the USBDM in a FRDM-KL25 board and then connected it to the FRDM-KL05Z, or if you had programmed the FRDM-KL05Z with USBDM itself ?
    I only have a FRDM-KL05Z and I want to use it to debug my particular board.

    Best Regards,
    Christian

    Like

      • Thanks Erich.
        I read all that post and this post, then I tried to do all the stuff, but because the actual version of USBDM is 4.10.6, I download that, and there is no USBDM_OpenSDA.zip in this new version.
        I think that this new version will do it automatically, but nothing is working.
        So, do you think that it will be ok to use the USBDM_OpenSDA.zip in the version 4.10.4 and updated this firmware on the Freedom board ? Or do you know another solution ?

        Best Regards,
        Christian

        Like

      • Thanks again, now it is working perfectly.
        Another question: In the FRDM-KL05Z there is another connector, J3 SDA JTAG. What for is this connector ?

        Best Regards,
        Christian

        Like

      • Hi Christian,
        J3 is the SDA JTAG debug header (well, the labeling is somewhat wrong: it is SWD, not full JTAG). With this header, it would be possible to program the K20 OpenSDA device on the board. But this K20 is secured/locked, so you cannot re-program it. So this header would only be usefule if you decide to unsolder the K20 and put a new one on the board.

        Like

  5. Waaaaooooo, I just found this at 3:13 a.m, been struggling with USBDM as last option after openOCD script failed, this makes USBDM work perfectly in Linux. Funny, without this fix, it still works but its a hit and miss, sometimes it works, sometimes it doesnt. Thank you!!!! Makes me feel like I should read all the posts on your blog, hehe 🙂

    Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s