www.Walzer.cn - Tech & Management Blog

Focus on mobile dev
本博客文章,未在标题中写明转载的, 均为原创.
所谓高手,也就是熟悉别人制定的游戏规则、并且能在规则内跳舞的人。
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Power on detection of USB

Posted on 2006-02-05 11:54  Walzer  阅读(1368)  评论(0编辑  收藏  举报
Author: Walzer
Date:     2005.6.10

The USB SPEC 2.0 Section 7.1.7.3 “Connect and Disconnect Signaling” says "A connect condition will be detected when the hub detects that one of the data lines is pulled above its VIH threshold for more than TDCNN"

//Copyed from USB 2.0 Spec.
This Figure 7-27 below describes the connect detection of our full-speed device, that is, pull up D+ line above Vih threshold, and hold it more than the time Tdcmn..



For low-speed devices, just exchange the D+ and D- mark in the figure above. It detect the pulling-up of D- instead of D+. Actually, I haven’t seen a low-speed usb device yet. It must be valuable to add into your collection or can be contributed to a museum~~~

Figure 7-29 in USB SPEC 2.0 shows all the events associated with both turning on port power with a device connected and hot-plugging a device. The details below are copied from the spec.



∆t1 This is the amount of time required for the hub port power switch to operate. This delay is a function of the type of hub port switch. Hubs report this time in the hub descriptor (see Section 11.15.2.1), which can be read via a request to the Hub Controller (see Section 11.16.2.4). If a device were plugged into a nonswitched or already-switched on port, ∆t1 is equal to zero.
∆t2 (TSIGATT) This is the maximum time from when VBUS is up to valid level (4.01 V) to when a device has to signal attach. ∆t2 represents the time required for the device’s internal power rail to stabilize and for D+ or D- to reach VIH (min) at the hub. ∆t2 must be less than 100 ms for all hub and device implementations. (This requirement only applies if the device is drawing power from the bus.)
∆t3 (TATTDB) This is a debounce interval with a minimum duration of 100 ms that is provided by the USB System Software. It ensures that the electrical and mechanical connection is stable before software attempts to reset the attached device. The interval starts when the USB System Software is notified of a connection detection. The interval restarts if there is a disconnect. The debounce interval ensures that power is stable at the device for at least 100 ms before any requests will be sent to the device.
∆t4 (T2SUSP) Anytime a device observes no bus activity, it must obey the rules of going into suspend (see Section 7.1.7.6).
∆t5 (TDRST) This is the period of time hubs drive reset to a device. Refer to Section 7.1.7.5 and
Section 11.5.1.5 for details.
∆t6 (TRSTRCY) The USB System Software guarantees a minimum of 10 ms for reset recovery. Device
response to any bus transactions addressed to the default device address during the reset recovery time is undefined.

//Walzer Remark
So the AttachDetected is at the standpoint of HOST. When the host detected an attachment on a port, a specific bit must be changed in Interrupt Status Register. If you are running in interrupt mode, this change must cause the system go into the interrupt service thread. Or if you are running in polling mode, this change can cause the polling detect it and do something except spin forever.