USB serial data is NRZI encoded prior to transmission
Non-Return to Zero Inverted
Signaling is differential
Helps to
Mitigate affects of noise on lines
Ensure data integrity
Configured as follows:
Detecting Device Attachment and Speed
Prior to transmission to client device
Host software must detect presence of device on bus
USB designed to automatically detect presence (absence) of device
When attached to (removed from) USB
Same mechanism used to determine speed of client device
Low speed or full speed
Detection
Detection accomplished by monitoring differential data lines
After cable power applied to port
When no device attached
Pull down resistors on D+ and D- ensure both data lines near ground
USB devices must provide pull-up resistor
On either D+ or D-
Based upon speed of device
D+ for full speed
D- for low speed
C onnections appear as
When device attached
Current flows through voltage divider
Pull-down is 15 K
Pull-up is 1.5 K
Signal on data line increases to about 90% of Vcc
When hub detects
One of data lines approaching Vcc
Other near ground
Knows device attached
By knowing which line is high
Can ascertain which kind of device has been attached
Thus when D+ or D- rises above 2.0 Vdc for greater than 2.5 sec
Device detected as attached
Removal detected when both lines
Fall below 0.8 Vdc for greater than 2.5 sec
When device attached or removed
Status bits set or reset to indicate state
Host software polls hub periodically to check for attachment or detachment
NRZI Encoding
Data transferred on USB
Encoded using NRZI encoding
Helps to ensure high data integrity without requiring clock
Such scheme has been used for many years
S cheme shown as
Data
Transitions in data stream represent 0s
No transitions represent 1s
Encoder
NRZI encoder must maintain synchronization with incoming data stream
To correctly sample bits
Data stream must be sampled within data window
To detect whether transition has occurred since last bit time
Decoder
Decoder samples data stream during each bit time
To check for transitions
Transitions in data stream
Permit decoder to maintain sync with incoming data
Observe
Long series of consecutive 1s
Results in no transitions
Eventually receiver will loose sync
Solution
Use bit stuffing
Bit Stuffing
Forces transitions into NRZI data stream
When 6 consecutive 1s encountered
Ensures receiver detects transition
Every 7th bit time
Enables receiver to maintain sync
Transmitter is responsible for inserting 0 bit into data stream
Differential Pair Signaling
As noted using differential pair signaling
Noise reduction etc
As implemented in USB
Uses half duplex scheme
Device on either end can receive or transmit
Only one direction at a time
Half duplex scheme
Requires drivers be placed into high impedance state
When not transmitting data
Two single ended receivers also used to detect bus states
E xample drivers look like the following
Share with your friends: |