herunterladen

Freescale Semiconductor
Application Note
Document Number: AN3565
Rev. 0, 02/2008
Contents
© Freescale Semiconductor, Inc., 2008. All rights reserved.
1 Introduction
Universal serial bus (USB) is a low cost, fast,
bidirectional, isochronous, dynamically attachable serial
interface consistent with the requirements of the PC
platform. It is widely used in the PC connection.
Freescale's 9S08JM series devices include JM60, JM32,
and their derivatives. These derivatives integrate a USB
device controller and help customers interconnect their
devices to PCs and/or any other devices with USB
On-The-Go (OTG) capability. Freescale provides CMX
USB stack software for these devices, which can be
freely downloaded at http://www.freescale.com
.This all
around USB solution makes 9S08JM devices easy to use,
and enables rapid time to market for products.
This application note gives an overview of USB and
9S08JM USB device controller. It shows you how to
integrate the CMX USB stack into a CodeWarrior project
with an HID joystick application.
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 USB Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3 9S08JM USB Device Controller . . . . . . . . . . . . . . . . . . . 5
4 CMX USB Stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.1 CMX USB Stack Architecture . . . . . . . . . . . . . . . . . 6
4.2 CMX USB Stack Examples . . . . . . . . . . . . . . . . . . . 8
4.3 CMX USB Stack Files . . . . . . . . . . . . . . . . . . . . . . . 8
4.4 USB Driver. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.5 HID Class Driver . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.6 Resource Usage . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5 HID Joystick Demonstration . . . . . . . . . . . . . . . . . . . . . 17
5.1 Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.2 Modules and Functions . . . . . . . . . . . . . . . . . . . . . 21
5.3 Create Hid Joystick Project with CodeWarrior. . . . 29
5.4 Run the Demonstration . . . . . . . . . . . . . . . . . . . . . 33
USB and Using the CMX USB
Stack with 9S08JM Devices
by: William Jiang
Asia & Pacific Operations Microcontroller Division