Course: 8051 USB Programming
Duration: 3 Days
Course Background
USB is the successor to RS232 for connecting devices to computers. 8051 microcontrollers with on chip USB transceivers are now readily available from companies such as Silicon Labs (Silabs) and Atmel. These devices are used in the implementation of sensors, data acquisition systems and control systems that can be connected to the PC and can also be used to implement simple mass storage devices. USB bootloaders can also be implemented for such devices.
Course Prerequisites and Target Audience
A good knowledge of embedded systems C programming is assumed. Detailed knowledge of USB is not required as USB standards and protocols will be covered in depth during the course.
Course Overview
The course introduces USB 1.x and 2.0 in depth and covers the theory and evolution of the USB standard up to USB 3.0. This is followed by coverage of the USB hardware on the target microcontroller platform (e.g. Silabs or Atmel) and the associated firmware. There then follows an exploration of a USB devices classes and their uses - HID, CDC, MSD. As well as covering device side programming PC side application development Microsoft Windows and/or Linux is covered. PC side application examples include both command line driven and GUI based (Graphical User Interface) applications. GUI programming examples will be presented as demonstrations with structured walkthroughs of the code. The course can be extended and tailored to go into PC side programming in greater depth if so required. The course comes in Silabs or Atmel versions. Furthermore the host aspects of the course come in Microsoft Windows or Linux versions. If necessary the course can be tailored for a MAC OSX version.
Course Benefits
Students successfully completing this course will have a sound understanding of USB C programming. You will understand the development of USB applications using the HID (Human Interaction Device) and CDC (Communication Device Class) USB classes as well as how to work with USB MSD (Mass Storage Device) classes and the implementation of basic SD/MMC card based applications.
Course Outline
- USB an Overview
- Uses and limitations of USB
- USB - Design considerations
- Evolution of USB - from 1.0 to 1.1 to 2.0 to 3.0
- USB On The Go (OTG)
- Wireless USB
- USB as a replacement for RS232
- USB as a Networking Protocol
- Layering and Network Protocols
- ISO-OSI 7 layer model as it applies to USB
- USB Network Topology - Logical vs. Physical
- Host Responsibilities vs. Device Responsibilities
- Network requirements depend on application requirements
- Bus speed vs. Data throughput
- How USB can support different kinds of traffic
- USB 3.0 and its applicability to embedded systems
- USB Device Hardware in 8051 Microcontrollers
- USB Device Architecture
- Transceivers, Buffers and Interrupts
- Ping Pong Buffering
- DMA Support
- Interrupts
- Clocking and timing issues
- Silabs USB Firmware and USB Development Tools
- Introduction USBXpress
- Understanding Windows device drivers and INF driver installation files
- Introduction to the Device API and the device firmware interface function library
- Overview of (Dynamic Link Libraries) DLLs in Microsoft Windows
- Overview of the Host API provided by the USBXpress Windows Dynamic Link Library
- Overview of the libusb and winusb and their use with USBExpress
- Atmel USB Firmware and USB Development Tools
- Introduction the Atmel Software Framework (ASF) USB Stack
- Understanding Windows device drivers and INF driver installation files
- Overview of the Atmel USB Host interface libraries for CDC, HID and MSD classes
- Overview of (Dynamic Link Libraries) DLLs in Microsoft Windows
- Overview of libusb and winusb and their use with Atmel 8051 USB Devices
- USB Transfers
- Essential Concepts and Terminology
- Endpoint - Source and Sink of data
- Pipes - Stream pipes and Message pipes
- Transfers and Transactions
- Transfer types - uses and characteristics
- Control transfers
- Bulk transfers
- Interrupt transfers
- Isochronous transfers
- Host - Device Interactions -- Rules of the Game
- How a host learns about devices and recognises device attach and device detach events
- Attachment and Detachment life cycle
- Enumeration and device descriptors
- Device removal issues
- Device descriptor concepts and terminology
- Device descriptor attributes
- Control transfers - stages, states and elements
- Standard control transfer requests
- Device Classes
- Class specifications
- Overview of commonly defined classes
- Human Interface
- Mass storage
- Communications
- Smart card
- Audio
- Still image capture
- Video
- Personal Health Care
- Host - Device Communications with host running under Microsoft Windows or Linux
- Operating system concepts
- User space vs. kernel space code
- Operating system APIs
- Device drivers and device driver programming
- Operating system USB Driver Framework
- User space USB driver programming
- Working with libusb
- Human Interface Devices - Theory and Practice
- HID hardware and firmware requirements
- HID Descriptor - Class descriptor, Report descriptors
- Handling HID specific requests
- Get Report
- Set Report
- Get Idle
- Set Idle
- Get Protocol
- Set Protocol
- Representing a Report Structure in C
- HID USB Host Programming
- Operating system aspects of the HID architecture
- HID User Space Programming
- HID USB Examples and Case Studies
- HID keyboard using a keypad
- HID Mouse using a potentiometer and some buttons
- HID based sensors
- HID based data acquisition and control applications
- HID USB Examples and Case Studies
- HID keyboard using a keypad
- HID Mouse using a potentiometer and some buttons
- HID based sensors
- HID based data acquisition and control applications
- CDC Class Devices
- Overview of the CDC class and its uses
- Operating system specific aspects concerning recognition of CDC class devices as serial ports
- Data acquistion and control applications based on CDC
- USB Mass Storage Class
- Introduction to File Systems and their Architectures
- FAT16 and FAT32 File Systems
- Overview of the SCSI protocol and SCSI commands
- Use of SCSI commands in Mass Storage Systems
- Introduction to SD/MMC cards
- Overview of the implementation of SD/MMC card drivers
- Serial Data Logging Applications Using Mass Storage Device Technology