The present application claims the benefit under 35 USC ยง 120 from U.S. patent application Ser. No. 10/284,600, now U.S. Pat. No. 7,116,739, filed Oct. 31, 2002. The subject matter of U.S. application Ser. No. 10/284,600 is incorporated herein by reference.
Compact Disc Appendix, which is a part of the present disclosure, is one recordable Compact Disc (CD-R) containing information that is part of the disclosure of the present patent document. The Compact Disc contains hardware description in Verilog of a transmitter/receiver module circuit. The transmitter/receiver module circuit carries out a method in accordance with one specific embodiment of the present invention. A portion of the disclosure of this patent document contains material that is subject to copyright protection. All the material on the Compact Disc is hereby expressly incorporated by reference into the present application. The copyright owner of that material has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure, as it appears in the Patent and Trademark Office patent files or records, but otherwise reserves all copyright rights.
The invention relates to a single pin communication interface and a method of detecting the baud rate for an asynchronous communication link.
As technology develops, semiconductor devices are shrinking and being put into smaller packages. Pin utilization becomes ever more important for low pin count devices.
Communication links typically require several signals for communication. For instance, RS232 requires at least two data signals, transmit and receive. I2C also requires two signals, a bi-directional data signal and a clock. SPI requires at least three signals, transmit, receive, and a clock. All these communication interfaces also require a common ground signal, but since that signal does not carry any information, we will ignore it in our discussions.
Communication links also require that both ends transfer data at the same rate. Some communication protocols such as I2C or SPI use a dedicated clock so both ends transfer data at the same rate. For asynchronous protocols like those used in RS232, both ends of the link must know beforehand what the transmission rate is since a dedicated clock is not used. The transmission rate of an asynchronous serial communications link is typically referred to as the baud rate.
Asynchronous protocols typically operate by using a reference clock in conjunction with a baud rate generator. Since the speed of the reference clock is known and the desired baud rate of the communication link is known, the baud rate generators can be programmed to divide the reference clock down to the baud rate.
There have been previous methods used to auto-detect the baud rate of asynchronous communication links. One prior art technique involves sending a synchronizing key stroke such as a space bar, and then measuring the duration of the first bit in the data stream. Using this time interval allows the baud rate to be set. However, the accuracy obtained by measuring just one bit may cause this detection method to fail if the baud rate is close to the speed of the reference clock.
The present invention seeks to address these issues by providing a single pin communication interface with accurate baud rate detection.
The present invention provides a single pin communication interface with automatic baud rate detection.
According to the invention, there is provided a baud rate detection circuit for determining the baud rate of a communications link using an asynchronous protocol. This baud rate detection circuit is comprised of a counter for counting the number of cycles of a reference clock of unknown frequency over a plurality of data bits, and a means for determining the number of reference clock cycles that corresponds to the baud rate of the communication link based upon the counted clock cycles. Thus, this baud rate detection circuit is comprised of a baud rate generator, a counter for counting reference clock cycles, and a means for determining the number of reference clock cycles over a plurality of data bits. It also includes means for dividing the counter value by said plurality of data bits and for adding any remainder value to the baud rate generator by adding clock cycles to the baud rate generator at various bit positions when transmitting or receiving data. The plurality of data bits may be eight bits and the dividing may comprise shifting the binary counter value three places to the right. The remainder bits from this division may be distributed over a plurality of data bits during the reception or transmission of data by adding clock cycles to the baud rate generator at strategic bit locations in order to minimize error. The circuit may have a receiver and transmitter capable of sending and receiving data using an asynchronous protocol like the one defined in the RS232 standard. The asynchronous protocol may be comprised of a start bit, a number of data bits, and one or more stop bits. The start bit may be active low and the one or more stop bits may be active high. There may be eight data bits. The counter used for baud rate detection may be configured to start when the start bit is received and count until a high bit is received. The data used for baud rate detection purposes may be 80 Hex, thereby providing a sequence of eight low bits (one low start bit combined with seven low data bits), followed by two high bits (one high data bit combined with one high stop bit). This sequence causes the counter to count over eight bits. The circuit may include a single pin communication interface which combines the transmit and receive signals of an RS-232 interface into a single signal capable of half-duplex, bi-directional communication.
Still further, according to the invention, there is provided a method of using a baud rate generator to generate a data rate based upon a measured time of a plurality of data bits by counting the number of clock cycles of a reference clock over the duration of a plurality of data bits, dividing the number of clock cycles by the number of received bits, and adding clock cycles to the baud rate generator at strategic bit positions during the transmission and reception of a data byte according to the remainder value from the dividing step. Preferably the reference clock is counted over eight bits and the counter value is divided by eight by shifting three places to the right. The three remainder bits from the shift are then preferably added to the baud rate generator during the reception and transmission of a byte at strategic bit positions in order to minimize error.
In accordance with one method and apparatus, a first character is received. During reception of this first character, the number of clock cycles of a reference clock over a duration of a number of bits of the first character is counted. The number of clock cycles is divided by the number of bits to generate a data rate quotient value and a remainder value. The first character is, for example, a particular predetermined character such as the character 80 Hex. The first character 80 Hex has a first low start bit, then seven low data bits (D0-D6), a high eighth data bit (D7), and then a following high stop bit. In this example, clock cycles of the reference clock are counted starting at the beginning of the low start bit and continuing until the beginning of the high eighth data bit. Reference clocks are therefore counted over the duration of eight bits.
The data rate quotient and remainder values are then used in the subsequent reception of a second character to determine when to sample each bit of the second character. To determine when to sample a bit of the second character, either: 1) the data rate quotient value of reference clock cycles is counted, or 2) the data rate quotient value plus one of reference clock cycles is counted. Whether the data rate quotient value of reference clock cycles is counted to determine when to sample a bit or whether the data rate quotient value plus one of reference clock cycles is counted to sample the bit depends upon the remainder value and which particular bit of the second character is to be sampled.
As set forth above in this example, the duration of eight bits in the first character is measured by counting reference clock cycles. The remainder value indicates the error across eight bits. Receiving a full character in this example comprises ten bits (one start bit, plus eight data bits, plus one stop bit). Correcting by just adding in the remainder number of clocks would be correct if only eight bits were being received. Because ten bits are being received, however, the error measured across eight bits is extrapolated across ten bits. Accordingly, the number of bits of the second character for which the data rate quotient value plus one of reference clock cycles is used to do sampling can exceed the remainder value. The bits of the second character for which the data rate quotient plus one of reference clock cycles is used are spread out across the various bits of the second character.
In the present example, reference clocks were counted across eight bits in the first character and there are ten bits in the second character to be sampled. The number of times the data rate quotient value plus one is used to sample is substantially equal to the remainder value times the number of bits in the first character across which reference clock cycles were counted, divided by the number of bits there are in the second character that are to be sampled. If, for example, the remainder value is three and the data bits of the second character are designated D0-D7, then there are three data bits (D1, D4 and D7) which are sampled by counting the data rate quotient value plus one of reference clock cycles.
The same counter may be used to both: 1) count reference clock cycles to determine the data rate quotient value, and 2) count reference clock cycles to determine when to sample a bit of the second character.
In one embodiment, the data rate quotient and remainder values are used to determine when to transmit bits of a third character. These bits of the third character may, for example, be transmitted by shifting them out of a shift register. To determine when to transmit a bit of the third character, a counter counts either: 1) the data rate quotient value plus one of reference clock cycles, or 2) the data rate quotient value of reference clock cycles. Which of the two counts is used depends on the remainder value and which particular bit it is that is to be transmitted. If, for example, the remainder value is three in this example, then there are three data bits (D1, D4 and D7) which are transmitted by counting the data rate quotient value plus one of reference clock cycles. The same counter may be used to both: 1) count reference clock cycles to determine the data rate quotient value, and 2) count reference clock cycles to determine when to transmit a bit of the third character.
Although the terms second and third are used here in connection with characters received and transmitted, these terms do not indicate a required temporal order. The third character may, for example, be transmitted before the second character is received.
Still further, according to the invention, there is provided a means for error recovery, comprising generating a break condition which has the capability of being transmitted at any time over an open drain interface.
The one-pin interface is a bi-directional, open-drain interface that transmits and receives data in half-duplex mode. Serial data is sent using the asynchronous data format defined in RS-232. Thus, minimal hardware is required to connect the single pin interface of the circuit of the invention with an RS232 link.
In order to communicate bi-directionally on the same wire, an open drain interface is used on each end of the link. A resistor is used to pull the line to a positive voltage. Each end of the link can only drive the line to ground.
In order to further explain the invention in context, it will be described with reference to its implementation in Zilog's Z8 Encore.
The circuit of this embodiment 100 requires that the first character received from the host be 80 Hex. Thus, in this embodiment the present invention will configure the Baud Rate Detector/Generator 110 upon reception of the character 80 Hex. Reconfiguring the Baud Rate Detector/Generator can be done by the circuit detecting a break condition, which will reset the Baud Rate Detector/Generator. The character 80 Hex can then be resent to reconfigure the Baud Rate Detector/Generator.
As mentioned above, the circuit of the present embodiment uses the asynchronous data format defined for RS-232. Each character is transmitted in a frame comprising a start bit, eight data bits (least significant bit first) and one to two stop bits. The start bit is active low and the stop bit(s) active high. Thus the reconfiguring frame in such an implementation comprises a low start bit, followed by seven low data bits and one high data bit, and ending with one high stop bit. Thus there are eight continuous low bits before a high bit is received.
The Baud Rate Detector/Generator 110 includes a counter which counts the clock cycles of a reference clock during the transmission of the eight continuous low bits. The minimum baud rate that the system can be configured for is dependent on the length of this counter and the frequency of the reference clock.
According to the invention, the number of clock cycles counted during the reception of the eight low bits when the character 80 Hex is received is divided by eight in order to obtain the baud rate (data rate quotient value). Any remainder (remainder value) from this division is evenly distributed across characters received or transmitted by adding clocks to the baud rate generator at strategic bit locations in the character. This can be understood more clearly with reference to
Thus the present invention provides for a simple way of providing for baud rate detection and for providing a single pin interface. It will be appreciated that the invention can be used for automatic baud rate detection of UARTs in general and that the implementations and embodiments discussed above were by way of example only. The invention can therefore be implemented in different ways without departing from the general scope of the invention.
Furthermore, the present invention provides for a way of recovering from communication error conditions. Asynchronous protocols commonly make use of start and stop bits having opposite polarities with a predetermined number of data bits in between. For instance, in one protocol, the idle state of the communications line is the same polarity as the stop bit and the opposite polarity of the start bit. If the communications line is held in the non-idle state for more than the length of time it takes to transmit the start bit and all data bits, this is considered an error condition most commonly referred to as a break condition.
In fact, in asynchronous protocols, there are various communication error conditions that can occur. These include framing errors, parity errors, and break conditions. Due to the open drain interface of this communication link, there is also the possibility that transmit collision errors can occur. The present invention provides a means in order to notify the remote end of the link that an error occurred. This signaling is done by placing the communications line into the non-idle state for a length of time long enough to generate a break condition. Due to the open drain nature of the interface, a break condition can be sent at any time, even if the communication peripheral is currently receiving or transmitting data. The remote end of the link will then detect that a communications error occurred and can take appropriate action to attempt to recover from the error.
Although operation of certain embodiments is explained above in connection with counting either a data rate quotient number of reference clock cycles or the data rate quotient number of reference clock cycles plus one to determine when to sample a data bit or transmit a data bit, advantages of the present invention can be achieved by using other numbers of counts. For example, the number of reference clocks and the number of reference clocks minus one can be used. The difference between the two count values need not be one reference clock. For example, a number of reference clocks and the number of reference clocks plus two can be used. Three different count values can be used in the distribution of the remainder clocks over the data bits of a character.
CD Appendix: The file autobaud.v is a file of verilog hardware description language for a transmitter/receiver module in accordance with one specific embodiment of the present invention. It has an eight-bit data bus that extends to a debugger, and another eight-bit data bus that extends from the debugger. Once the module receives an entire character, it places the character on the DbgRxData bus extending to the debugger and asserts the DbgRxAck signal. When the debugger wants to transmit a character, it places the character on the DbgTxData bus and asserts the DbgTxEn signal. When the module is finished transmitting the character, the module asserts the DbgTxAck signal. The verilog file is synthesized using a synthesis tool (for example, a design compiler by the company Synopsys) resulting in a gate level netlist. The gate level netlist is used to realize an integrated circuit embodiment of the transmitter/receiver module.
It will be appreciated that the embodiments and applications discussed above were by way of example only and that other implementations and embodiments can be provided without departing from the scope of the invention.
Number | Name | Date | Kind |
---|---|---|---|
3700808 | Lowery et al. | Oct 1972 | A |
4058430 | Suntola et al. | Nov 1977 | A |
4415275 | Dietrich | Nov 1983 | A |
4578798 | Divjak et al. | Mar 1986 | A |
4761269 | Conger et al. | Aug 1988 | A |
4834831 | Nishizawa et al. | May 1989 | A |
4975252 | Nishizawa et al. | Dec 1990 | A |
4993357 | Scholz | Feb 1991 | A |
5027746 | Frijlink | Jul 1991 | A |
5173327 | Sandhu et al. | Dec 1992 | A |
5178681 | Moore et al. | Jan 1993 | A |
5225366 | Yoder | Jul 1993 | A |
5261959 | Gasworth | Nov 1993 | A |
5281274 | Yoder | Jan 1994 | A |
5294286 | Nishizawa et al. | Mar 1994 | A |
5338362 | Imahashi | Aug 1994 | A |
5441703 | Jurgensen | Aug 1995 | A |
5443647 | Aucoin et al. | Aug 1995 | A |
5674786 | Turner et al. | Oct 1997 | A |
5711811 | Suntola et al. | Jan 1998 | A |
5730802 | Ishizumi et al. | Mar 1998 | A |
5796116 | Nakata et al. | Aug 1998 | A |
5835677 | Li et al. | Nov 1998 | A |
5879459 | Gadgil et al. | Mar 1999 | A |
5972430 | DiMeo, Jr. et al. | Oct 1999 | A |
6042652 | Hyun et al. | Mar 2000 | A |
6071572 | Mosely et al. | Jun 2000 | A |
6072534 | Dell'ova et al. | Jun 2000 | A |
6139700 | Kang et al. | Oct 2000 | A |
6163586 | Hongbin Hao et al. | Dec 2000 | A |
6174377 | Doering et al. | Jan 2001 | B1 |
6183563 | Choi et al. | Feb 2001 | B1 |
6197683 | Kang et al. | Mar 2001 | B1 |
6231672 | Choi et al. | May 2001 | B1 |
6302965 | Umotoy et al. | Oct 2001 | B1 |
6306216 | Kim et al. | Oct 2001 | B1 |
6447607 | Soininen et al. | Sep 2002 | B2 |
6478872 | Chae et al. | Nov 2002 | B1 |
6481945 | Hasper et al. | Nov 2002 | B1 |
6551406 | Kilpi | Apr 2003 | B2 |
6572705 | Suntola et al. | Jun 2003 | B1 |
6578287 | Aswad | Jun 2003 | B2 |
6579372 | Park | Jun 2003 | B2 |
6593484 | Yasuhara et al. | Jul 2003 | B2 |
6630030 | Suntola et al. | Oct 2003 | B1 |
6632747 | Niimi et al. | Oct 2003 | B2 |
6660126 | Nguyen et al. | Dec 2003 | B2 |
6716287 | Santiago et al. | Apr 2004 | B1 |
6718126 | Lei | Apr 2004 | B2 |
6734020 | Lu et al. | May 2004 | B2 |
6772072 | Ganguli et al. | Aug 2004 | B2 |
6773507 | Jallepally et al. | Aug 2004 | B2 |
6777352 | Tepman et al. | Aug 2004 | B2 |
6778762 | Shareef et al. | Aug 2004 | B1 |
6818094 | Yudovsky | Nov 2004 | B2 |
6821563 | Yudovsky | Nov 2004 | B2 |
6866746 | Lei et al. | Mar 2005 | B2 |
6868859 | Yudovsky | Mar 2005 | B2 |
6881437 | Ivanov et al. | Apr 2005 | B2 |
6902624 | Seidel et al. | Jun 2005 | B2 |
6921062 | Gregg et al. | Jul 2005 | B2 |
6970525 | Kljajic et al. | Nov 2005 | B1 |
20010011526 | Doering et al. | Aug 2001 | A1 |
20010013312 | Soininen et al. | Aug 2001 | A1 |
20010014371 | Klipl | Aug 2001 | A1 |
20010029092 | Park et al. | Oct 2001 | A1 |
20010042523 | Kesala | Nov 2001 | A1 |
20010042799 | Kim et al. | Nov 2001 | A1 |
20010054377 | Lindfors et al. | Dec 2001 | A1 |
20020000196 | Park | Jan 2002 | A1 |
20020009544 | McFeely et al. | Jan 2002 | A1 |
20020009896 | Sandhu et al. | Jan 2002 | A1 |
20020017242 | Hamaguchi et al. | Feb 2002 | A1 |
20020041931 | Suntola et al. | Apr 2002 | A1 |
20020066411 | Chiang et al. | Jun 2002 | A1 |
20020073924 | Chiang et al. | Jun 2002 | A1 |
20020076481 | Chiang et al. | Jun 2002 | A1 |
20020076507 | Chiang et al. | Jun 2002 | A1 |
20020076508 | Chiang et al. | Jun 2002 | A1 |
20020086106 | Park et al. | Jul 2002 | A1 |
20020092471 | Kang et al. | Jul 2002 | A1 |
20020104481 | Chiang et al. | Aug 2002 | A1 |
20020108570 | Lindfors et al. | Aug 2002 | A1 |
20020110991 | Li | Aug 2002 | A1 |
20020114409 | Shingaki | Aug 2002 | A1 |
20020115886 | Yasuhara et al. | Aug 2002 | A1 |
20020121241 | Nguyen et al. | Sep 2002 | A1 |
20020121342 | Lu et al. | Sep 2002 | A1 |
20020127745 | Lu et al. | Sep 2002 | A1 |
20020134307 | Choi | Sep 2002 | A1 |
20020144655 | Chiang et al. | Oct 2002 | A1 |
20020144657 | Chiang et al. | Oct 2002 | A1 |
20020146511 | Chiang et al. | Oct 2002 | A1 |
20020197883 | Niimi et al. | Dec 2002 | A1 |
20030004723 | Chihara | Jan 2003 | A1 |
20030010451 | Tzu et al. | Jan 2003 | A1 |
20030017697 | Choi et al. | Jan 2003 | A1 |
20030022338 | Ruben et al. | Jan 2003 | A1 |
20030042630 | Babcoke et al. | Mar 2003 | A1 |
20030053799 | Lei | Mar 2003 | A1 |
20030057527 | Chung et al. | Mar 2003 | A1 |
20030072913 | Chou et al. | Apr 2003 | A1 |
20030075273 | Kilpela et al. | Apr 2003 | A1 |
20030075925 | Lindfors et al. | Apr 2003 | A1 |
20030079686 | Chen et al. | May 2003 | A1 |
20030089308 | Raajimakers | May 2003 | A1 |
20030101927 | Raaijmakers | Jun 2003 | A1 |
20030101938 | Ronsse et al. | Jun 2003 | A1 |
20030113187 | Lei et al. | Jun 2003 | A1 |
20030116087 | Nguyen et al. | Jun 2003 | A1 |
20030121469 | Lindfors et al. | Jul 2003 | A1 |
20030121608 | Chen et al. | Jul 2003 | A1 |
20030140854 | Kilpi | Jul 2003 | A1 |
20030143328 | Chen et al. | Jul 2003 | A1 |
20030143747 | Bondestam et al. | Jul 2003 | A1 |
20030172672 | Thakur et al. | Sep 2003 | A1 |
20030194493 | Chang et al. | Oct 2003 | A1 |
20030198754 | Xi et al. | Oct 2003 | A1 |
20030213560 | Wang et al. | Nov 2003 | A1 |
20030216981 | Tillman | Nov 2003 | A1 |
20030221780 | Lei et al. | Dec 2003 | A1 |
20030224107 | Lindfors et al. | Dec 2003 | A1 |
20030225953 | Ho | Dec 2003 | A1 |
20040011404 | Ku et al. | Jan 2004 | A1 |
20040011504 | Ku et al. | Jan 2004 | A1 |
20040013577 | Ganguil et al. | Jan 2004 | A1 |
20040014320 | Chen et al. | Jan 2004 | A1 |
20040015300 | Ganguli et al. | Jan 2004 | A1 |
20040016404 | Gregg et al. | Jan 2004 | A1 |
20040025370 | Guenther et al. | Feb 2004 | A1 |
20040065255 | Yang et al. | Apr 2004 | A1 |
20040069227 | Ku et al. | Apr 2004 | A1 |
20040071897 | Verplancken et al. | Apr 2004 | A1 |
20040144308 | Yudovsky | Jul 2004 | A1 |
20040144311 | Chen et al. | Jul 2004 | A1 |
20040203254 | Conley, Jr. et al. | Oct 2004 | A1 |
20040219784 | Kang et al. | Nov 2004 | A1 |
20040224506 | Choi et al. | Nov 2004 | A1 |
20050059240 | Choi et al. | Mar 2005 | A1 |
20050064207 | Senzaki et al. | Mar 2005 | A1 |
20050070126 | Senzaki | Mar 2005 | A1 |
20050095859 | Chen et al. | May 2005 | A1 |
20050104142 | Narayanan et al. | May 2005 | A1 |
20050153571 | Senzaki | Jul 2005 | A1 |
20050233156 | Senzaki et al. | Oct 2005 | A1 |
20050255243 | Senzaki | Nov 2005 | A1 |
Number | Date | Country |
---|---|---|
0 497 267 | Aug 1992 | EP |
58-098917 | Jun 1983 | JP |
04-291916 | Oct 1992 | JP |
05-047666 | Feb 1993 | JP |
05-206036 | Aug 1993 | JP |
05-234899 | Sep 1993 | JP |
05-270997 | Oct 1993 | JP |
06-224138 | Aug 1994 | JP |
2000-212752 | Aug 2000 | JP |
2000-319772 | Nov 2000 | JP |
2001-020075 | Jan 2001 | JP |
WO 9617107 | Jun 1996 | WO |
WO 9901595 | Jan 1999 | WO |
WO 9965064 | Dec 1999 | WO |
WO 0079576 | Dec 2000 | WO |
WO 0136702 | May 2001 | WO |
WO 0208488 | Jan 2002 | WO |
WO 0245871 | Jun 2002 | WO |
WO 0323835 | Mar 2003 | WO |