180 likes | 417 Views
Communication. We have 3 implemented protocols in our project: Serial Communication Protocol. USB HID Communication Protocol. USB Smart Card Communication Protocol. Serial Communication Protocol. Features: Data Rate: Serial runs at up to 115kbps . Number of devices: limited number .
E N D
Communication • We have 3 implemented protocols in our project: • Serial Communication Protocol. • USB HID Communication Protocol. • USB Smart Card Communication Protocol.
Serial Communication Protocol • Features: • Data Rate: Serial runs at up to 115kbps. • Number of devices: limited number. • Power: Two data lines, • one transmission • one receive line which means there is no bus for power . • Data Rate: 1byte is transmitted at time • Flexibility: • User should select the com port that connected to the device . • Truly Plug & Play: no • Hot-Swappable: no
USB Communication Protocols • According to the serial limitation we prefer to use the USB protocol: • Higher Speed: • USB 1 : up to 1.5 Mbit/s • USB 2 : up to 480 Mbit/s • USB 3 : up to 5 Gbit/s • Multiple Devices. • Flexible to search and connect to the desired device. • Self-Powered. • Truly Plug & Play. • Hot-Swappable.
USB Communication Protocols Host Side Device Side Application Layer Application Layer Virtual Path LCD RTOS AES Flashing Leds File System
USB Communication Protocols Host Side Device Side Encrypt data Decrypt data Application Layer Application Layer Virtual Path Encrypted data Decrypted data LCD RTOS AES Flashing Leds File System
USB Communication Protocols Host Side Device Side Application Layer Application Layer Virtual Path APIs APIs Class Layer Transfer Layer Virtual Path send receive Connect Disconnect On Device change send receive
USB Communication Protocols Host Side Device Side Application Layer Application Layer Virtual Path send send receive receive Class Layer Transfer Layer Virtual Path
USB Communication Protocols Host Side Device Side Application Layer Application Layer Virtual Path Class Layer Transfer Layer Virtual Path Configuration Layer Windows Libraries Layer Physical Path
USB Communication Protocols Host Side Device Side Application Layer Application Layer Virtual Path Class Layer Transfer Layer Virtual Path Configuration Layer Windows Libraries Layer Physical Path
Initialize Hardware Peripherals Initialize Hardware Peripherals • UDP (USB Device Peripheral) • AIC (Advanced Interrupt Controller) • PIO (Parallel input Output Controller) • PMC (Power Management Controller) Configuration Layer Driver Descriptor Implementation Driver Descriptor Implementation • Driver Descriptor { • Device Descriptor • Configuration Descriptors • Qualifier Descriptor • Other Speed config. Descriptors • Interface Descriptor • class descriptor • String Descriptors • } VBUS configure Check if USB is configured Transfer Send/Receive
===>Configuration Descriptor<=== ===>Device Descriptor<=== ===>Interface Descriptor<=== =>Smart Card Class Descriptor<= =>HID Class Descriptor<= Driver Descriptor Contain other Descriptors
Initialize Hardware Peripherals Driver Descriptor Implementation • The Device wait until it becomes in the configured state. After receiving acknowledgement from host with the selected configuration and alternate settings. VBUS configure VBUS configure • Configure PMC (Power Management Controller) for VBUS .Enable PIO (Parallel input Output Controller) Interrupt .VBUS is present . Connect . Check if USB is configured Check if USB is configured NO • Now the Device is in the Configured state and ready for transactions. • In HID : Transactions are by Report exchanging. • In Smart Card : Transactions are by bulk messages exchanging. YES Transfer Send/Receive Transfer Send/Receive
USB Device is attached Host determines the exact nature of change by querying the hub. Host waits for 100 ms to allow completion of insertion process
After the 100 ms of insertion, host enables the port and reset it. • enables the port: make the device in Powered state. • reset the port: make the device in Default state. • The obtained power is either:from External Source “self-powered” or from USB port “Bus-powered”
After resetting the port, The device is in it’s default state. Waiting for the host to assign a unique address to him …
Host assign a unique address to the device. Waiting for configuration … Before the Device receives the unique address. It’s default CTRL pipe is accessible via the “Default address”.
Host configures the Device • Host reads the device “descriptors” to obtain: • The max. payload size. • Configuration info. • Based on “the configuration info” and how USB device will be used, Host gives configuration values.
In order to conserve power. USB device automatically enter suspended state when it observe no bus traffic for a specified period. Maintains any internal states, address, configuration. • Hub port is disabled. At any bus activity, the device will wake up and send an electrical signal to the host to re enable the hub port.