Illustrated Step-by-Step Instructions: Updating the Freescale Freedom Board Firmware

I have received a bunch of Freescale FRDM boards to be used in an Embedded Systems programming crash course. There are multiple issues with the boards coming from the factory:

  1. They come with an old bootloader which is not compatible with Windows 8.x
  2. They have an old and outdated firmware on the board only supports a MSD bootloader

This post is a step-by-step instruction how to update Freescale FRDM boards (e.g. FRDM-KL25Z) to the latest firmware.

FRDM Board

FRDM Board

Preconditions

❗ Note that this instructions apply for the FRDM boards with the P&E OpenSDA bootloader (FRDM-KL03Z, FRDM-KL05Z, FRDM-KL25Z, FRDM-KL26Z, FRDM-KL46Z, FRDM-K20), but *NOT* to newer FRDM board like the FRDM-K64F and FRDM-K22F (which use a mbed bootloader which is different and does not allow to upate the bootloader). I need a SWD/JTAG programming device to update the bootloader on these boards, see https://mcuoneclipse.com/2016/06/26/how-to-recover-the-opensda-v2-x-bootloader/

You need

  1. The board (of course 🙂 )
  2. A mini USB cable to connect the board to the host
  3. A host machine (Windows 7 machine is needed, see note below)
  4. P&E USB drivers
  5. P&E OpenSDA Firmware files

❗ There is a bug with the factory firmware on the board which prevents it working with Windows 8.x (see “FRDM Board Bootloader fails with Windows 8.1 Preview” and “New P&E OpenSDA Firmware v114“). Windows 8 tries to write the ‘virtual’ MSD (Mass Storage Device) of the board, confusing the bootloader. See https://community.freescale.com/message/440982#440982 for the getting it working with Windows 8 (many thanks to Mark Butcher!).

Configure “Do not allow locations on removable drives to be added to libraries”  as discussed here: http://answers.microsoft.com/en-us/windows/forum/windows8_1-hardware/how-do-i-prevent-system-volume-information-files/815b0046-d631-4419-a43e-44083a3733f5 Download and install the P&E drivers from https://www.pemicro.com/opensda/ (you can skip this step if you have CodeWarrior or Kinetis Design Studio installed).

P&E USB Drivers

P&E USB Drivers

Download the OpenSDA Firmware Files from https://www.pemicro.com/opensda/ (registration required). You can skip this step if you have Kinetis Design Studio V1.1.1 installed, as it comes with the files in C:\Freescale\KDS_1.1.1\pemicro\opensda).

P&E OpenSDA Firmware Apps

P&E OpenSDA Firmware Apps

Unzip that archive to your local machine. Inside the archive, there is as well OpenSDA_Bootloader_Update_App_v111_2013_12_11.zip: extract that file too:

❗ You *have* to extract/unzip the files. You *cannot* copy/move the files from inside the zip file to the bootloader device.

BOOTUPDATEAPP_Pemicro_v111.SDA

BOOTUPDATEAPP_Pemicro_v111.SDA

There are two steps for the update required:

  1. Update the bootloader. This makes it Windows 8 aware.
  2. Update the board firmware. This gives you MSD bootloader, a USB CDC interface and the ability to debug the board as an OpenSDA board.

❗ In the steps below you are asked to copy files to the ‘board’ drive. On Windows, you can use the ‘Send to’ context menu, or drag&drop the file to the drive. If this does not work, use the DOS/command Shell copy command. A common failure for this operation is using any kind of ‘File Commander’ or special File Manager. Another common failure point are any kind of virus scanner, so if things are still failing, temporarily disable your firewall/virus scanner.

Updating the Bootloader

  1. Press first the Reset button (and keep it pressed) while power theboardwiththeOpenSDA USB connector:

    Power-On with Reset Pressed

    Power-On with Reset Pressed

  2. The green LED will blink with a frequency of 1 Hz:

    Blinks with 1 Hz

    Blinks with 1 Hz

  3. The board willshowupasBOOTLOADER drive on your system:

    BOOTLOADER

    BOOTLOADER

  4. Copy BOOTUPDATEAPP_Pemicro_v111.SDA to the BOOTLOADER driver:

    Copy to BOOTLOADER Drive

    Copy to BOOTLOADER Drive

  5. The copy operation takes about 2-3 seconds, and the green LED should still blink with a 1 Hz frequency. If it blinks faster, the copy operation failed. 😦
  6. Unpower the board:

    Unpowered Board

    Unpowered Board

  7. Power the board again normally (do NOT press the reset button this time):

    Powering the Board Normally

    Powering the Board Normally

  8. Wait a second so the bootloader gets reprogrammed. The board shall showupagainasBOOTLOADER, with the green LED blinking at 1 Hz.

    BOOTLOADER

    BOOTLOADER

  9. You can check if the V1.11 bootloader has been correctly programmed if you open theBOOTLOADER\SDA_INFO.HTM file with your web browser:

    Bootloader Version 11.1

    Bootloader Version 11.1

If you have the V1.11 bootloader on your board, then everything is ready for the next step: loading the MSD+CDC+Debug board firmware.

Updating Board Firmware

The P&E OpenSDA firmware features three functions:

  1. USB MSD bootloader: the board looks like a memory (MSD=Mass Storage Device), so you can copy .s19 files to it to get it programmed
  2. USB CDC serial bridge: the OpenSDA debug firmware is like a USB-to-Serial Converter, so the microcontroller on the board can communicate with the host PC
  3. USB Multilink OpenSDA debug: the board can be used for debugging e.g. with CodeWarrior or Kinetis Design Studio.

Because the firmware is board-specific, you need to copy the *correct* firmware file to your board. Carefully select and use the firmware *.SDA file matching your board:

Different Firmware for each board

Different Firmware for each board

To program the board with the new firmware:

  1. Press first the Reset button (and keep it pressed) while power theboardwiththeOpenSDA USB connector:

    Power-On with Reset Pressed

    Power-On with Reset Pressed

  2. The green LED will blink with a frequency of 1 Hz:

    Blinks with 1 Hz

    Blinks with 1 Hz

  3. The board willshowupasBOOTLOADER drive on your system:

    BOOTLOADER

    BOOTLOADER

  4. Copy MSD-DEBUG-<boardname>_Pemicro_v*.SDA (matching your board!) to the BOOTLOADER driver:

    Copy to BOOTLOADER Drive

    Copy to BOOTLOADER Drive

  5. The copy operation takes about 2-3 seconds, and the green LED should still blink with a 1 Hz frequency. If it blinks faster, the copy operation failed. 😦
  6. Unpower the board:

    Unpowered Board

    Unpowered Board

  7. Power the board again normally (do NOT press the reset button this time):

    Powering the Board Normally

    Powering the Board Normally

  8. If needed, your host system will install the device drivers. In your Windows Device Manager, you should see the PEMicro OpenSDA Debug Driver, the WinDriver and an OpenSDA – CDC Serial Port:

    P&E OpenSDA Drivers in Device Manager

    P&E OpenSDA Drivers in Device Manager

  9. The green LED shall be permanently on:

    Green LED On

    Green LED On

  10. The board shows up with its name as device:

    Board Device

    Board Device

  11. You can check if the firmware has been correctly programmed if you open the SDA_INFO.HTM file with your web browser: It should show an installed application matching your board:

    Debug Application Firmware Loaded

    Debug Application Firmware Loaded

Done! Now you can use the board to be programmed with an S19 file, or by the debugger, or it can communicate with the host using the USB CDC interface :-).

Summary

The factory boards come shipped with an outdated firmware and application (which only supports MSD bootloading). To make the board working with Windows 8 it requires a bootloader update. To really use the board, the latest firmware needs to be loaded on the board too. Happy Bootloading 🙂

Advertisements

57 thoughts on “Illustrated Step-by-Step Instructions: Updating the Freescale Freedom Board Firmware

    • I do not have a Mac, so I cannot really tell. To my understanding with the bootloader on v1.11, it should not be vulnerable to host OS systems trying to write or index the MSD device.

      Like

  1. Pingback: Debugging Failure: Check List and Hints | MCU on Eclipse

  2. I am trying to figure this out for a Mac, and I get stuck where you are downloading the drivers from pemicro. There apparently are drivers for Windows and Linux, but not Mac. Is this correct? What do you recommend for Mac users?

    Like

      • The Mac does not usually need custom drivers for each new product the way that Windows does. OS X relies on the device class to set up generic drivers for most devices (only using the vendor ID for exceptions). OS X recognizes OpenSDA port as a flash drive (but because P&E didn’t follow the standards, the writing doesn’t work). The MBED software does work with Macs, but first you need a Windows machine to get rid of the P&E junk.

        Like

  3. Pingback: OpenOCD/CMSIS-DAP Debugging with Eclipse and without an IDE | MCU on Eclipse

    • Sorry, works, my bad! P&E debugger pretty much hangs unexpectedly when using KDS in Linux and there is need to kill the process before attempting again, that was my problem, not the firmware.

      Like

      • Have you ever tried working with the serial port via opensda with PE debug server with the kl05z board. It has some funny connection. from the k20 debug mcu to the uart of the kl05 onboard mcu to the arduino headers. IF i try using the opensda interface serial port doesnt send any data to computer, if i use the arduino headers with a usb-to-serial cable, the serial port works, yet they appear to be shorted, only seperated by 1k resistors according to the schematic. Whats going on?

        Like

  4. Pingback: Primeiros passos – Como preparar seu computador e microcontrolador para códigos e projetos | void Hardwarizando( ) {

  5. Pingback: Using the Freescale Freedom (FRDM-KL43Z) to Debug other Boards | MCU on Eclipse

  6. After updating to the latest firmware and bootloader it shows up as an mbed device.

    I can load a .bin program file on it from my windows 7 computer.

    However when i try to do so with my windows 10 computer I get a swd fail file error.

    Any advice?

    Like

  7. Would also like to add that this issue persists on windows 10 (and bizarrely Ubuntu 15 as well) . Also the group policy setting is not available on home editions so there is no fix other than using a windows 7 machine

    Like

    • Definitely, to use openSDA with Windows 8 or Windows 10, the bootloader has to be updated to under Windows 7 first. So you need to have someone with a windows 7 (or XP) machine to upgrade the board first.

      Like

  8. although the firmware upgrade, always comes into bootloader mode, no matter what I always go that way, some solution?

    I’m using windows 7

    Like

  9. Pingback: Bricking and Recovering OpenSDA Boards in Windows 8 and 10 | MCU on Eclipse

  10. After the step in FRDM KL267. How can I programmed the board with S19 File or how can I update the firmware of the other board using the frdm kl26 as debugger?

    Like

  11. I am using a windows7 virtual machine to try and update the firmware. I installed the PEDrivers, but when I plug the device into the virtual machine in Bootloader mode (holding down the reset button), windows makes the “new device connected sound”, but I do not get a new bootloader device added to my system. Any ideas why the device is not showing up?

    Like

  12. Hi, Erich!
    I am trying to use the KL43Z board with the OM2385/SF001 shield. I have installed the board drivers and when I try to use the KL43Z demo, it works fine. However, when I copy the srec file from the OM2385/SF001 and I try to execute the demo, it shows “An error ocurred in the SetupDevices function (11300)”. I have tried to research about this error, but I didn’t find anything. Can you help me with this issue?

    Like

    • Hi Mariana,
      I did not know that SixFox shield, and I don’t have one, so I’m not familiar with it. Is there a reason why you use the SRec and not download/debug the hardware? And what or who is sending that message?

      Like

  13. Hi Erich! I am designing a custom board with the MKL46Z256VLH4 for a mass production of 400 boards, in the desing I am usign a SWD connector to flash the firmware, I would like to ask you:

    * if you are using the SWD debug connection, you do not need a bootloader, right?
    * I need to buy a programmer/debugger. Which recommends me to use in linux with KL46Z and (in the future) with K82F?
    * I followed the instructions described in your post Preventing Reverse Engineering, for protect the firmware on FRDM Boards. Using SWD connector those recommendations are still validate or I need to take some extra considerations?

    Thank you!!!

    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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s

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