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.
In the Freedom board, there is a Kinetis K20 (K20DX) which runs OpenSDA:
The OpenSDA is a firmware running on the K20 which runs a bootloader:
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:
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:
- press the reset/SW1 button on the Freedom board while powering the board (plugging in the K20 USB connector).
- The green LED near the K20 starts blinking
- The K20 enumerates as MSD device and is named ‘Bootloader’:
- Simply drag&drop or copy the *.SDA application file to the Bootloader device to program it to the board:
- 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:
The OpenSDA Debug connection is offered as a choice in the CodeWarrior New Project wizard:
Using the OpenSDA connection in the debugger is very similar to any of the P&E run control devices:
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:
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 🙂
Pingback: Tutorial: Accelerating the KL25Z Freedom Board | MCU on Eclipse
Pingback: CodeWarrior for MCU10.3 beta is now available | MCU on Eclipse
Pingback: A Seminar, and Freedom with it | MCU on Eclipse
Pingback: Tutorial: USB CDC with the KL25Z Freedom Board | MCU on Eclipse
Pingback: Fixing the USB Drivers | MCU on Eclipse
Pingback: Completing the FRDM-KL25Z Board | MCU on Eclipse
Pingback: Unsecuring the KL25Z Freedom Board | MCU on Eclipse
Pingback: JTAG/SWD Debugging with the FRDM-KL25Z Board | MCU on Eclipse
Pingback: USB CDC and SCI: Side-by-Side with the Freedom Board | MCU on Eclipse
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.
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.
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.
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.
Great! I’m not sure what the problem is, but I have seen that Windows Explorer extensions can have a negative side effect.
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.
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,
Thanks so much Erich!
I will try it then and let you know.
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.
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:
I haven’t read them, so I don’t know if they’re specific to your problem, but I hope it helps.
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!!
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.
Pingback: A new Freedom Board: FRDM-KL05Z | MCU on Eclipse
Pingback: The Freedom Robot | MCU on Eclipse
Pingback: Debugging ARM Cortex-M0+ Hard Fault with MTB Trace | MCU on Eclipse
Pingback: First Steps with Avnet’s Wi-Go Board | MCU on Eclipse
Pingback: Back to Basic(s) with the Freedom Board | MCU on Eclipse
Pingback: Live View for Variables and Memory | MCU on Eclipse
Pingback: Tutorial: IAR + FreeRTOS + Freedom Board | MCU on Eclipse
Pingback: Zumo Line Following with FRDM-KL25Z | MCU on Eclipse
Pingback: Tutorial: ADC with the Freedom Board | MCU on Eclipse
Pingback: Pololu Line Following Robot with Freedom Board | MCU on Eclipse
Pingback: First Steps with the P&E Tracelink | MCU on Eclipse
Pingback: A new Freedom Board: FRDM-K20D50M with ARM Cortex M4 | MCU on Eclipse
Pingback: printf() with the FRDM-KL25Z Board and without Processor Expert | MCU on Eclipse
Pingback: Red Suite 5: Eclipse Juno, Processor Expert and unlimited FRDM-KL25Z | MCU on Eclipse
Pingback: Using the Freedom Board as JTAG Programmer | MCU on Eclipse
Pingback: Serial Bootloader for the Freedom Board with Processor Expert | MCU on Eclipse
Pingback: Can MCU10.4 recover a bricked OpenSDA Freedom Board? | MCU on Eclipse
Pingback: Freedom Board with Segger OpenSDA Debug Firmware | MCU on Eclipse
Pingback: CMSIS-DAP with IAR and the KL25Z Freedom Board | MCU on Eclipse
Pingback: Bricking and Recovering FRDM-KL25Z Boards: Reset, SWD Clock and Low Power | MCU on Eclipse
Pingback: DYI Free Toolchain for Kinetis: Part 1 – GNU ARM Build Tools | MCU on Eclipse
Pingback: DIY Free Toolchain for Kinetis: Part 2 – Eclipse IDE | MCU on Eclipse
Pingback: DIY Free Toolchain for Kinetis: Part 3 – Debugger (GDB Server with P&E and Segger) | MCU on Eclipse
Pingback: A new Freedom Board: FRDM-KL46Z | MCU on Eclipse
Pingback: Tutorial: FreeMASTER Visualization and Run-Time Debugging | MCU on Eclipse
Pingback: The Freescale OpenSDA Trap: “No Device Available”, or something like that…. | MCU on Eclipse
Pingback: FRDM boards not responding? Check your Virus Scanner! | MCU on Eclipse
Pingback: FRDM Board Bootloader fails with Windows 8.1 Preview | MCU on Eclipse
Pingback: New P&E OpenSDA Firmware v114 | MCU on Eclipse
Pingback: Review: New FRDM-KL26Z Board | MCU on Eclipse
Pingback: Freedom Board Resources | Smiffy's Place
Pingback: Binary Files for the mbed Bootloader with Eclipse and GNU ARM Eclipse Plugins | MCU on Eclipse
Pingback: Segger J-Link Firmware for OpenSDAv2 | MCU on Eclipse
Pingback: Updated Freedom Board Logic Analyzer with DMA | MCU on Eclipse
Pingback: Step-by-Step: Updating OSBDM/OSJTAG Debug Firmware | MCU on Eclipse
Pingback: Illustrated Step-by-Step Instructions: Updating the Freescale Freedom Board Firmware | MCU on Eclipse
Pingback: Tutorial: Playing MP3 Files with VS1053B and FRDM Board | MCU on Eclipse
Pingback: Tutorial: Web Server with the ESP8266 WiFi Module | MCU on Eclipse
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?
you will not be able to use OpenSDA (v1, the P&E one, e.g. on FRDM-KL25Z) for your own board. This is closed source, and the OpenSDA is tight to the microcontroller on the board. And the K20 device is secured and flash erase is disabled. You simply cannot do it.
But: you can do this with OpenSDA v2 (https://mcuoneclipse.com/2014/04/27/segger-j-link-firmware-for-opensdav2/) which is open source, and you can build it on your own.
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.
Some correction in queston #1. Is it technically correct to modify the .bin file to overcome restriction with the online compiler?
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 🙂
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.
You need to look at OpenSDA v2. Here the hardware and firmware/bootloader is open source, similar to OSBDM on S08.
freescale community docs/DOC-100720
Pingback: Proof of Concept: Open Source ARM SWD Debug and General Purpose Board | MCU on Eclipse
Pingback: Tutorial: Adafruit WS2812B NeoPixels with the Freescale FRDM-K64F Board – Part 2: Software Tools | MCU on Eclipse
Pingback: Debugging STM32F103RB NUCLEO Board with Segger J-Link | MCU on Eclipse
Pingback: Going to Mars: Building a DIY Eclipse IDE for ARM Embedded Microcontrollers | MCU on Eclipse
Pingback: SWD Debugging the FRDM-KL43Z | MCU on Eclipse
Pingback: Playing Tetris with a FRDM-KL43Z Board | MCU on Eclipse
Pingback: Debug Multiple Boards with GDB at the Same Time | MCU on Eclipse
Pingback: First steps: ARM Cortex-M7 and FreeRTOS on NXP TWR-KV58F220M | MCU on Eclipse
Pingback: How to Recover the OpenSDA V2.x Bootloader | MCU on Eclipse
Pingback: Hexiwear: Teardown of the Hackable ‘Do-Anything’ Device | MCU on Eclipse
Pingback: Recovering and Updating the NXP OpenSDA Bootloader with P&E Multilink and MCUXpresso IDE | MCU on Eclipse
Pingback: FreeRTOS Thread Debugging with Eclipse and OpenOCD | MCU on Eclipse
Pingback: Freelink LPC4322JET100 based Debug Circuit on NXP i.MX RT1064-EVK Board | MCU on Eclipse
Pingback: tinyK22 Board Rev 1.3 released | MCU on Eclipse