OpenSDA on the Freedom KL25Z Board

P&E has released information and firmware instructions for using the OpenSDA, see pemicro.com/opensda. Future has posted a very useful article about using OpenSDA here. So time to upgrade OpenSDA bootloader and firmware v10.1. My FRDM-KL25Z board is a pre-production board, and I assume the production boards expected next week will have the new firmware on it. But it is always useful to know how to change/upgrade the firmware, as I expect there will be new versions of it in the future.

❗ Update: P&E has released a new firmware v114 which combines USB CDC, MSD bootloader and debug application.

OpenSDA

In the Freedom board, there is a Kinetis K20 (K20DX) which runs OpenSDA:

Freedom Board

Freedom Board

The OpenSDA is a firmware running on the K20 which runs a bootloader:

OpenSDA Block Diagram

OpenSDA Block Diagram

The bootloader is pre-programmed on the board, and is entered if pressing the SW1/Reset button on the Freedom Board. The booloader enumerates as MSD (Mass Storage Device, like a USB Memory stick). Using that bootloader different applications are programmed on the board. These OpenSDA applications are files with *.SDA extension.

Note: I believe the only way to change the OpenSDA Bootloader itself is using the JTAG connector for the K20, although I have not seen the sources or project for it. According to the Freedom production board pictures on Element14, this JTAG header is *not* populated on the board. But adding that JTAG header should not be a big deal if needed.

:note: The K20 device on the board is preprogrammed with a bootloader from P&E, which is secured and has mass erase disabled. So you won’t be able to take over this chip and reprogram it. You only can update it with new OpenSDA applications using the bootloader on it.

The P&E firmware includes two different applications:

  • DEBUG_APP_*.SDA: this enables OpenSDA to act as a debugging interface (similar to what OSBDM does).
  • MSD-<board>*.SDA: Application which turns the board into an MSD (Mass Storage Device, like a USB memory stick). This MSD application can be used to program different application to the target chip, see here. With this bootloader loaded, it is possible to program S19 files to the target processor. Element14 has published a set of such files here.

Downloading the new firmware

Downloading the new OpenSDA firmware package from the P&E OpenSDA site gives me these files:

OpenSDA Firmware package

OpenSDA Firmware package

As explained above, there is one generic debug SDA application, plus three MSD applications which allow me to program the target processor with S19 applications. The MSD applications depend on the target processor to be programmed.

Programming OpenSDA firmware

To program an new OpenSDA *.SDA application is simple:

  1. press the reset/SW1 button on the Freedom board while powering the board (plugging in the K20 USB connector).
  2. The green LED near the K20 starts blinking
  3. The K20 enumerates as MSD device and is named ‘Bootloader’:

    Enumerated Bootloader

    Enumerated Bootloader

  4. Simply drag&drop or copy the *.SDA application file to the Bootloader device to program it to the board:

    drag and drop new SDA application file

    drag and drop new SDA application file

  5. Re-power the board, and now the new SDA application is running

OpenSDA Debug Application

In case of the DEBUG_APP_*.SDA, the OpenSDA acts as a debug interface for example supported in CodeWarrior for MCU10.3. The beta is expected to be out very soon.

This applications enumerates as debug interface and offers a USB CDC mode:

OpenSDA Debug Devices in Windows Device Manager

OpenSDA Debug Devices in Windows Device Manager

The OpenSDA Debug connection is offered as a choice in the CodeWarrior New Project wizard:

OpenSDA Debug Connection in CodeWarrior

OpenSDA Debug Connection in CodeWarrior

Using the OpenSDA connection in the debugger is very similar to any of the P&E run control devices:

OpenSDA in Eclipse Debug Launch Configuration

OpenSDA in Eclipse Debug Launch Configuration

OpenSDA Application Bootloader

If using the OpenSDA MSD (e.g. MSD-FRDM-KL25Z_v103_Pemicro.SDA for the Freedom Board), then I can simply program S19 files to the target board. Element14 already has such S19 files available here:

Element14 SREC files for OpenSDA

Element14 SREC files for OpenSDA

Like above: press SW1 while power-on, and then simply copy the SREC file to the bootloader and reset the board. Simple as that :-).

I expect that there will be a growing community providing such SREC files. For sure I will offer my applications that way as well :-).

Happy OpenSDAing 🙂

80 thoughts on “OpenSDA on the Freedom KL25Z Board

  1. Pingback: Tutorial: Accelerating the KL25Z Freedom Board | MCU on Eclipse

  2. Pingback: CodeWarrior for MCU10.3 beta is now available | MCU on Eclipse

  3. Pingback: A Seminar, and Freedom with it | MCU on Eclipse

  4. Pingback: Tutorial: USB CDC with the KL25Z Freedom Board | MCU on Eclipse

  5. Pingback: Fixing the USB Drivers | MCU on Eclipse

  6. Pingback: Completing the FRDM-KL25Z Board | MCU on Eclipse

  7. Pingback: Unsecuring the KL25Z Freedom Board | MCU on Eclipse

  8. Pingback: JTAG/SWD Debugging with the FRDM-KL25Z Board | MCU on Eclipse

  9. Pingback: USB CDC and SCI: Side-by-Side with the Freedom Board | MCU on Eclipse

  10. Hello.

    I am having trouble connecting to my board on Windows XP. I installed and updated the drivers as the quick start guide explains with no trouble, and I can connect to the board both as the flash progammer (showing the FRDM-KL25Z drive) and as the bootloader (showing the BOOTLOADER drive), but I can’t seem to load files in either of them. The explorer window shows the new *.srec or *.sda files on the drive, but nothing changes on the board.

    Have you heard of somehing similar happening to someone else?

    I previously the same board on my work computer running Windows 7 and everything worked fine. I’ll try this board on that computer but I’d really like to have this working on my personal computer.

    Thanks in advance.

    Like

    • I do not have any more an XP machine (that machine runs now Windows 8). But I know for a fact from my experience with USB MSD (Mass Storage Device) work, that the Windows OS indeed could have an impact. I have seen cases where a ‘file commander’ or shell extension or virus scanner has an impact how the file is written to the bootloader. I suggest that you try to write to the board using the command prompt/dos shell. Maybe this helps.

      Like

      • Hello Erich.

        Thanks for the tip. I’m at my work computer and I tried writing to the bootloader using the Windows 7 user interface and it worked, so it may be what you mentioned. I also tried using the command prompt and it also worked.

        Later when I get home I’ll try using the command prompt in my Windows XP machine to see if it works. I’ll let you know.

        Thanks again.

        Like

      • Hello Erich.

        Just to let you know that using the command prompt worked for my board in Windows XP. Don’t know what is the cause but I’m glad there is a work-around.

        Thanks for the help.

        Like

  11. Hello,

    I am having exactly the same problem, than luismgc, the thing is that using the same computer (Windows 7 64bits) everything worked fine at the beginning but then I just cannot download files using the MSD, and actually the Error LED status is set every time I try to program it. I have updated the firmware and nothing changes. What should it be done when the Error status appears? How is it to write to the board using the cmd prompt??

    Thanks a lot in advance.

    Like

    • Hello,
      to use the command prompt:
      – press +R (this opens the ‘Run’ dialog
      – use ‘cmd’ as command to open the DOS shell/command prompt
      – then use the copy command to copy your s19 file to the board, e.g. “copy myFile.SREC e:\” where E:\ is the bootloader driver

      Hope this helps,
      Erich

      Like

      • Hey Erich!

        I am really starting to get worried.. I tried using the cmd prompt. It didn’t work. Additionally, I tried updating the Debbug SDA application instead of the MSD and when debugging using Codewarrior 10.3 beta, a message like this comes to the display: “Device is secure. Mass erase is disabled. Try to unsecure anyways?”. Then there are the options for yes or no, I have actually tried both of them both after a couple of times pressing the button, then a new window with the following error shows up: Error launching PruebaPWM_FLASH_OpenSDA, ARM GDI Protocol Adapter : Can’t connect. The Debugger can not connect to the P&E device. Any ideas??

        Thanks a lot.

        Like

    • Hello Avril.

      I used the method described by Erich, using the copy command on the command prompt. I just used the whole path for the srec or sda file.

      I haven’t experienced the “secured device” issue yet, but I remember seeing several posts about it in this blog. Here are some of them:

      Device is secure?

      How (not) to Secure my Microcontroller

      Unsecuring the KL25Z Freedom Board

      I haven’t read them, so I don’t know if they’re specific to your problem, but I hope it helps.

      Like

      • Hey Luis,

        thanks a lot, sure any help is welcome at this point… =) I believe I can solve my problem after reading some of the posts… However I’m gonna sleep now and will try it tomorrow =D!!! Thanks!!

        Like

      • Sure.

        Let me know how it turns out and if you find out how that happened, just in case I ever run into a similar issue.

        Good luck.

        Luis.

        Like

  12. Pingback: A new Freedom Board: FRDM-KL05Z | MCU on Eclipse

  13. Pingback: The Freedom Robot | MCU on Eclipse

  14. Pingback: Debugging ARM Cortex-M0+ Hard Fault with MTB Trace | MCU on Eclipse

  15. Pingback: First Steps with Avnet’s Wi-Go Board | MCU on Eclipse

  16. Pingback: Back to Basic(s) with the Freedom Board | MCU on Eclipse

  17. Pingback: Live View for Variables and Memory | MCU on Eclipse

  18. Pingback: Tutorial: IAR + FreeRTOS + Freedom Board | MCU on Eclipse

  19. Pingback: Zumo Line Following with FRDM-KL25Z | MCU on Eclipse

  20. Pingback: Tutorial: ADC with the Freedom Board | MCU on Eclipse

  21. Pingback: Pololu Line Following Robot with Freedom Board | MCU on Eclipse

  22. Pingback: First Steps with the P&E Tracelink | MCU on Eclipse

  23. Pingback: A new Freedom Board: FRDM-K20D50M with ARM Cortex M4 | MCU on Eclipse

  24. Pingback: printf() with the FRDM-KL25Z Board and without Processor Expert | MCU on Eclipse

  25. Pingback: Red Suite 5: Eclipse Juno, Processor Expert and unlimited FRDM-KL25Z | MCU on Eclipse

  26. Pingback: Using the Freedom Board as JTAG Programmer | MCU on Eclipse

  27. Pingback: Serial Bootloader for the Freedom Board with Processor Expert | MCU on Eclipse

  28. Pingback: Can MCU10.4 recover a bricked OpenSDA Freedom Board? | MCU on Eclipse

  29. Pingback: Freedom Board with Segger OpenSDA Debug Firmware | MCU on Eclipse

  30. Pingback: CMSIS-DAP with IAR and the KL25Z Freedom Board | MCU on Eclipse

  31. Pingback: Bricking and Recovering FRDM-KL25Z Boards: Reset, SWD Clock and Low Power | MCU on Eclipse

  32. Pingback: DYI Free Toolchain for Kinetis: Part 1 – GNU ARM Build Tools | MCU on Eclipse

  33. Pingback: DIY Free Toolchain for Kinetis: Part 2 – Eclipse IDE | MCU on Eclipse

  34. Pingback: DIY Free Toolchain for Kinetis: Part 3 – Debugger (GDB Server with P&E and Segger) | MCU on Eclipse

  35. Pingback: A new Freedom Board: FRDM-KL46Z | MCU on Eclipse

  36. Pingback: Tutorial: FreeMASTER Visualization and Run-Time Debugging | MCU on Eclipse

  37. Pingback: The Freescale OpenSDA Trap: “No Device Available”, or something like that…. | MCU on Eclipse

  38. Pingback: FRDM boards not responding? Check your Virus Scanner! | MCU on Eclipse

  39. Pingback: FRDM Board Bootloader fails with Windows 8.1 Preview | MCU on Eclipse

  40. Pingback: New P&E OpenSDA Firmware v114 | MCU on Eclipse

  41. Pingback: Review: New FRDM-KL26Z Board | MCU on Eclipse

  42. Pingback: Freedom Board Resources | Smiffy's Place

  43. Pingback: Binary Files for the mbed Bootloader with Eclipse and GNU ARM Eclipse Plugins | MCU on Eclipse

  44. Pingback: Segger J-Link Firmware for OpenSDAv2 | MCU on Eclipse

  45. Pingback: Updated Freedom Board Logic Analyzer with DMA | MCU on Eclipse

  46. Pingback: Step-by-Step: Updating OSBDM/OSJTAG Debug Firmware | MCU on Eclipse

  47. Pingback: Illustrated Step-by-Step Instructions: Updating the Freescale Freedom Board Firmware | MCU on Eclipse

  48. Pingback: Tutorial: Playing MP3 Files with VS1053B and FRDM Board | MCU on Eclipse

  49. Pingback: Tutorial: Web Server with the ESP8266 WiFi Module | MCU on Eclipse

  50. Hi Erich,
    One of the most number of qeuries asked to me. How difficult it is to implement openSDA on a custom board? I guess PEmicro wouldnot be sharing the firmware on openSDA/OSBDM MCU. If binaries are available for the respective MCUs, is it possible to have such an option on custom board eliminating the need of a debugger/programmer?

    Thanks,
    Pramod

    Like

  51. Hi Eric,
    I recently went through many of the FRDM-KL25Z articles. I wish to use MKL25Z128VLK4 in a project. In fact I got one FRDM-KL25Z board. I want to stick to “mbed” library. Using mbed online compiler, I could generate .bin file which can be easily flashed into the FRDM board. But since the online compiler generated .bin file disables any security and forces to use unsecured. So I modified the the .bin file at security fields at 0x0000040C so as to get it flashed with security on. However the on board flasher “20140530_k20dx128_kl25z_if_opensda” installation doesn’t allow such files to get flashed and throws failure “RESERVED BITS”. My questions are as stated below:
    1. Is it technically correct to modify the .bin file to overcome problem with the on-board flashing firmware?
    2. Want to use mbed library with the on-board programmer (w/o buying a commercial programmer) along with option for CRP (Code Read Protection). Is it possible to use OpenSDA V1?
    3. If answer to #2 is “Not possible”, would P&E programmer solve my problem?
    4. If P&E like commercial programmer is the only option, what is the cheapest P&E product do you recommend?
    5. In order to generate .bin with CRP included, I think I can use mbed library along with tool chain in my local setup. Is this possible so that I don’t have to modify .bin file?

    Thanks in advance.
    Hemant

    Like

    • Some correction in queston #1. Is it technically correct to modify the .bin file to overcome restriction with the online compiler?

      Like

    • Hi Hernant,
      1. The technical correct way is not to use mbed. I recommend to use normal tools like Kinetis Design Studio, IAR or Keil as they do not have these limitations. You still might use the mbed libraries, but Freescale comes with a powerful Kinetis SDK (http://www.freescale.com/kds) which is much better in my view. And best of all: Kinetis Design Studio is free, unlimited and Eclipse based 🙂

      Erich

      Like

  52. Hello and thanks for share all this useful information.

    I work teaching microcontrollers. Currently, I have a delopment system which you can change the microcontroller (S08 or CFv1), pretty similar to DemoJM board. I was thinking about make a new MCU board for KL25K, however I am worry about the programming interface, because i have read OpenSDA can not be used in a custom hardware design. ¿Do you now which alternatives do I have?. My idea is to have a programming/debugging interface for KL25Z similar to OpenBDM in S08.

    Thanks a lot Erich.

    Like

  53. Pingback: Proof of Concept: Open Source ARM SWD Debug and General Purpose Board | MCU on Eclipse

  54. Pingback: Tutorial: Adafruit WS2812B NeoPixels with the Freescale FRDM-K64F Board – Part 2: Software Tools | MCU on Eclipse

  55. Pingback: Debugging STM32F103RB NUCLEO Board with Segger J-Link | MCU on Eclipse

  56. Pingback: Going to Mars: Building a DIY Eclipse IDE for ARM Embedded Microcontrollers | MCU on Eclipse

  57. Pingback: SWD Debugging the FRDM-KL43Z | MCU on Eclipse

  58. Pingback: Playing Tetris with a FRDM-KL43Z Board | MCU on Eclipse

  59. Pingback: Debug Multiple Boards with GDB at the Same Time | MCU on Eclipse

  60. Pingback: First steps: ARM Cortex-M7 and FreeRTOS on NXP TWR-KV58F220M | MCU on Eclipse

  61. Pingback: How to Recover the OpenSDA V2.x Bootloader | MCU on Eclipse

  62. Pingback: Hexiwear: Teardown of the Hackable ‘Do-Anything’ Device | MCU on Eclipse

  63. Pingback: Recovering and Updating the NXP OpenSDA Bootloader with P&E Multilink and MCUXpresso IDE | MCU on Eclipse

  64. Pingback: FreeRTOS Thread Debugging with Eclipse and OpenOCD | MCU on Eclipse

  65. Pingback: Freelink LPC4322JET100 based Debug Circuit on NXP i.MX RT1064-EVK Board | MCU on Eclipse

  66. Pingback: tinyK22 Board Rev 1.3 released | MCU on Eclipse

What do you think?

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