Document created by Adrian Cano Employee on Jul 10, 2014Last modified by ebiz_ws_prod on Dec 13, 2017
Version 4Show Document
  • View in full screen mode

In this document we are going to see how to use the attached code which implements the configuration of the FRDM-KL25 board as a USB HOST interfacing with a Numeric Keyboard and a 16x2 LCD.


The project is compiled in the CodeWarrior IDE using Processor Expert and the Components to support the USB module of the USB Stack 4.1.1.


How to add the Processor Expert USB components.

The instructions to install the USB components to use them with Processor Expert are in the documentation of the USB Stack 4.1.1; here you can see the steps as well:


  • Download the USB Stack 4.1.1 from the Freescale’s Website (USB Stack 4.1.1)
  • Run the .exe file and install it in the default location.
  • Open CodeWarrior and select Import Components in the Processor Expert button in menu bar.

import components.png

  • An Open windows will pop up, there you need to go to the path: <install folder>\Freescale USB Stack v4.1.1\ProcessorExpert\Components. To have the complete components and support for the USB module add each PEupd file repeating this step.

open window.png

  • Close CodeWarrior and open it again to ensure correct installation of the components.
  • Check that the new components are available in the Components Library.

usb components.png

About this Project.

This project is based in the example code for Processor Expert in the USB Stack 4.1.1 USB_HID_MOUSE_HOST_MKL25Z128_PEx which implements the use of the FRDM-BOARD KL25 and a HID Mouse Device to interface with.


In this project the HID Device is a Numeric Keyboard and the HOST Device (FRDM-KL25) is handling the data and printing them in a 16x2 LCD used in 8 bits mode (The LCDHTA component used here was created by Erich Styger; find the component an all the information about it here: http://mcuoneclipse.com/2012/12/22/hd44780-2x16-character-display-for-kinetis-and-freedom-board/ and say Thank you Erich: “Thank you Erich”).


Here you can find a video of the implementation of this application:



The hardware components are:

  • FRMD-KL25 Rev.E
  • Adafruit Prototype Shield v.5
  • LCD JHD-162A
  • Numeric USB Keyboard (Product Name: Numpad i110, Model No. GK-100010)



USB _host

Inside the project you can see there is a folder called USB_Host an it contains two important folders with source files:


  • App_keyboard: Contains the specific function for the Keyboard configuration: in use, attached detached, callbacks and more; contain how to handle the data coming from the device. The function process_kdb_buffer is where the data is transmitted to the LCD and use it for the application.
  • Classes: contain the necessary function to handle a hid as the device. Handle all the functions necessary for the USB protocol.




The usb_classes.c and usb_classes.h files are generated by processor expert. I attach these two files as well to have a reference how these files must look like. This is because sometimes during the code generation process Processor Expert erases part of the code.


I hope this project is useful for you.

Best Regards,


Original Attachment has been moved to: FRDM-KL25-HID-HOST-NUMERIC-KEYBOARD.zip

1 person found this helpful