The Freescale OpenSDA Trap: “No Device Available”, or something like that….

Self-Motivation: I write this post in the hope to cut the number of ‘please help me’ emails in my inbox ;-):

If you want to debug one of the Freescale boards with OpenSDA (FRDM-KL25Z, FRDM-K20, FRDM-KL05Z, FRDM-KL46Z48M, FRDM-KL02Z, TWR-KL47Z48M, …), and if you get this dialog …

No Device Available

No Device Available

… then read on.

The error in CodeWarrior says

“An error occurred while connecting to the interface hardware or target specified in the Launch Configuration Dialog. For this launch, you may retry/re-specify the connection with the following parameters: OpenSDA – USB Port, (No Device Available).”

A different but similar dialog is shown by IAR debugger:

Undetected OpenSDA by IAR Debugger

Undetected OpenSDA by IAR Debugger

The problem is: the debugger cannot find the board. You get that error as well if the board is not connected. Assuming that the board is ok, connected and powered, then the problem is a not obvious one (at least not to new users of the Freedom boards or OpenSDA):

❗ The Problem is that the board is in OpenSDA MSD Bootloader mode ❗

What is that? You might have read my OpenSDA article, and then you probably know by know. The board is shipped by default with the ‘MSD (Mass Storage Device’ Bootloader) on it. That MSD Bootloader allows to program an application (S19 file) to the board without debugger. You can see this with the board showing up as a drive with files on it:

FRDM-KL25Z as MSD Bootloader Device

FRDM-KL25Z as MSD Bootloader Device

Why is that the default? I don’t know! I really don’t know, as I would expect debugging is the first thing I would do with a board? In order to debug the board, it needs to be loaded with the P&E Debug-APP_Pemicro*.SDA application.

💡 The P&E Debug-APP is not the only possible debug application (firmware). Other alternatives are for example Segger OpenSDA, USBDM, or CMSIS-DAP OpenSDA.

Changing the Board for Debugging (P&E OpenSDA)

To debug the board, the OpenSDA Debug Application needs to be programmed first:

  1. Make sure the board is not powered
  2. While pressing the reset button, power the board with the OpenSDA USB port
  3. The board enumerates as BOOTLOADER drive on the host, and the green LED is flashing.
  4. Download the FRDM-KL25Z quickstart package from http://www.freescale.com/freedom web page (for your board). That package has an older P&E OpenSDA debug firmware (the most recent is on P&E OpenSDA site, I have DEBUG-APP_Pemicro_v106.SDA).
  5. Copy DEBUG-APP_Pemicro_vxxx.SDA file from the pack to the BOOTLOADER drive. You need to unpack the file to your hard disk first. You can copy the file with the windows explorer, but on some systems this fails. Use the DOS shell copy command instead in this case.
  6. Unplug the cable and repower the board with the OpenSDA debug port (without pressing the reset button!)

Then finally you can debug the board. In the debugger, you might need to press the Refresh button:

Refresh to find OpenSDA

Refresh to find OpenSDA

Changing the Board back to MSD Bootloader (P&E OpenSDA)

To revert the board back to the MSD Bootloader mode (as originally shipped):

  1. Make sure the board is not powered
  2. While pressing the reset button, power the board with the OpenSDA USB port
  3. The green LED is flashing and the board enumerates as ‘BOOTLOADER’ drive
  4. Download the FRDM-KL25Z quickstart package from http://www.freescale.com/freedom web page (for your board).
  5. Copy MSD-FRDM-KL25Z_Pemicro_vxxx.SDA (e.g. MSD-FRDM-KL25Z_Pemicro_v105.SDA) MSD file from the pack to the BOOTLOADER drive. You need to unpack the file to your hard disk first. You can copy the file with the windows explorer, but on some systems this fails. Use the DOS shell copy command instead in this case. There are *different* files for each board, so be careful you select the right file for your board.
  6. Unplug the cable and repower the board with the OpenSDA debug port
  7. The board shall now enumerate as ‘FRDM-KL25Z’ drive

Now the board is in MSD mode, and you can copy S19 files to it.

❗ In case there are problems to copy files to the board (e.g. green LED is flashing with an error code: make sure you do not use an Explorer extension like File Manager or similar. The bootloader expects the file blocks in a given order, and virus scanner or file manager might interfere with this. In that case, use the DOS cmd shell copy command. The ‘copy’ command always worked for me.

Summary

With this post, I hope I can cut my inbox by several incoming emails a week of desperate OpenSDA users who are not able to debug their board. That would be a very good thing. And I wish boards would be shipped for debugging out of the box. I mean that MSD bootloader is a nice thing, but is not debugging the first thing I want to do with a board?

❗ UPDATE: There is a new firmware available (v114 or later) which solves the problem described here: that new firmware has a combined MSD bootloader and debug interface :-).

Happy Debugging (finally) 🙂

56 thoughts on “The Freescale OpenSDA Trap: “No Device Available”, or something like that….

  1. Good post Erich. Ran into that back in January and opened a ticket on it. All the student boards but 3 came back with no issue. We sent one back for factory test because it locked up completely.

    Like

  2. what a waste of time I spent, and a zillion doc’s I read before I found this answer 😦
    I was about to give up and go to another brand after 30+ years…

    Surely a pdf with these details should ship with the board. And make it
    clear that OpenSDA has multiple modes. i.e. debug and MSD.

    Like

    • Hi djam,
      you are not the first one with this problem :-(. That’s why I wrote that article, and hoped that if someone googles for that error messsage, he might find the solution.

      Like

  3. Hi Erich,

    I’m experiencing this some error. I’m using Code Warrior 10.5 with a KL25Z. If confirmed that I have the PE Debug App loaded on the KL25Z, but I’m still unable to connect to the debugger to the board.

    Can you suggest anything else I should check?

    Like

    • OK, I figured this out. Once I loaded the Debug App, I had to reconnect the USB cable to the FRDM board WITHOUT pressing the reset button.

      Like

      • Hi John,
        ah, ok, problem solved :-). It was clear to me (but not to everyone) that the reset button has to be not pressed in the final step. I have added that to the instructions now, so thanks for this one!

        Like

  4. Hey Erich,

    I’ve followed your steps to set up the board for debugging but it’s not working. I’m copying the debug file to the bootloader directory, unplugging, plugging back in without pressing reset, but the bootloader directory just pops up again and I can’t debug in CodeWarrior. The green LED keeps blinking. I tried loading the MSD back as well and nothing happened there either. Any ideas?

    Like

  5. Hi
    I am also facing this kind of problem but my case is little bit different.
    I am working with FRDM-KE02 board and had update the SDA and it was working fine, but after some time it stopped working.
    Now, IAR is detecting the board but when I press connect it again asks to connect and so on.
    same as the last pic of you post.
    Pls let me know the solution…

    Like

  6. Hmm, does not work. Itried Explorer and I tried cmd using copy. The files disappear. Now I’m sure freescale is having a laugh on me. I’m done with this crap, KL05Z & KE02Z for free anyone ?

    Like

  7. Hi Erich

    I have a bit of a weird problem here, wonder if you have come across it before.

    I run OSX on the desktop, previously Linux. In the past, I have quite successfully run CodeWarrior on Windows XP virtual machines.

    Trying to do the same, so I can play with a FRDM-KL46Z. If I boot the board, holding the reset button, it appears as a mass-storage device, and I can see all the USB details in the Mac’s System Information report. Likewise, if I plug into the other USB socket, it flags as USB-UART. (I can also connect to the demo code that reads the touch sensor, using screen.)

    However, I have dropped DEBUG-APP_Pemicro_v108.SDA into the BOOTLOADER device, ejected it, reconnected the board – and it simply doesn’t enumerate. Nothing at all shows of it in the USB part of System Report – not even “unknown device.”

    If I plug the board into a Linux server, nothing shows up in dmesg, or lsusb – exactly the same as it is for the Mac System Information.

    I saw your article on issues with Windows 8.1, wondered if there’s something weird about the firmware the boards ship with. I therefore connected to a Windows XP virtual machine (still on the Mac) with the board in MSD mode, to attempt to repeat the operation. The file still appears to copy, but is no longer there after reboot, and the board remains “invisible.” (I even tried ejecting the MSD in Windows before disconnecting – no different.)

    It’s like the firmware update simply isn’t happening. Restart, it’s gone.

    Ideas?

    M

    Like

    • I’ve answered my own question – it’s a known issue with Linux, OSX, Win8.1:

      From P&E FAQ:

      “Latest issue: Bootloader versions 1.10 and earlier are not allowing firmware update and MSD FLASH programming on my OpenSDA board, with the Linux, MacOS, or Windows 8/8.1 operating systems.”

      My board appears to be old stock – the bootloader that came on the board is 1.09.

      P&E again:

      “Solution: Support for Windows 8/8.1, MacOS and Linux operating systems was added to Bootloader version 1.11 and MSD firmware version 1.14. Please make sure that your board is programmed with Bootloader version 1.11 or higher prior to attempting to update your OpenSDA board with a new firmware application.

      Important: If you are currently running Bootloader version 1.10 or earlier, you will need to find a Windows XP or Windows 7 PC to perform this update.”

      And looks like a Windows XP Virtual Machine isn’t up to the job 😦

      M

      Like

      • This is going to be interesting. The one physical Windows machine in the house – an old XP laptop – doesn’t recognise the MSD, even after installing latest P&E drivers :-/

        Think I might have to post my boards off to a friend who has Windows machines and get him to change the bootloaders for me.

        Once again, P&E breaks a good Freescale product 😦

        Like

        • I disagree that this is the fault of P&E. We need to be fair here: It is is the fault of Windows/operating system in my view. Microsoft changed things. At the time when that bootloader had been developed, there was no Windows 8.x. Microsoft decided to write hidden folders to any MSD device to ‘accelerate’ the access. This confuses many MSD bootloaders, not only th P&E one. E.g. mbed has tons of problems with that issue too. Similar to MAC machines where the host tries to write files to the device. Conceptually this is a problem of MSD bootloaders. And as an implementer of such a bootloader you cannot know what Microsoft or Apple or whoever might change in the future. And it is in my view more of a Freescale fault that they still ship boards with old firmware on it (other vendors have that probelm too, btw) :-(.

          Like

      • I copied my Windows 7 VM (Virtualbox) over to my laptop, just to see if that would allow me to update the bootloader, and can confirm it does NOT.

        So this is not possible with Windows XP or Windows 7 VMs, running on VirtualBox, on an OSX (Yosemite) host.

        I think I may just return these boards to the vendor (Element14) and request replacement with parts with current firmware.

        Like

      • My point was that, testing with the tools I have available, it appears that you have to have a PHYSICAL Windows 7 (XP/Vista) box to do this (which I don’t have.) Unlike a lot of other things that work under a virtual machine, like the P&E Multilink with older versions of CodeWarrior which works just fine, this doesn’t work at all. But I thought I should test it, just in case there was a way for those without direct access to a Windows system.

        Like

    • Hi Erich

      FIXED! I have found out why this wasn’t working on OSX; what you said about the 1Hz blink made me suspicious, because that kept stopping. Also, I never saw the “copying” notification on the Windows VM.

      The problem lies in OSX auto-mounting anything that looks like an MSD. Even ejecting, whilst the file system is visible in Windows, copying to it fails silently. The fix is to prevent the auto-mount the auto-mount from happening, allowing the Windows (I tried with 7) VM to get first and only access to the device. Bootloader update was then EXACTLY as described in your step-by-step post.

      To prevent auto-mounting, you need a line like this in /etc/fstab:

      UUID=443E64D9-F332-3461-9FEB-CA3A40D1DC65 none msdos rw,noauto 0 0

      …although I’m not sure if the UUID is the same for every board, may need to check and change, if required.

      But I now have a 1.11 bootloader 🙂

      Thanks all your exhaustive documentation, which helped me find the solution – hopefully someone else will find this useful.

      Cheers

      M

      Like

  8. Hello,
    I have followed steps as per directed, but still I am getting “No Device Available”.
    My device detected as OpenSDA-CDC Serial Port.
    I am using code warrior and 32bit WIN7 OS.

    Please suggest.

    Like

  9. My KL25Z board is not detected by the operative system (neither Windows or Linux). When I plug the USB, board blinks 8 times, 2-seconds pause, another 8 blinks and continues. I can’t upgrade/rewrite SDA because I don’t get a new windows device.

    What can I do?

    Thanks.

    Like

  10. Hi,

    I cant get my FRDM_KL02Z board to connect. THE P&E connection assistant can see the Open SDA on USB1 but when I press Retry it just keeps coming back with the same screen

    Like

    • What host operating system are you using? It seems that the driver is properly loaded, but the debugger cannot connect to the device.
      Is the option ‘Use SWD protocol’ enabled in your debugger settings panel of the debug configuration?

      Like

      • Hi,

        Im running windows 7 and CW 10.6 by “Use SWD Protocol” do you mean “Use SWD reduced pin protocol for comminications”, if so then I have tried it checked and not checked and still get the same issue.

        When I get P&E connection assistant popping up the device name-DBFC7E11, does this look right?

        Like

        • You only can use SWD with openSDA (JTAG is not supported). So yes, that option is the same. I mentioned the text inside my Kinetis Design Studio, so yes, that text is different in CodeWarrior.

          Like

        • In the connection assistant you should see as port something like “USB1: OpenSDA (DBF94E01)” where that number at the end is the USB ID. Make sure you have “OpenSDA Embedded Debug – USB Port” selected as interface.

          Like

        • I have updated to the latest windows drivers and SDA drivers. I dont have anoy other hardware to test it on. How can I prove that there is a hardware issue?

          Like

        • You would need a second hardware/board 😦
          Or at least a Segger or J-Link probe to directly talk to the microcontroller.
          Or do you have a second host machine (Windows 7) you could try?

          Like

      • I have also enabled logging and get the following lines on the console output……

        INF: OpenSDA detected – Flash Version 1.08
        ERR: Can not enter background mode.

        Like

        • “Can not enter background mode” indicates that it cannot communicate/talk/reset the device. Have you secured your device? Maybe you have a hardware problem? Are you able to debug other boards with OpenSDA without problems (to be sure it is not a Windows driver problem)?

          Like

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.