ARM Cortex core microcontrollers

Similar documents
Understand USB (in Linux)

Part 1 - Introduction to USB

Serial Communications

Serial Communications

Universal Serial Bus - USB 2.0

USB Compliance Checklist

RINGDALE USB (UNIVERSAL SERIAL BUS) HID RELAY CONTROLLER (1543)

Device Wire Adapter (DWA) Test Specification. Designed using the Certified Wireless USB Base Specification, Revision 1.0

SERIAL BUS COMMUNICATION PROTOCOLS USB

Chapter 11: Input/Output Organisation. Lesson 17: Standard I/O buses USB (Universal Serial Bus) and IEEE1394 FireWire Buses

ID 221C: USB for Embedded Systems Viewed from the Embedded Target Side

Hubs: the Link between Devices and the Host

STUDY, DESIGN AND SIMULATION OF FPGA BASED USB 2.0 DEVICE CONTROLLER

David Harrison, Design Engineer for Model Sounds Inc.

How to fix Usually Slightly Broken devices and drivers?

Debugging Usually Slightly Broken Devices and Drivers

Universal Serial Bus Device Class Definition for Mass Storage Devices

Microprocessors LCD Parallel Port USB Port

S1R72U06 Technical Manual

ECE 471 Embedded Systems Lecture 30

Signals and Encoding

UC20 WinCE USB Driver

PL-25A1 Hi-Speed USB Host-to-Host Bridge Controller (Chip Revision B) Product Datasheet

Testing and Debugging

EECE494: Computer Bus and SoC Interfacing. USB (Universal Series Bus) Dr. Charles Kim Electrical and Computer Engineering Howard University

USB Complete. The Developer's Guide Fifth Edition. Jan Axelson. Lakeview Research LLC Madison, WI 53704

USB INTERFACE SPECIFICATION

PL-2507 Hi-Speed USB 2.0 to IDE Bridge Controller Preliminary Datasheet

Revealing Embedded Fingerprints: Deriving Intelligence from USB Stack Interactions

USB Framework, IP Core and related software Tropea S.E., Melo R.A.

Application Note. 32-bit Cortex -M0 MCU NuMicro Family. Application Note of NUVOTON 32-bit NuMicro Family

TP-Link USB Port Hub Model UH700 Power 12V==2A

Interrupt transfers & USB 2.0 & USB 3.0. Group Members Mehwish Awan Mehwish Kiran

Course 10: Interfaces Agenda

Digital Logic Level. Buses PCI (..continued) PTE MIK MIT

USB. The Universal Serial Bus. Most of the material is taken from Jan Axelsson: USB Complete, third edition Lakeview Research ISBN:

USB: Features and Circuits Manoj Purohit ( ) Supervisor: Prof P.C.Pandey

Certified Wireless USB Wire Adapter Model

Design Of Linux USB Device Driver For LPC2148 Based Data Acquisition System Including GSM.

AN2554. Creating a Multi-LUN USB Mass Storage Class Device Using the MPLAB Harmony USB Device Stack INTRODUCTION CONTROL TRANSFERS

USB for Embedded Devices. Mohit Maheshwari Prashant Garg

USS-720 Instant USB USB-to-IEEE* 1284 Bridge

More on IO: The Universal Serial Bus (USB)

Application Note AN_164. Vinculum-II USB Slave. Writing a Function Driver

PL-2305 USB to Printer Bridge Controller (Chip Rev I) Product Datasheet

M Tech credit seminar report, Electronic Systems group, EE Dept, IIT Bombay, submitted Nov 2002 UNIVERSAL SERIAL BUS

Future Technology Devices International Ltd. Application Note AN_168. Vinculum-II USB Slave. Customizing an FT232 Device

4 Multiplexer. Y Fig Keyboard Scan Matrix

Today s Schedule. USB 2.0 Overview. USB 2.0 Compliance Testing. Demo of the Agilent Solution Q&A

Computer Peripherals

Human Interface Devices: Using Control and Interrupt Transfers

CM6120-S Best USB Audio Single Chip for PC Speakers Solution

USB Compliance Checklist Hubs (Excluding Root Hubs) USB Device Product Information

An Introduction to Universal Serial Bus

Universal Serial Bus Device Class Definition for Printing Devices

Universal Serial Bus Device Class Definition Billboard Devices

USB 2.0 Hi-speed Peripheral Compliance Test Report

Using the Intel 8x930Ax USB Microcontroller

Troubleshooting USB 2.0 Problems with Your Oscilloscope APPLICATION NOTE

SL811HS Embedded USB Host/Slave Controller

Universal Serial Bus Device Class Definition For Content Security Devices

USB 2.0 High-Speed Peripheral Compliance Test Report

Embedded USB Drive. Preliminary Release. Revision History. July 14, 2006

USB 2.0 Test Report For Peripheral

SL811HS Embedded USB Host/Slave Controller

Universal Serial Bus Host Interface on an FPGA

I/O Management Software. Chapter 5

Introduction to USB/LPC23xx

Raspberry Pi - I/O Interfaces

Embedded USB Host/Slave Controller

PL-2507C Hi-Speed USB 2.0 to IDE Bridge Controller Product Datasheet

INTERNATIONAL STANDARD

PL-2533 Hi-Speed USB MS PRO / MS / SD / MMC Card Reader Controller IC Product Datasheet

Virtualised USB Fuzzing using QEMU and Scapy

AN USB HID Intermediate with PSoC 3 and PSoC 5LP. Contents. 1 Introduction

TRIBHUVAN UNIVERSITY

USB (Universal Serial Bus) Presentation to UCHUG - 2/06/08 G. Skalka

ADVANCED OPERATING SYSTEMS USB in a microkernel based operating system

Application Note: AN00136 USB Vendor Specific Device

Computer Engineering Laboratory. MSc THESIS. PDP8 meets USB

CM6327A USB Single-Chip Audio Solution for Mono Microphone

USB 2.0 Application Software

Revision History. Rev Date Details A October 14, 2008 New release of Short and Legacy eusb Spec with SM325AC controller

Creating a USB Audio Device on a PIC32 MCU Using MPLAB Harmony

This process is a fundamental step for every USB device, fore without it, the device would never be able to be used by the OS.

USB2.0 Type-C & Regular USB Device Electrical Compliance test procedure

Ellisys USB 2.0 Protocol Analyzer

Compliance test method and detailed spec for - USB2.0. Tektronix Korea YJ.PARK

Designing A Low Cost USB-PS/2 Combination Interface Mouse with the Cypress Semiconductor CY7C63723 encore USB Microcontroller

USB2.0 - Device. Universal Serial Bus Measurement

Designing a Low-Cost USB Interface for an Uninterruptable Power Supply with the Cypress Semiconductor CY7C63001 USB Controller

USB 2.0 Application Software

FR80 Family 32-BIT MICROCONTROLLER MB91F662. SK-FR80-120PMC-USB bits pot black USB board User's Manual

CM6327A USB Audio Single Chip Solution for Mono Microphone

MQP Packet-Master USB12. User Manual

Using the HT66FB5x0 for 2D Joystick Applications C Language Example

Universal Serial Bus Host Stack User s Manual V3.41

SMART MODULAR eusb Drive

* USB Full-Speed Hub Controller

USB Function IP Core. Author: Rudolf Usselmann

Transcription:

ARM Cortex core microcontrollers 11 th Universal Serial Bus Balázs Scherer Budapest University of Technology and Economics Department of Measurement and Information Systems BME-MIT 2017

Goals Cheap standardized interface for PC peripherals (mouse, keyboard ). Originally designed for low data rate communication. Designed for low wire count, and power should be transited through the cable Ability to connect many devices Easy to use from the user s point of view Plug & Play operation, with dynamic driver loading Start of the development: 1994 Intel, Microsoft, IBM, Compaq, NEC Community: USB IF USB Implementers Forum BME-MIT 2017 2.

Versions 1996 USB 1.0 (not getting widespread) There is no hub support 1998 USB 1.1 Low speed: 1.5 Mbit/sec Full speed: 12 Mbit/sec 2001 USB 2.0 High speed: 480 Mbit/sec Low-/High-power: 100 ma/500 ma BME-MIT 2017 3.

Versions 2008 USB 3.0 Super-Speed: 5Gbit/sec (4 Gbit/sec effective bit rate) Low/high power mode: 150 ma/900 ma Battery charger mode (without communication) 1500 ma First devices appears on the market: 2010 OS támogatás: Linux, Windows 8 2013 USB 3.1 Speed increases to 10 Gbit/sec-re BME-MIT 2017 4.

Architecure Tired star structure. 3-7 layers (tier): (root + maximum 6 tiers) Master Slave communication: Hub only forwards data Messages of the host is visible to every node Peripheral answers are routed only towards the Host Host-device (master), 1..127 device (slave) One HW more address: compound decive Different functions on one address: composite device BME-MIT 2017 5.

Connectors: A-type: Host side B- type: Device side Max. 5 m-es 2.0 cable lenfgth Cables and connectors Wires: 5V Power/Ground (Red/Black). Twisted pair data: : D-/D+ (white/green) Maximum 3 m cable length for 3.0 o Additional +2 twisted pair BME-MIT 2017 6.

Data Flow USB 2.0 3.0 Physical layers: PCIe based Data link layer: based on PCIe Protocol layers: modified USB 2.0 Device/Host level: standardised BME-MIT 2017 7.

Data Flow USB 2.0 3.0 BME-MIT 2017 8.

Physical layer USB 2.0 Upstream (host side) and downstream (devise side) interface Full speed: D+ pull up Differential 1: D+ high, D- low Differential 0: D+ low, D- high NRZI: singnal change to bit 0 Bit stuff: after 6 db logical 1 one logical 0 BME-MIT 2017 9.

Power supply Type is descripted in the device configuration Low-power bus powered: 4.4-5.25V, maximum 100 ma High-power bus powered: In configurated state maximum 500 ma, 4.75-5.25 V Self-powered Shut down state: low/high-powered 0.5 ma/2.5 ma USB 3.0: Low/high powered: 150 ma/900 ma Buttery charging mode: 1.5 A, there is no communication BME-MIT 2017 10.

Physical layer USB 2.0 Bus sates: Full/High Low D+ D- D+ D- LS/FS SE1 1 1 1 1 Forbidded SE0 0 0 0 0 liket Detached J-State 1 0 0 1 like Idle K-State 0 1 1 0 oposit of J K is the driven state Reset signal: > 10 ms SE0 (Single Ended 0) EOP: End of packet: LS/FS: 2xSE0 + 1xJ, HS: bit stuff error on purpose Suspend: >= 3 ms Idle Keep Alive: LS: EOP, FS: StartOfFrame packet WakeUp: >= 20 ms K (remote wake-up: device wakes up the host) BME-MIT 2017 11.

Physical layer: speed detection Getting more and more complicated due to compatibility Low/Full Speed: based on pull up resistors High speed: based on protocol BME-MIT 2017 12.

USB On The Go The master slave extension to embedded devices: Detecting the connection without power supplying. Capacitance measurement: Attach Detection Protocol Embedded device can operate as Device or Host (For example. Camera can be a device if connected to a PC or can be a master if a pendrive is connected to it Host Negotiation Protocol Device can request the host to switch on power Session Request Protocol BME-MIT 2017 13.

There are endpoints Data transfer modes There are endpoints between logical channels: pipe. max. 32 endpoint is allowed pro device o Message pipe: bidirectiona, only control transfer using endpoint 0. o Stream pipe: unidirectional Stream transfer types Many data Error free Real-time Bulk + + - Isochron + - + Interrupt - + + BME-MIT 2017 14.

Endpoints and devices BME-MIT 2017 15.

Transfers and transactions The USB transfer consists of transactions Transactions consist of multiple packets Always the Master starts the Transfer The Frame is consists of transfers One frame is 1ms long One frame is 1500 byte in case of FS mode BME-MIT 2017 16.

Data transer The transfer build up from transactions One Transaction is build up from packets: o Token: header packet, determines the type of the transaction o Data: optional data o Handshake: state information. Isochron transfer do not use it USB Packet: SYNC PID Data CRC EOP o SYNC clock syncronisation (8/32 bit LS-FS/HS) o PID: Packet ID 4 bit, also transmitted in inverted mode o DATA/CRC: PID packet dependent o EOP: end of packet BME-MIT 2017 17.

USB packets PID Type PID Name PID<3:0>* OUT 0001b Token IN 1001b SOF 0101b SETUP 1101b DATA0 0011b Data DATA1 1011b DATA2 0111b MDATA 1111b ACK 0010b Handshake NAK 1010b STALL 1110b NYET 0110b PRE 1100b ERR 1100b Special SPLIT 1000b PING 0100b Reserved 0000b Transfer is supported by hardware: fast PID decoding LSB first data trasnfer BME-MIT 2017 18.

TOKEN packets IN,OUT: direction of the transfer from the Host s point of view SETUP: Control transfer Sync PID ADDR ENDP CRC5 EOP The address 0. is allocated to a new device connection, the End Point 0. is allocated to SETUP packets SOF: Start of Frame: 8 bits 7 bits 4 bits 5 bits Sync PID Frame No. CRC5 EOP 8 bits 11 bits 5 bits LS: KeepAlive = EOP signal only FS: 1 ms time limit HS: 125 us microframe boundary BME-MIT 2017 19.

DATA packets DATA0/1: LS/FS transmitted in an alternate style DATA2, MDATA: only used to HS isochron transfers Sync PID DATA CRC16 EOP 8 bits (0-1024) x 8 bits 16 bits BME-MIT 2017 20.

Transfers BME-MIT 2017 21.

Transfers Payload size: LS FS HS Control 8 64 64 Bulk -- 64 512 Isochron -- 1023 1024 Interrupt 8 64 1024 BME-MIT 2017 22.

Example transfer Countrol OUT Transfer example: Setup, Data, Handshake BME-MIT 2017 23.

Example transfer Countrol IN Transfer: Setup, Data, Handshake BME-MIT 2017 24.

A real Control IN transfer example BME-MIT 2017 25.

Example transfer Bulk and Interupt Transfer: IN/OUT, Data, Handshake BME-MIT 2017 26.

Example transfer: Interupt BME-MIT 2017 27.

Example transfer Isochron transfer: IN/OUT, Data BME-MIT 2017 28.

Example transfer: isochron BME-MIT 2017 29.

Different peripheral types requires different transfer types BME-MIT 2017 30.

Transfers in Frames The isochrone and interrupt transfers has priority o Maximum of 90% of the frame can be such transfers If a new peripheral request interrupt or isochron transfers resulting a frame utilization more then 90% of such transfers, than the new device is not allowed to connect In the remaining 10% the control transfer has priority Remaining data bandwidth: Bulk BME-MIT 2017 31.

Frames Frame example Example for a typical frame BME-MIT 2017 32.

More detailed example BME-MIT 2017 33.

Connecting a new device Detecting the speed and protocol: Pull up resistor or K-Chirp Reset, the device listen on address 0 Address 0. End Point 0. GetDeviceDescriptor: Detecting the maximum packet size Reset, SetAddress Device, Configuration és String descriptor download Driver loading SetConfiguration BME-MIT 2017 34.

Device: unique Configuration: there is only one active (rare to have more than one) Interface: for composit devices: paralelly more than one functions: (VOIP phones) Descriptors BME-MIT 2017 35.

Every device has one Main information Device descriptor o USB revision number o Product ID o Vendor ID o Number of configuration descriptions Loading the driver based on Product ID and Vendor ID BME-MIT 2017 36.

Offset Field Size Value Description Device descriptor 0 blength 1 Number Size of the Descriptor in Bytes (18) 1 bdescriptortype 1 Constant Device Descriptor (0x01) 2 bcdusb 2BCD USB Specification Number which device complies too. 4 bdeviceclass 1 Class Class Code (by USB Org) If equal to Zero, each interface specifies it s own class code If equal to 0xFF, the class code is vendor specified. Otherwise field is valid Class Code. 5 bdevicesubclass 1 SubClass Subclass Code (by USB Org) 6 bdeviceprotocol 1 Protocol Protocol Code (by USB Org) 7 bmaxpacketsize 1Number Maximum Packet Size for Zero Endpoint. Valid Sizes are 8, 16, 32, 64 8 idvendor 2 ID Vendor ID (by USB Org) 10 idproduct 2 ID Product ID (by Manufacturer) 12 bcddevice 2 BCD Device Release Number 14 imanufacturer 1Index Index of Manufacturer String Descriptor 15 iproduct 1 Index Index of Product String Descriptor const uint8_t DeviceDescriptor[SIZ_DEVICE_DESC] = { SIZ_DEVICE_DESC, /* blength */ 0x01, /* bdescriptortype */ 0x00, /* bcdusb, version 2.00 */ 0x02, 0x00, /* bdeviceclass : each interface define the device class 0x00, /* bdevicesubclass */ 0x00, /* bdeviceprotocol */ 0x40, /* bmaxpacketsize0 0x40 = 64 */ 0x83, /* idvendor (0483) */ 0x04, 0x21, /* idproduct */ 0x57, 0x00, /* bcddevice 2.00*/ 0x02, 1, /* index of string Manufacturer */ /**/ 2, /* index of string descriptor of product*/ /* */ 3, /* */ /* */ /* */ 0x01 /*bnumconfigurations */ }; 16 iserialnumber 1Index Index of Serial Number String Descriptor 17 bnumconfiguratio 1Integer Number of Possible Configurations ns BME-MIT 2017 37.

Base Class Device class codes Descriptor Usage Description 00h Device Use class information in the Interface Descriptors 01h Interface Audio 02h Both Communications and CDC Control 03h Interface HID (Human Interface Device) 05h Interface Physical 06h Interface Image 07h Interface Printer 08h Interface Mass Storage 09h Device Hub 0Ah Interface CDC-Data 0Bh Interface Smart Card 0Dh Interface Content Security 0Eh Interface Video 0Fh Interface Personal Healthcare 10h Interface Audio/Video Devices DCh Both Diagnostic Device E0h Interface Wireless Controller EFh Both Miscellaneous FEh Interface Application Specific FFh Both Vendor Specific BME-MIT 2017 38.

Configuration descriptor What type of interfaces has the device What is the power requirement Only one configuration can be active Host can switch between configurations BME-MIT 2017 39.

Interface descriptor The interface organize the endpoints based on function, One interface support one functionality. There are multifunctional devices with more interfaces For example: multifuncton Fax/scanner/printer o Interface 1: fax function o Interface 2: Scanner function o Interface 3: printer function Many interface can be active in the same type BME-MIT 2017 40.

Describes the endpoint s o type o direction o Polling intervalum o Max packet size Endpoint descriptor The endpoint 0 always present and always a control endpoint BME-MIT 2017 41.

FTDI USB in embedded systems o FT2xxx : Serial-USB converter (VCP) (FS,HS) o Vinculum: providing some host functions (FS) Native USB o Firmware library-t from the microcontroller manufacturer o Third party sollutions PC side: o There is no need for own driver in case of popular classes, like HID devices o Vendor specific device: libusb32 driver library LabVIEW: VISA Driver wizard BME-MIT 2017 42.

Handling a Vendor specific USB device in LabVIEW 1. VISA Driver wizard: Creating a driver o http://www.ni.com/tutorial/4478/en/ o Vendor and Product ID based BME-MIT 2017 43.

Handling a Vendor specific USB device in LabVIEW 2. Using MAX (Measurement Automation Explorer) to try out connection o Recognize the device and provides a general purpose user control BME-MIT 2017 44.

Handling a Vendor specific USB device in LabVIEW 3. Controller program in LabVIEW o VISA communication based examples Control, Iterrupt, Bulk o A simple Control example BME-MIT 2017 45.

Usefull links http://www.usb.org/developers/ http://en.wikipedia.org/wiki/universal_serial_bus http://www.usbmadesimple.co.uk/ http://www.beyondlogic.org/usbnutshell/usb1.shtml http://www.ftdichip.com http://sourceforge.net/apps/trac/libusb-win32/wiki BME-MIT 2017 46.