APPARATUS AND METHOD FOR DETERMINING A DISCONNECTION OF A DEVICE FROM A BUS
20240104040 ยท 2024-03-28
Inventors
Cpc classification
International classification
Abstract
An apparatus for determining a disconnection of a device from a bus, the apparatus comprising: a detection unit configured to periodically poll the bus, to detect an occurrence of an indicator of disconnection; and a handling unit configured to, in response to detecting the occurrence of an indicator of disconnection a predetermined number of times within a predetermined interval, make a determination that the device is disconnected from the bus. A method for determining a disconnection of a device from a bus is also presented.
Claims
1. An apparatus for determining a disconnection of a device from a bus, the apparatus comprising: a detection unit configured to periodically poll the bus, to detect an occurrence of an indicator of disconnection; and a handling unit configured to, in response to detecting the occurrence of an indicator of disconnection a predetermined number of times within a predetermined interval, make a determination that the device is disconnected from the bus.
2. The apparatus of claim 1, wherein the bus is configured for transferring frames of data to the device, and wherein the detection unit is configured to poll the bus at least once for each frame of data.
3. The apparatus of claim 2, wherein the bus comprises data lines for conveying the frames of data; and the indicator of disconnection is an average of a voltage on each of the data lines exceeding a threshold voltage.
4. The apparatus of claim 3, wherein the threshold voltage is a double of average voltage of the data lines for conveying the frames of data when the device is connected to the bus.
5. The apparatus of claim 4, wherein the bus is configured to transfer data according to a protocol selected from one of the following: UTMI+, ULPI, and eUSB.
6. The apparatus of claim 1, wherein the frames of data are conveyed through the bus in a physical layer, PHY, of a digital communication protocol.
7. The apparatus of claim 2, wherein the handling unit is further configured to disable conveying the frames of data to the device in response to determination of disconnection from the bus.
8. The apparatus of claim 2, wherein the predetermined interval corresponds to a predetermined number of frames of data, greater than one, and the apparatus further comprising: a window generation unit configured to determine the predetermined interval by counting the frames of data, using a frame indicator occurring in each of the frame of data, until the predetermined number of frames is counted.
9. The apparatus of claim 1, wherein the predetermined interval is a predetermined period of time.
10. The apparatus of claim 1, further comprising: a counter unit configured to increment, in response to each occurrence of the indicator of disconnection, to count the number of occurrences of the indicator of disconnection; and reset in response to the counted number of occurrences of the indicator of disconnection not reaching the predetermined number within the predetermined interval.
11. A method for determining a disconnection of a device from a bus, the method comprising: periodically polling the bus, to detect an occurrence of an indicator of disconnection; and in response to detecting the occurrence of an indicator of disconnection a predetermined number of times within a predetermined interval, making a determination that the device is disconnected from the bus.
12. The method of claim 11, wherein the bus is configured for transferring frames of data to the device, and periodically polling the bus comprising polling the bus at least once for each frame of data.
13. The method of claim 12, wherein the bus comprises data lines for conveying the frames of data, and the indicator of disconnection is an average of a voltage on each of the data lines exceeding a threshold voltage.
14. The method of claim 13, wherein the threshold voltage is a double of average voltage on each of the data lines when conveying the frames of data when the device is connected to the bus.
15. The method of claim 14, wherein the bus is configured to transfer data according to a protocol selected from one of the following: UTMI+, ULPI and eUSB.
16. The method of claim 11, wherein the frames of data are conveyed through the bus in a physical layer, PHY, of a digital communication protocol.
17. The method of claim 12, further comprising: disabling conveying frames of data to the device in response to determination of disconnection from the bus.
18. The method of claim 12, wherein the predetermined interval corresponds to a predetermined number of frames of data, greater than one, and the method further comprising: determining the predetermined interval by counting the frames of data, using a frame indicator occurring in each of the frame of data, until the predetermined number of frames is counted.
19. The method of claim 11, wherein detecting the occurrence of an indicator of disconnection a predetermined number of times within a predetermined interval comprises: incrementing a counter in response to each occurrence of the indicator of disconnection, to count the number of occurrences of the indicator of disconnection, and in response to the counter not reaching the predetermined number within the predetermined interval, resetting the counter.
20. The method of claim 11, wherein the predetermined interval is a predetermined number of frames, greater than one; and detecting the occurrence of an indicator of disconnection a predetermined number of times within a predetermined interval comprises: for each frame, determining whether an indicator of disconnection has occurred the predetermined number of times within a most recent predetermined number of frames.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0010] So that the manner in which the above recited features of the present disclosure can be understood in detail, a more detailed description of the disclosure may be had by reference to embodiments, some of which are illustrated in the appended drawings. The appended drawings illustrate only typical embodiments of the disclosure and should not limit the scope of the disclosure, as the disclosure may have other equally effective embodiments. The drawings are for facilitating an understanding of the disclosure and thus are not necessarily drawn to scale. Advantages of the subject matter claimed will become apparent to those skilled in the art upon reading this description in conjunction with the accompanying drawings, in which like reference numerals have been used to designate like elements, and in which:
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
DETAILED DESCRIPTION
[0018] In most communication protocols, there are defined time periods of relevance. For example, for Bluetooth 4.0 Standard, it takes 708 ?s for a 27-byte PDU (protocol data unit) to send out a packet. While for USB 2.0 High Speed microframe, it needs 125 ?s to convey a microframe according to the USB 2.0 spec. The host sends a Start-of-Frame (SOF) packet at the beginning of each microframe, and detects potential device disconnects at the end of these packets. Therefore, a USB host can detect a device disconnect at most once every 125 ?s.
[0019] Embedded USB (eUSB) will be described hereinafter as one example according to which the above mentioned PHY interface is also defined. Disconnect detection method of the embodiments will be further discussed in detail below taking eUSB and corresponding PHY as the example. However, for those skilled in the art, disconnect detection of other Physical Layer signaling events can also be implemented by using the same.
[0020] Universal Serial Bus (USB) has been an extreme success in the electronics industry. Multiple derivatives and evolutions have been developed on basis of USB, including USB 2.0, USB 2.0 High Speed mode, and embedded USB (eUSB), etc., that allow serial interconnections for systems. A USB Bus Interface is present at host side (also known as USB Host Controller), or at physical device side, or even at USB cable side. The USB Bus Interface provides physical/signaling/packet connectivity between the host and the physical device. Furthermore, the USB Bus contains data lines and is configured for transferring frames of data from host side to device side via the data lines.
[0021] High speed USB, generally USB 2.0 and above devices apply high-speed termination to eliminate reflection of its high-speed signals. During USB 2.0 High Speed mode, disconnect can be detected using the fact that the device not being present means that its high-speed termination is also not present. Therefore, in some embodiments, when a high-speed signal is issued by the host, the lack of termination will cause the USB data lines to double in voltage due to the resulting reflection because of the unterminated line. The doubled voltage can serve as an indicator of disconnection of the device from the USB Bus in USB 2.0 High Speed mode. In some other embodiments, the disconnect of the device from the USB Bus is indicated by an average of a voltage on each of the data lines exceeding a threshold voltage. A method to accomplish disconnect detection is described in the USB 2.0 standard. During the issuance of a Start-of-Frame (SoF) packet, the possible device disconnect is detected during End-of-Packet (EoP) portion of the SoF packet. This particular packet has a longer End-of-Packet timing that allows for a static differential condition to be generated which is long enough to allow the reflection to be received if the device termination is missing. This higher differential voltage is then used to declare a disconnect.
[0022] Signaling, or declaring, a disconnect, however, is a drastic event. It causes all USB communication to be stopped and the link to be torn down. USB bus voltage (V.sub.bus) is usually taken away for a long duration. Reestablishment of a connection typically will require quite some time and will typically involve redriving V.sub.bus, detecting device connection, debouncing the connection, USB Bus Reset, and re-enumeration of the device.
[0023]
[0024] In the system 100 shown in
[0025] One aspect of the proposed solution provides programmable window lengths that vary by increments with the window period derived from particular time intervals of the specific protocol implemented in Physical Layer, and allows the disconnect filtering to be configured to accept up to a certain percentage of false disconnect indications during that time, i.e., the programmable window, before declaring the disconnect detection as valid. Embodiments of the disclosure offer reliable device disconnect detection during times when it may sporadically or temporarily appear that the device has been disconnected. This offers a steadier connection and better user experience even in the presence of noise or other issues occurring in the system.
[0026]
[0027] In UTMI+ based USP PHY interfaces, there is a status signal to allow the PHY to convey disconnect detection. In eUSB based repeaters, the way in which the high speed disconnect is conveyed is via a repeater issued Port Reset. In either case, the proposed solution of the present disclosure allows that, only after determining that the amount of disconnect detections over a configured window size is above a configured threshold, will the USB PHY act upon this and declare a connected device as being disconnected. Up until that point, any detections of the device being disconnected (during Start-of-Frame packet) will be considered sporadic and ignored.
[0028] In some embodiments, the USB Host Side device 201 configures the window length as 3 ms (which corresponds to 24 USB 2.0 High Speed microframes) and the allowed number of sporadic disconnect indications to be 9. If the USB High Speed PHY 205 detects less than (or equal to) 9 indications of disconnect during the 3 ms window length, it ignores the disconnect indications and does not alert the system that there was an actual disconnect needed to be acted upon. However, if the USB High Speed PHY 205 detects 10 or more disconnects within this 3 ms window length, it declares the USB 2.0 Device Side device 202 as now disconnected and alerts the system in whichever way is appropriate to the interface used (e.g., UTMI+, ULPI, eUSB, etc.). Thus, in this illustrative example, the system 200 assumes that given current conditions in a 3 ms window length, the expected noise may cause sporadic disconnect indications up to 37.5% of the time. The filtering method according to an embodiment should allow this and not declare a disconnect. If the detected disconnect indications are more than that allowed number within the window, it means that the Device Side device 202 is probably actually disconnected and so the system 200 should act upon it.
[0029] The windows defined may be sliding windows or fixed rolling windows, the difference between which will be explained in detail further below. The present disclosure will mainly discuss implementations using fixed rolling windows, but those skilled in the art will be able to use sliding windows to replace of fixed rolling windows to reproduce the present disclosure.
[0030]
[0031] With the example shown in
[0032] Note that immediately after the very first Start-of-Frame packet 311 occurring while the device appears disconnected in period 301 (i.e., a high speed disconnect 312 is detected during End-of-Packet portion of the SOF packet 311), the eUSB repeater declares the device disconnected, issues a port reset 310 back to the USB host controller, and the USB link is broken. No more USB Traffic is passed through the repeater.
[0033]
[0034]
[0035] The second row line in
[0036] The third row line in
[0037] During the second 1 ms window 422, the eUSB repeater detects 4 high speed disconnects 432, 433, 434, 435 based on the cable wiggle activity in periods 401, 402, 404, which causes the corresponding indicator of disconnection events count 443, 444, 445, 446. Since the count of 4 is within the number of allowed indications of disconnection in the specified window size, the host controller is not alerted, the internal counter is reset at 447, and the eUSB repeater moves to the next 1 ms window 423.
[0038] Note that there were 5 disconnects 431, 432, 433, 434, 435 within a period of 1 ms. Even so, that didn't result in an indication to the host of disconnect, as it is not required to align the configured window with disconnect activity.
[0039]
[0040]
[0041] As discussed, the proposed solution in the present disclosure may have configurable window size in increments of the USB 2.0 High Speed microframe (125 ?s) and a configurable tolerable number (or percentage) of disconnects within the window size.
[0042]
[0043] Clock Generation 701 represents a timing reference which the proposed solution uses as part of its normal operation. The unit of Clock Generation 701 provides local clock source for the whole apparatus 700.
[0044] Configuration Control 702 represents a unit that configures parameters for operation of the apparatus 700. Configurations from the unit of Configuration Control 702 could come from a system interface such as I.sup.2C or SPI, from an internal memory device, or from a local microprocessor, etc.
[0045] Configuration Control 702 provides 8-bit data HS_DISCONNECT_WINDOW_SIZE[7:0] and 8-bit data HS_DISCONNECT_COUNT[7:0]. The embodiment of
[0046] HS_DISCONNECT_WINDOW_SIZE stands for the number of USB 2.0 High Speed microframes contained within a window. HS_DISCONNECT_WINDOW_SIZE defines a repeated window of duration specified as follows: window may or may not be synchronous to the USB 2.0 High Speed microframe boundaries; the variation in window length increments depends on the accuracy of the internal timing reference; an expected tolerable timing reference would be around +/?10% accurate, but could be more or less accurate depending on product needs. As an example, 8d0 assigned to HS_DISCONNECT_WINDOW_SIZE stands for window length is N/A, wherein 8 in 8d0 means 8-bit, and d in 8d0 means decimal. The setting by 8d0 could be used to disable the filtering method of the present disclosure such that a single disconnect indication triggers to decide the device as disconnected. 8d1 assigned to HS_DISCONNECT_WINDOW_SIZE stands for window length is 125 ?s. 8dN assigned to HS_DISCONNECT_WINDOW_SIZE stands for window length equals to N*125 ?s. Max window length is 31.9 ms, when N is 255.
[0047] HS_DISCONNECT_COUNT stands for the amount of high speed indicators of disconnection to be allowable within the given window length. 8d0 assigned to HS_DISCONNECT_COUNT stands for disconnect shall be declared upon the first detection of disconnect during a High Speed Start-of-Frame packet. 8dN (N>0) stands for N disconnects shall be allowed within the specified window length (without determining or declaring disconnection). If N+1 disconnects are detected within the window, then the device shall be determined and declared as disconnected and the proper action should be taken depending on the interface used. For example, if eUSB is used, then the repeater shall issue an eUSB Port Reset and disable repeater function and wait for further configuration from the host.
[0048] The system would select an appropriate window size (e.g., 10 ms) and also an appropriate number of acceptable high speed disconnects within this window (e.g., 53). However, the selection of the window size and the acceptable count number should also take into account the actual product used, the PHY interface involved, the requirement of accuracy, etc.
[0049] Note that with the above definition it is possible to define illegal (which means invalid) combinations of window length and allowed number of high speed disconnects. For example, if the system selects a 1 ms window size and 40 as the number of allowed disconnects, while a 1 ms window lasts for only 8 microframes long, 40 disconnects is invalid, which is self-explanatory.
[0050] The apparatus 700 includes the Errored Configuration Handling 705 to implement whatever errored configuration handling as will be apparent. There are a variety of possibilities depending on the desired complexity. In this case the apparatus 700 is able to override the configuration depending on the specified window size or indications of disconnection count.
[0051] For example, if HS_DISCONNECT_COUNT was set to 8d7, which means that 8 disconnects would have to be detected in order to notify the host of the disconnect. A window shall have a duration of at least 1 ms for which 8 USB 2.0 high speed microframes last. HS_DISCONNECT_WINDOW_SIZE should be set to at least 8d8 which allows the window to last at least 1 ms long. Although it is possible to detect disconnect with this setting, it represents 100% of microframes appear disconnected. It is preferrable to set the acceptable number of disconnects to be around 60% of the whole microframes within the defined window, nonetheless that is dependent on the system needs.
[0052] For any setting of HS_DISCONNECT_COUNT above 0, the corresponding setting of HS_DISCONNECT_WINDOW_SIZE should be at least larger than HS_DISCONNECT_COUNT. The unit of Errored Configuration Handling 705, which is configured to perform errored configuration handling, is enabled when HS_DISCONNECT_COUNT is above 0, while HS_DISCONNECT_WINDOW_SIZE is no larger than HS_DISCONNECT_COUNT. The detailed errored configuration handling mechanism is described as follows:
[0053] If (HS_DISCONNECT_COUNT=0), no change is required to be made to user settings. As soon as a high speed disconnect is detected, the host system is alerted in whichever way is appropriate for the interface used (UTMI+, ULPI, eUSB, etc.).
[0054] If (HS_DISCONNECT_COUNT>0) and (HS_DISCONNECT_WINDOW_SIZE<HS_DISCONNECT_COUNT+1) and (HS_DISCONNECT_WINDOW_SIZE=0), HS_DISCONNECT_COUNT is overridden and forced to 0.
[0055] If (HS_DISCONNECT_COUNT>0) and (HS_DISCONNECT_WINDOW_SIZE<HS_DISCONNECT_COUNT+1) and (HS_DISCONNECT_WINDOW_SIZE>0), HS_DISCONNECT_COUNT is overridden and forced to HS_DISCONNECT_WINDOW_SIZE?1.
[0056] If (HS_DISCONNECT_WINDOW_SIZE>=HS_DISCONNECT_COUNT+1), which indicates the current configuration is valid, no change is made to user settings. The proposed filtering method will proceed by using current configuration.
[0057] Referring to
[0058] The unit of Disconnect Detection Handling 704 represents the portion of the USB PHY which reacts to the high speed disconnect. Whether it's a traditional UTMI+ or ULPI USB PHY or a newer eUSB repeater, each one has a specified manner in which a high speed disconnect is supposed to be handled. For example, in a host side eUSB repeater, it should react to detecting a high speed disconnect by issuing an eUSB Port Reset, as those of
[0059] Embodiment of the present disclosure of the method and apparatus for detecting disconnections of a device will be described in accordance with 3 sections: Errored Configuration Handling 705, Window Generation 706 and Disconnect Count 707.
[0060] The unit of Errored Configuration Handling 705 receives HS_DISCONNECT_COUNT[7:0] and HS_DISCONNECT_WINDOW_SIZE[7:0] from the unit of Configuration Control 702, modifies the settings as described above and produces HS_DISCONNECT_COUNT_MOD[7:0] and HS_DISCONNECT_WINDOW_SIZE_MOD[7:0]. Errored Configuration Handling 705 may produce a disconnect_filtering_disabled indication if the settings are such that the method should not be used. As described, the USB PHY should act upon the very first indication of high speed disconnect if HS_DISCONNECT_COUNT=0 or HS_DISCONNECT_WINDOW_SIZE=0.
[0061] The unit of Window Generation 706 includes a Microframe Timing Pulse Generator 708, which takes the local clock source from the unit of Clock Generation 701 and divides it down to create a 125 ?s timing reference. A free running Window Counter 709 receives the 125 ?s timing reference, and increments once every 125 ?s. As soon as counts of the Window Counter 709 hit the amount of 125 ?s microframes as specified by HS_DISCONNECT_WINDOW_SIZE_MOD, the Window Counter 709 is reset and an indication is given to indicate that the window duration ends. Note that a valid HS_DISCONNECT_WINDOW_SIZE_MOD should be larger than 0 while the Window Counter 709 starts counting from 0. Thus, before a comparator 711, a ?1 operator unit 710 is added to subtract HS_DISCONNECT_WINDOW_SIZE_MOD by 1 before comparing with Window_cnt[7:0] from Window Counter 709. At the end of the window duration, the comparator 711 provides a Terminal_window_cnt which presents a falling edge to be detected by a falling edge detector. As a response, the falling edge detector produces a Window_start which indicates the end of one window and the start of the next.
[0062] The module of Disconnect Count 707 includes a Disconnect Counter 712 which is cleared at the start of every window and increments once for every high speed disconnect detected during a given window. Disconnect_cnt[7:0] is compared with HS_DISCONNECT_COUNT_MOD[7:0] from Errored Configuration Handling 705 by a comparator 713.
[0063] As long as the disconnection indication within the current window is less than or equal to) HS_DISCONNECT_COUNT_MOD, the apparatus disables any unit from acting upon the high speed disconnect indication. Once, or if, the number of high speed disconnection indications within a window reaches HS_DISCONNECT_COUNT_MOD, max_allow_disconnects_reached is produced from the comparator 713 and the external logic is enabled to act immediately upon the next high speed disconnection indication, which means if a further indicator of high speed disconnect is detected before the end of the current window, the external logic would act upon the disconnect. Note, considering either max_allow_disconnects_reached produced from the comparator 713 or disconnect_filtering_disabled produced from Errored Configuration Handling 705, the next one high speed disconnect would result the system to act upon the disconnect. Thus, an OR gate 714 is provided to notify, through enable_hs_disconnect_action, the unit of Disconnect Detection Handling 704 to react upon the next high speed disconnect for either one of the above two conditions. According to one or more embodiments of the disclosure, the enable signal (enable_hs_disconnect_action) is provided from the OR gate 714, to control the operation of Disconnect Detection Handling 704. If enabled (enable_hs_disconnect_action=true), the Disconnect Detection Handling 704 will act upon the immediate next disconnect as per the appropriate spec (UTMI+, ULPI, eUSB). If disabled (enable_hs_disconnect_action=false), the Disconnect Detection Handling 704 will not act upon the very next disconnect and shall act as if a disconnect was not detected.
[0064]
[0065]
[0066]
[0067] At the start, the eUSB repeater is in Host Mode in its High Speed LO state 961. This is the repeating mode state where packets are conveyed upstream and downstream. In the example, disconnect detection performed during SOF packet but disconnect was not detected at 901, 902, 903, 906, 909, 911, while disconnect detection performed during SOF packet and indicators of disconnection was detected at 904, 905, 907, 908, 910, 912. The example shows that during the second 1 ms window 932, 4 high speed indicators of disconnection 905, 907, 908, 910 have been detected. After the 4th indicator of disconnection 910 is detected, the enable_hs_disconnect_action signal is asserted true at 951.
[0068] Note, in this case, a 5th indicator of disconnection 912 is detected within the second 1 ms window 932. Since USB 2.0 high speed Disconnect Detection Handling 704 is enabled to act upon any immediate next detected disconnect, the repeater immediately issues an eUSB Port Reset 962 and disables its operation right after the 5th indicator of disconnection 912 is detected. Repeater host mode is correspondingly disabled at 971. This represents that the repeater will send the Port Reset 962, but all of its other operations are substantially disabled. It would need to be reconfigured by the system in order to re-establish the USB operations again.
[0069]
[0070] The described embodiments of the present disclosure take an eUSB Repeater and its actions upon detecting a high speed disconnect as examples, however the described apparatus and method could easily be applicable to alternative embodiments of a UTMI+ or ULPI USB PHY, an integrated USB PHY, or even other PHY interface capable of data frames transmission.
[0071] The window increment was listed as 125 ?s according to USB 2.0 High Speed microframe timing, but this need not be the case. Other timing references could be used which suit the needs of the system. Examples are 100 ?s, 500 ?s, 1 ms, etc. System noise due to various reasons (e.g., audio) may cause sporadic disconnect detections, but the system can declare a threshold for acceptable system behavior.
[0072] The proposed solution of the present disclosure has been described with reference to a specific configuration option (window size and disconnect count) and errored configuration handling, but it is envisioned that other possible configuration and error handling methods could be used. Instead of a number of incremental windows provided to create a window size, a simple window length in time could be specified. Instead of a specific number of disconnects allowed, those skilled in the art could specify a percentage. Other possibilities exist as well, as will be familiar to the skilled person, and are intended to be encompassed within the present disclosure.
[0073] The use of the terms a, can, the and similar referents in the context of describing the subject matter (particularly in the context of the following claims) are to be construed to cover both the singular and the plural, unless otherwise indicated herein or clearly contradicted by context. Recitation of ranges of values herein are intended merely to serve as a shorthand method of referring individually to each separate value falling within the range, unless otherwise indicated herein, and each separate value is incorporated into the specification as if it were individually recited herein. Furthermore, the foregoing description is for the purpose of illustration only, and not for the purpose of limitation, as the scope of protection sought is defined by the claims set forth hereinafter together with any equivalents thereof entitled to. The use of any and all examples, or exemplary language (e.g., such as) provided herein, is intended merely to better illustrate the subject matter and does not pose a limitation on the scope of the subject matter unless otherwise claimed. The use of the term based on and other like phrases indicating a condition for bringing about a result, both in the claims and in the written description, is not intended to foreclose any other conditions that bring about that result. No language in the specification should be construed as indicating any non-claimed element as essential to the practice of the disclosure as claimed.
[0074] Preferred embodiments are described herein, including the best mode known to the inventor for carrying out the claimed subject matter. Of course, variations of those preferred embodiments will become apparent to those of ordinary skill in the art upon reading the foregoing description. The inventor expects skilled artisans to employ such variations as appropriate, and the inventor intends for the claimed subject matter to be practiced otherwise than as specifically described herein. Accordingly, this claimed subject matter includes all modifications and equivalents of the subject matter recited in the claims appended hereto as permitted by applicable law. Moreover, any combination of the above-described elements in all possible variations thereof is encompassed unless otherwise indicated herein or otherwise clearly contradicted by context.