27
USB for Embedded Devices Mohit Maheshwari 200601008 Prashant Garg 200601144

USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

USB for Embedded Devices

Mohit Maheshwari 200601008

Prashant Garg 200601144

Page 2: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

USB : An Introduction

The Universal Serial Bus (USB) is a specification developed by Compaq, Intel, Microsoft and NEC, joined later by Hewlett-Packard, Lucent and Philips.

These companies formed the USB Implementers Forum, Inc.

Page 3: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

The need for USB

Laborious and error-prone configuration of the RS-232 port.

Incompatible RS-232 connectors.

High Power requirements of the transceivers.

Point-to-Point nature of the connections , thus sharing among multiple devices meant a lot of cable and connector requirements.

Page 4: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

The Evolution of USB

USB 1.0: January 1996. Specified data rates of 1.5 Mbit/s and 12 Mbit/s. Had many limitations , wasn’t widely adopted

USB 1.1: September 1998. Fixed bugs of earlier version, was widely accepted.

USB 2.0: April 2000. Added Speed of 480 Mbit/s

USB On-the-Go: December 2006. Host not needed any more.

Micro USB: April 2007.Specially for Mobile Phones

USB 3.0: (5 Gbit/s) In pipeline. Expected to be commercially available in 2010.

Page 5: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

Architecture

Tiered Star Topology.Can connect to a maximum 127 devices. Maximum number of tiers permitted is 6.Length of cable limited to 5m.

Page 6: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

The Concept of HOST!!

HOST is master

Devices can’t communicate directly

Device 1 Device 2

Host

Page 7: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

USB Host Types

Intel developed the UHCI (Universal Host Controller Inter-face) specification. More Software Oriented Version.

A team led by Compaq, Microsoft, and National Semiconductor came out with the OHCI (Open Host Controller Interface) specification. More Hardware Oriented Version.

With the introduction of the high-speed data rate of USB Version 2.0, all of the participants agreed to the EHCI (Enhanced Host Controller Interface) specification.

Page 8: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

USB On the Go

Device 1 Device 2

Devices can become limited role hosts

Marked the emergence of usage of USB in portable platforms

Removed the often-cited limitation that USB requires a desktop computer or equivalent to act as a host.

Page 9: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

Cables and Connectors

Type- A

Type-B

mini-B-Type

mini-A-Type

micro-AB-Type

Page 10: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

Cable Types

1. A high/full speed detachable cable with one end terminated with an A plug and the other end with a B or mini-B plug.

2. A captive high/full speed cable where one end is hardwired to the vendors equipment and the other end is terminated with an A plug.

Page 11: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

Device Powering

A device (or hub) can only sink (consume) current from its upstream port and source to downstream port.

A device which draws its power from the bus is called a 'bus-powered' device. It relies solely on the USB cable.

A 'self-powered' device is one which does not draw power from the bus. An additional power cable is attached.

Note : USB Connectors are specially designed with power pins longer than signal pins so that power is always applied before signals.

Page 12: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

Anatomy of a Packet

Packet, the fundamental element of communication on USB Bus

Page 13: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

The Fundamental Packet

SYNC sequence used by receiver to tune its clock with the transition of the received data. It is of 8 bits.

Packet information varies from 1 to 1025 bytes. First byte, Packet Identifier (PID) defines how other information bytes should be interpreted. Presently there are 10 defined PID types

The last part of a packet is the End-of-packet identifier.

Page 14: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

Data Transfer

Once powered up, host queries all the devices connected to the bus and assigns each one an address. This process is called Enumeration.

Host also enquires what type of data transfer is the device wishing to perform:

Interrupt (For mouse or keyboard)

Bulk (For printer)

Isochronous (Streaming devices like Speaker)

Page 15: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

USB on Embedded Systems

Any embedded device with a processor has a potential to act as a USB host.

Potential Embedded platforms:

Cell Phones

PDAs

Digital Cameras

Set top Boxes and more …….

Page 16: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

Challenges of implementing USB on an embedded platform

USB on a PC USB on an embedded device

MB and GB of memory available

Only KB of memory available

2 GHz micro-processor 12-33 MHz Processor

Hard drive space in GB , greater than 100 GB now a days

No hard drive at all

Last but not the least, many skilled engineers are well versed in designing PC based USB applications

USB on embedded systems is relatively new and not many people have an idea about it.

Page 17: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

But there is a silver lining!!

New updates to incorporate USB on embedded platforms include:

Modern embedded devices allow alternative connection strategies.

Lowered host power requirements.

480-Mbps data rate.

Page 18: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

USB 1.1 vs Serial vs Parallel

Page 19: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

USB interfacing with Microcontroller

Few years back,

migrating to USB was difficult pertaining to higher costs.

New MCUs with native USB interfaces offer a better solution

Page 20: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

USB interfaced with Microcontroller

Latest architectures include direct

integration of the USB interface andtransceiver with the MCU core. This allowsthe application to take full advantage of thebus potential.

Due to large amounts of flash programmemory on chip, MCUs with native USBinterfaces can manage the entireapplication in a single-chip USB.

This results in an effective componentcount reduction and overall real systemcost savings.

Page 21: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction
Page 22: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction
Page 23: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

Linux Based USB Devices

Write custom Linux kernel module. Provides the power to do sophisticated things like emulating a file system etc.

Use USB bus as a high speed serial port. Implemented in the Linux kernel for Strong ARM processors. Straightforward approach and mostly used.

Ethernet over USB. Linux has modules to implement both the host and device sides of this capability. The Linux kernel for the iPAQ uses this, since the iPAQ hardware has neither an accessible serial port nor a dedicated network interface.

Note: Correct approach depends on how much time one wants to spend in development and how we want our embedded application to use the USB interface.

Page 24: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

Why Linux for using USB?

Linux not only contains drivers for host controllers, but for device controllers as well.

These controller drivers enable Linux-based embedded systems to use USB to communicate with a host computer (which may or may not be running Linux as well).

USB communications under Linux are flexible and easy to use.

Page 25: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

USB: The Road Ahead

Micro USB has recently arrived in market. Same port for charging and wired connectivity. Caters to the demands of the reducing size of devices.

USB 3.0

Page 26: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

References

Jan Axelson, USB Complete Everything You Need to Develop Custom USB Peripherals, 3rd edition

John Hyde, USB Design by Example A Practical Guide to Building IO Devices, 2nd Edition

Datasheets – ATMega32, ATMega32U4, FT232

http://www.embedded.com

http://www.usbmadesimple.co.uk/

http://www.everythingusb.com/

http://www.embedded-computing.com/

http://www.lvr.com/usb.htm

Page 27: USB for Embedded Devicescourses.daiict.ac.in/pluginfile.php/5862/mod_resource/... · 2009. 7. 21. · Mohit Maheshwari 200601008 Prashant Garg 200601144. USB : An Introduction

Thank You !!