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:
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.
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 🙂
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
LikeLike
Some correction in queston #1. Is it technically correct to modify the .bin file to overcome restriction with the online compiler?
LikeLike
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
LikeLike
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.
LikeLike
You need to look at OpenSDA v2. Here the hardware and firmware/bootloader is open source, similar to OSBDM on S08.
Links:
https://community.freescale.com/docs/DOC-100720
https://mcuoneclipse.com/2014/04/27/segger-j-link-firmware-for-opensdav2/
LikeLike
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