USB Component  Version 6.16.0
MDK Middleware for USB Device and Host Communication
USB Host Keyboard

The following example application shows how to interact with a USB keyboard from a microcontroller. To keep it simple, the graphical LCD on the evaluation board is used to show the keyboard inputs. This is done using the Compiler software component with the appropriate user code templates.

The Abstract.txt file contained in the Documentation group of the Project window gives you more information on the general setup and the available I/O of the development board.

Build the "USB Host Keyboard" Project

Open the example project in MDK ( web page explains this). The ┬ÁVision Project window should display a similar project structure:

USB Host Keyboard Project Structure

Source Files

  • Keyboard.c contains the main C function that initializes the board hardware and the USB Host Component. It also reads the input from the attached keyboard.
  • In stdout_display.c, the function stdout_putchar is retargeted to the function GLCD_DrawChar of the graphics display.

If you are using RTOS other than CMSIS-RTOS2 RTX5 for your project please make sure to satisfy USB Host Resource Requirements.

You may now build and download the example project to the evaluation board using the ┬ÁVision commands:

  • Project --> Build target (F7)
  • Flash   --> Download (F8)
  • Debug --> Start/Stop Debug Session (Ctrl + F5)
  • Debug --> Run (F5)

After these steps, the project should start executing on your evaluation kit. In case of errors, refer to the Evaluation Board User's Guide for configuration information.

Using the "USB Host Keyboard" Project

Hardware Setup

The setup of the Evaluation Board hardware is described in the Abstract.txt file.

  • Verify all jumper settings on the target hardware.
  • Connect a USB keyboard to one of the development board's USB connectors.
  • After downloading the code onto the board, you should be able to see something similar on the graphics display: