↑ Return to Tutorials

Print this Page

Explaining FRDM-K64F Kinetis Bootloader Usage and OpenSDA

The bootloader is a firmware program, and in our case, with our microcontroller is resided in flash memory.  Basically loads main functionality of all interface and peripherals and has command line interface tools to make an upgrade of our existing application.

This bootloader was done by Freescale Semiconductors and for future freescale devices this will be incorporated in future devices.  There are several flavors of bootloaders (FLASH and ROM based).

Remember, the use of a serial bootloader, in this case, do not replace debugging tools for project development, it is just only a solution for implement In-System-Reprogramming easily without stopping a process.  The bootloading sequence is done using the OpenSDA interface but basically is serial based bootloader to the MCU.

A better use of a bootloader is to implement in a serial line of devices ready to flash; companies use a bootloader to program lots of units and ship pre-programmed or in a facility, the commodity to re-program a line of devices in a sub-network if you are far away from them.

Below is demonstrated the functionality of the bootloader when inserted on chip.

BOOTLOADER-KINETIS

 

Some other features of advantage of using a bootloader are:

  • C/C++ Source code provided under a permissive BSD open source license
  • Supported Serial communications with active peripheral detection
  • Common packet-based protocol for all peripherals
  • Packet error detection and retransmission
  • Configurable for flash-based and ROM-based bootloaders
  • Flash security and flash region protection options
  • Command-line and GUI tools provided for Windows
  • And so on.

This demonstration uses the Flash Bootloader precompiled and tells you how to update to the OpenSDA interface.  When you buy the FRDM-K64F Board it is ready to use with mbed, so you have to make a manual process to update to the bootloader application.

What is OpenSDA

OpenSDA is an open-standard serial and debug adapter, is a hardware and software approach using the serial port to debug and program Freescale Microcontrollers (Kinetis).  It is based on Kinetis K20 MCU because it has USB capability.OpenSDA

The current and detailed in this guide OpenSDA i use is the OpenSDAv2.  OpenSDAv2 is an open source bootloader and it comes by default with your freedom board, it enables you the use of your microcontroller with the mbed platform and is called CMSIS-DAP.

OpenSDA Firmware (Look Carefully)

You can use any of these OpenSDAv2 firmware:

I tested all above firmwares with the Freedom K64F board and i can mention you that if you don’t want problems, just beleive me and go for it.

Updating Firware to OpenSDAv2 – P&E Micro.

Step 1.  Entering Bootload Option.

First recognize the buttons and interface to use with the Kinetis Freedom Board.

FRDM-K64F Front Side

 

  • Disconnect the board from the PC.  Remember, we are using the Open SDA port.
  • Hold the RESET Button
  • Plug again the USB port on the PC
  • After a few seconds, release the reset button.

The result, in hardware should a GREEN LED flashing at a estimated rate of 1 second.

The result, in the PC should be the bootloader window.

BootloaderFRDM

Step 2.  Download OpenSDAv2 Firmware, mbed

As explained in the previous section, install the firmware corresponding to the CMSIS-DAP for mbed platform, update to the latest firmware.

mbed - CMSIS DAP firmware

The result in hardware must be the same GREEN LED flashing approximately three (3) times per second, this told us that the mbed CMSIS-DAP download is complete.

Step 3.  Reboot the FRDM-K64F Board.

  • Unplug the board
  • Plug again the board (do not hold the reset button)

mbed mass storage device

mbed serial port

The result in the PC can be seen in the explorer window declared as a mass storage device and in the Device Manager window, listed as a CDC USB device.

Step 4.  Download the Bootloader to the FRDM-K64F Board

flashbootloader

 

  • Reset the board.  Important!

The result in the PC must be the same figure as in step 3.

The result in hardware must be the GREEN LED in ON state, fixed.

Step 5.  Try the blhost application.

  • Open a CMD window and navigate to:
    • <install_path>\FSL_Kinetis_Bootloader_1_1_0\bin\win
  • Write this command to check the bootloader status (in my case is COM5, you can check in device manager)
    • blhost -p COM6 — get-property 1
  • GetPropertyWrite this command to check the version (in my case doesn’t work).
    • blhost -u — get-property 1

Step 6.  Test the Bootloader Application

  • Navigate to the location <install_path>\FSL_Kinetis_Bootloader_1_1_0\bin\win\KinetisUpdater
  • Launch Kinetis Updater and follow the images below.
    • In Device Configuration, select the COM port corresponding to the OpenSDA
    • Press Home to return
    • In Select Image, navigate to
      • <install_path>\FSL_Kinetis_Bootloader_1_1_0\apps\led_demo\binaries
      • Select the file led_demo_FRDM-K64F_a000.bin
    • Return Home
    • In Update
    • Press the update button
    • The board must boot itself and the application must be running with the led changing colors.

KinetisUpdater01 KinetisUpdater02 KinetisUpdater03 KinetisUpdater04 KinetisUpdater05

 

Step 7.  Returning from Application to Bootloader Mode.

  • Simply hold the SW2 button.
  • Press the RESET button
  • Follow step 6 if you want to burn another application.
    • Remember the start address of the flash now must be 0xA000.
  • You are done!

Further Reading

Basically I made this tutorial using the Freedom K64F Bootloader Demo User Guide in Freescale site, named F64FBTLDRDEMOUG.

I recommend you read the file:  Bootloader Solution for Kinetis MCUs FTF-SDS-F0108.

All source code is on the <install_path>\FSL_Kinetis_Bootloader_1_1_0\src\ folder.

You can check the complete documentation of this bootloader on the Kinetis Bootloader Page.

Permanent link to this article: http://cerescontrols.com/tutorials-3/explaining-frdm-k64f-kinetis-bootloader-usage-and-opensda/

1 ping

  1. Running the FRDM-K64F Bootloader Option » Ceres Controls

    […] Explaining FRDM-K64F Kinetis Bootloader Usage and OpenSDA […]

Leave a Reply

Your email address will not be published. Required fields are marked *