usb host for web camera connection midterm presentation presenters: alexander shapiro sergey...

24
USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems Lab

Upload: joseph-willis-foster

Post on 26-Dec-2015

217 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

USB host for web camera

connection

Midterm presentation

Presenters:

Alexander Shapiro

Sergey Alexandrov

Supervisor:

Mike Sumszyk

High Speed Digital Systems Lab

Page 2: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

Agenda

Project Objectives.System Architecture.USB Basics and general protocol.ISP1362 specific protocol.Implementation.Timeline.

Page 3: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

Project Objectives

Implementation of SOPC interface for USB webcam. Learn USB host protocol. Learn webcam protocol. Learn SOPC Development tools. Understand NIOS II architecture. Building NIOS II softcore system.

Stream real-time video to VGA.

Page 4: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

Development Environment

Altera DE2 board Provides USB support for host and device application. VGA output (up to1600 x 1200 at 100-Hz refresh rate).

Cyclone II FPGA Programmable chip to implement any design.

Programming tools: Quartus II Nios II IDE SOPC Builder

Page 5: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

System Architecture

Cyclone II FPGA

Philips ISP1362USB Controller

VGA D/A converter

USB 1.0 Port

VGA Port

On Chip Memory

NIOS IISoftCore

Avalon Switch

On- ChipMemory

InputUSB Philips ISP1362 controller.Transfer rate: 12 Mb/s.Optional: DE3 board with USB 2.0.

up to 480 Mb/s.

OutputVGA DAC (10-bit triple DACs).Up to 1600x1200 at 100-Hz.

Page 6: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

USB Basics

Host and ClientHost is master controller that initiates USB

connection and traffic. Host is responsible to serve and control all the clients.

Client is device that connects to the host. Clients are divided to defined classes, like video/audio class, HID, etc. Each class has generic and specific properties.

Page 7: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

USB Basics

TerminologySpeed - usb bus speed, full speed (USB1.1), high

speed (USB2) or low speed.Port is physical interface between host and client.

DE-2 has 2 USB-ports.Descriptor is data structure that resides in

client`s memory and describes different aspects of the device (speed, resolution, supported protocols etc.)

Page 8: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

USB Basics

Generic DescriptorsDevice Descriptor - contains basic device

description. (speed, brand, vendor)Configuration Descriptor – specifies device`s

features and abilities. Consists of Interface Descriptors that describe each separate feature. (device class, supported data transfers and formats, resolution and bit rate)

Page 9: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

USB Basics

Video Class Interface Descriptor:Describes Video interface.Endpoint Descriptors.

Defines ISO packet size and direction.

Video Format Descriptors. Defines streaming video format.

Video Frame Descriptors. Defines resolution and frame interval.

Page 10: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

USB generic protocol

When device is connectedHost initializes connection and determines

kind of the device.Host requests configuration descriptor.Probe and commit sequence.Host selects data interface.Device is configured and ready to work.

Page 11: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

USB generic protocol

When device is connectedHost initializes connection and determines

kind of the device. Host switches USB-port to operational mode. Host enumerates connected device. Host requests Device Descriptor. This stage is

needed to determine device speed and maximum packet size.

Page 12: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

USB generic protocol

When device is connectedHost requests configuration descriptor.

In this stage Host learns what kind of device is connected and what is abilities.

What services it provides, and at what rates. Number of configurations (Interface descriptors) Other basic information

Page 13: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

USB generic protocol

When device is connectedProbe and commit sequence.

Negotiation between Host and Video streaming interface.

Consists of Host`s requests with supported streaming parameters (bit rate, resolution) and Client`s confirmation/denial

When acceptable combination is obtained Host sends commit request on these parameters.

Page 14: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

USB generic protocol

When device is connectedHost selects data interface.

Host selects data interface that corresponds to committed parameters.

After this stage device is configured and ready to work.

Page 15: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

ISP1362 general description

Support Bulk, Control, Interrupt and ISO transfers.

Each transfer type has separate buffer. ATL, INT and ISTL0/1 and buffers.

Supports two USB ports. All interaction with Host is implemented with

read/write control registers that are mapped to NIOS memory for direct access.

Page 16: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

ISP1362 general description

Support Bulk, Control, Interrupt and ISO transfers.

Control - Used to get device description and configuration.

Bulk - Used for transferring big data chunks. Interrupt - Used for polling small data requests. Isochronous - Used for Audio/Video streams.

Page 17: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

ISP1362 general description

Philips Transfer Descriptor (PTD)Provides a communication channel between

Host controller and NIOS.Structure:

Header: Packet size. Type of request. Direction of transfer.

Payload: Data/Command. (only if required)

Page 18: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

ISP1362 general description

Typical data transfer in Bulk mode.

PTD 1 PTD 2 PTD 3

Nios to Host Nios to Host Host to Nios

Page 19: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

ISP1362 specific protocol

Host and device initialization: Buffer’s sizes must be set for all kinds of

traffic (ATL, ISTL0/1 and INT buffers). Ports must be powered up and enabled. Operational state must be entered in order

to allow USB traffic. Prior to this host is in suspended state.

Page 20: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

ISP1362 specific protocol

Host and device initialization: Init ATL, ISTL0/1 and INT buffers. Init USB port1 and port2.Enter operational mode.Detect device connection.Enable connected port1.EnumerateGet device description.Configure device.

ControlTransfer

mode

HostRegister

setup

Page 21: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

Project Timeline

Week Progress Challenges

1Explored development

environment

2Examined USB Host protocol

example of mouse specific functions.

No isochronous transfer support.

3Learned basic USB 1.1

Controller (Phillips ISP1362) Interface

4-5

Learned Webcam USB Protocol specification,

Descriptors and Video class requests.

Page 22: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

Project Timeline

6-9Adapted Mouse example to

work with webcam.

No success with ISO traffic. Very slow progress due to inconsistent

code in mouse example and lack of compatibility with webcam.

10-11Software and hardware debug

of USB protocol, to try and correct main issues.

12-13

All project rewrote from scratch using only relevant code and

consistent with embedded programming guide.

Week Progress Challenges

Page 23: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems

References

Philips Embedded Programming guide Philips ISP 1362 Data Sheet USB 2.0 Specification USB Video Class Specification USB Complete by Jan Axelson Google

Page 24: USB host for web camera connection Midterm presentation Presenters: Alexander Shapiro Sergey Alexandrov Supervisor: Mike Sumszyk High Speed Digital Systems