Post on 14-Apr-2018
7/27/2019 6.-Sistemas Basados en El Conocimiento
1/21
Universidad de HunucoSistemas Basados en el
Conocimiento
Instructor: Dr. Aland Bravo Vecorena
7/27/2019 6.-Sistemas Basados en El Conocimiento
2/21
Interfaces USB
USB
Creado por Intel en el ao 1994, versin 1.0.
En el ao 1998 se lanza la versin 1.1 con una velocidad de
transferencia baja de 1.5 Mbps y a full capacidad de 12 Mbps.
En el ao 2000, se lanza la versin 2.0 de alta capacidad con 480 Mbps.
7/27/2019 6.-Sistemas Basados en El Conocimiento
3/21
USB: Bus Serial Universal
Auto dteccin & configuraion (Plug&Play)
Energa en el Bus
3 velocidades: Low- 1.5 Mbps, Full- 12 Mbps,
High- 480 Megabits/second
RS232
Paralelo
PS/2
Tipos de
Aplicacin
Extend the functionality of
your computer!
Data Analysis,
Data Logging,
Firmware Updates,
Diagnostics,
Embedded Applications!
7/27/2019 6.-Sistemas Basados en El Conocimiento
4/21
Caractersticas del USB
NRZI Data Encoding
Half duplex data transmission can go in only one direction at a time
Bus Power to each device:
4.40 - 5.25 V
Guaranteed 100 mA
500 mA maximum through negotiation
~ 5.0 V
~ 3.3 V
VBUS
D+
D-
GND
VBUS
D+
D-
GND
4-wire
connection
Differential
Signaling
7/27/2019 6.-Sistemas Basados en El Conocimiento
5/21
Caractersticas del USB
mini-B Plug
FS, HS PeripheralB Plug
FS, HS Peripheral
A Plug
USB Host
7/27/2019 6.-Sistemas Basados en El Conocimiento
6/21
Caractersticas del USB
Guaranteed Latency Guaranteed Data
Integrity
Interrupt
Bulk
Isochronous
PIC18F4550 family supports all these transfer types.
7/27/2019 6.-Sistemas Basados en El Conocimiento
7/21
USB Pipes
HOST PC
Big USB Pipe12Mb/s
Small Pipe to each USBdevice (up to 127)
Tiny Pipes (endpoints)
7/27/2019 6.-Sistemas Basados en El Conocimiento
8/21
Client Software Function
Client
Software
Interface
USB Device
Host
Endpoints
Data Flows
Buffers
Pipes
7/27/2019 6.-Sistemas Basados en El Conocimiento
9/21
El Dispositivo Lgico
Device(Manufacturer: Microchip Technology)(Product: Mouse in a Circle Demo)
Configuration
Interface
IN (Endpoint 0)USB System Software
(default control pipes)
USB Device-Specific Pipe(s)
(Human Interface Device)
HID TX/RX Functions
(MCHPFSUSB FW)
Analog/Digital I/O
OUT (Endpoint 0)
IN (Endpoint x)
OUT (Endpoint x)
These settings arerepresented by aDevice DescriptorTable, stored infirmware.
7/27/2019 6.-Sistemas Basados en El Conocimiento
10/21
Trama USB
BULK
BULK
BULK
BULK
BULK
BULK
BULK
BULK
Tx
Voice
Tx
Line
Inte
rrupt,
Con
trol,
Low
Spe
ed
Trame = 1ms
Stereo Audio
Stereo Audio
Stereo Audio
Stereo Audio
Stereo Audio
Stereo Audio
Stereo Audio
Stereo Audio
Stereo Audio
Stereo Audio
Rx
Voice
Rx
Line
Slot
SOF
Low Speed
Low Speed
BULK
BULK
Scanner
7/27/2019 6.-Sistemas Basados en El Conocimiento
11/21
Perifricos USB
11
Joystick
Mouse
SD CardReader
MCHP
RS-232
Data
LoggerUPS
Keyboar
d
Generic
Human Interface Device
Class (HID)
Mass Storage
Device Class (MSD)
Communication
Device Class (CDC)
Digitizer
WinUSBLibUSB
Custom Class(Vendor Class)
Audio
Class
MIDI
Speaker
7/27/2019 6.-Sistemas Basados en El Conocimiento
12/21
El Proceso de Enumeracin
DETACHED
POWEREDPower
(self/bus)
DEFAULT
Bus
reset
ADDRESS
Get Device
Descriptor
CONFIGURED
Get
Descriptors
ATTACHED
Cable
ConnectedSUSPENDED
7/27/2019 6.-Sistemas Basados en El Conocimiento
13/21
Auto Deteccin: Full Velocidad
+5V
D+
D-
GND
Transceiver
USB
Connector
Peripheral Device
VUSB 3.3 VFull Speed Identification
D+ line pull-up
1.5k5%
USB PICMCU
7/27/2019 6.-Sistemas Basados en El Conocimiento
14/21
Auto Deteccin: Baja Velocidad
+5V
D+
D-
GND
Transceiver
USBConnector
Peripheral Device
VUSB 3.3 VLow Speed Identification
D- line pull-up
1.5k5%
USB PICMCU
7/27/2019 6.-Sistemas Basados en El Conocimiento
15/21
On-chip Pull-up Resistors
+5V
D+
D-
GND
Transceiver
USB
Connector
Peripheral Device
VUSB 3.3 V
On-chip pull-up resistors
available!
USB PICMCU
7/27/2019 6.-Sistemas Basados en El Conocimiento
16/21
Address and Configuration: EP0
See Chapter 9 in USB 2.0 Spec for more info.
Other Endpoints
Endpoint 0 IN(Control Data)
Endpoint 0 OUT(Control Data)
Dual Port/Access RAM
Descriptors
Control Transfers
USB PICMCU
7/27/2019 6.-Sistemas Basados en El Conocimiento
17/21
Descriptores
Device
Configuration 1
Interface 0
Endpoint
Interface 1
Endpoint Endpoint Endpoint
To other Configurations if any
To other Interfaces
if any
String 0
String 1
String N
l Descriptors are typically stored in non-volatile/Flash memory
7/27/2019 6.-Sistemas Basados en El Conocimiento
18/21
Descriptors - Example
PICDEM USB
Microchip
Device
Configuration 1
Interface 0
Endpoint
Manu. String
Prod. String
USB 2.0, VID = 0x04D8,
PID = 0x0007, Num. Configurations,
Strings?
Configuration #1: Bus-Powered,Remote Wakeup, 500mA, Num.
Interfaces
Interface #0: HID Class, Num. Endpoints
Endpoint 1 IN, Interrupt Transfer Type,
64-byte buffer, Poll every 3 ms
UnicodeCharacters
Go USB!
Other String
7/27/2019 6.-Sistemas Basados en El Conocimiento
19/21
MCHPFSUSB Software Framework
- Device Descriptor Table -
usb_descriptors.cDescriptors
VID & PID
Class Specific/* Device Descriptor */ROM USB_DEVICE_DESCRIPTOR device_dsc={ 0x12, // Size of this descriptor in bytes
USB_DESCRIPTOR_DEVICE, // DEVICE descriptor type0x0200, // USB Spec Release Number
CDC_DEVICE, // Class Code0x00, // Subclass code0x00, // Protocol codeEP0_BUFF_SIZE, // Max packet size for EP0,0x04D8, // Microchip Vendor ID0x000C, // Product ID ID
7/27/2019 6.-Sistemas Basados en El Conocimiento
20/21
CDCRS-232 Emulation
PC ComputerPIC Microcontroller
USB Cable
Hyper TerminalCDC
INF File Required(Supplied in MCHPSUSB)
Standard Windows Drivers
Design Considerations: ~80 KB/s max
Bulk Transfers
PC applications can access the device as though it
is connected to a serial COM port
7/27/2019 6.-Sistemas Basados en El Conocimiento
21/21
Acerca del Curso
Presentacin en clase con PPT.
Laboratorio en Matlab, Proteus y MPLAB.
Proyectos de Investigacin:
SBC1: Espectro de Fourier de una Seal ECG. SBC2: Espectro Wavelet de una Seal ECG.
SBC3: Red Neuronal para Deteccin de Anomalas
Cardacas de una Seal ECG
SBC4: Deteccin de Segmento QRS de una Seal ECG.
Trabajos de Laboratorio:
Sistema de Anlisis ECG.
Sistema de Control de Motor Trifsico.
Estacin Meteorolgica.