Marco Aurelio P. Coelho

USB MSD Host bootloader for K22F and K64F MCU's

Discussion created by Marco Aurelio P. Coelho on Nov 29, 2017
Latest reply on Aug 2, 2018 by Alexandre V.D.P.

Hello, everybody!


I would like to share with you a USB MSD Host bootloader I developed in MCUXpresso 10.0.0 with SDK v. 2.2 drivers and FreeRTOS. Most of the code was taken and reused from SDK's "usb_host_msd_fatfs_freertos" demo code and the application was adapted from AN4368 USB MSD Host bootloader code for TWR-K70 (also posted on this Community:


This bootloader reads the application's raw binary (.bin) file stored in a USB memory stick and programs it into Flash area reserved to the application.


Status messages are sent through the MCU's UART connected to the Freedom board's Open-SDA port to the personal computer and can be seen on a Serial Terminal.


Attached are two bootloader versions: one for FRDM-K64F and the other for FRDM-K22F, as well as a user guide, boarding the following topics:


  •      Bootloader Overview
  •      Bootloader Architecture
  •      Bootloader File Structure
  •      Preparing user applications developed in MCUXpresso for the bootloader system
  •      Preparing user applications developed in KDS for the bootloader system
  •      Using the bootloader
  •      Error Messages
  •      Modifying bootloader code
  •      Conclusion
  •      Referred documents

The projects files and folders are not linked to anywhere and their paths are referenced to the workspace in MCUXpresso, which means that it can be imported and copied to your own workspace.

I'm not an advanced level programmer, it is the first time I write and publish a document like that and I know that either the software and the document can be improved. For this reason, all the source code is open and I leave an .docx version of the user guide so anyone can modify it for better.


I hope it can be interesting and helpful for somebody.


Required setup:

  •      MCUXpresso v. 10.0.0 or later
  •     SDK 2.2 (not tested with SDK v. 2.3 yet)
  •     FRDM-K22F or FRDM-K64F
  •     A personal computer with a Serial Terminal Application
  •     1 A to micro-AB USB cable
  •     1 micro-AB to A USB adapter

Best regards,

Marco Aurelio P. Coelho

DFAE - Siletec Eletronica