Method and device for serial communication

Abstract: An asynchronous serial communication device in which data transmitted at different speeds coexist and are exchanged, time losses when errors are generated are effectively eliminated, asynchronous serial data communications for diagnosing failures are performed between a diagnosing tool (5) and an electronic controller (1, 2) via a communications line (3). In performing the data communications, first data are exchanged between these devices at a low transmission speed (5bps) and then by switching the speed to high speed (10.4Kbps) various data are exchanged. In a case where communication errors are generated during exchanging, the operation is started again from the data exchanging at the low speed. Here, the edges of the data sampled at the low speed are detected by an edge detecting terminal provided in a communication circuit (17), a communication error is identified when a difference between first edge detecting time and next edge detecting time is shorter than 1 bit time of the low transmission speed data, and based on further next edge detecting timing the data receiving by the low speed sampling is started over again.

Description: The present invention relates to a method and device for serial communication device in a communication system for performing diagnostic data communications between various kinds of electronic controllers mounted on vehicles, such as an engine electronic controller, a transmission electronic controller and the like, and diagnosing tool (diagnosing devices) externally connectable thereto, and the invention is designed to improve the structure of a communication device for increasing data receiving efficiency in these electronic controllers. There has been tremendous progress in the use of electronic equipment for vehicles in recent years, realizing by means of microcomputers, high-level electronic control of devices mounted on various parts of vehicles including engines, transmissions and the like. As a result, controllability of these devices has been improved by leaps and bounds. On the other hand, however, diagnosing the troubles or malfunctions of these devices has been made more complicated. Under these circumstances, various measures have been taken to deal with diagnosis of a vehicular system, which is becoming increasingly complex. The measures taken thus far include improvements to a number of on-vehicle electronic controllers by adding self-diagnosing functions thereto, which allow diagnosis of the troubles of on-vehicle equipment and the controllers simultaneously when the equipment is controlled, the devising of a system connectable to external diagnostic devices called diagnosing tools and capable of performing higher level trouble diagnosis and diagnostic data analysis under the support of the diagnosing tool and the like. Recently in particular, attention has been increasingly paid to a method of diagnosing a vehicular system with various on-vehicle electronic controllers under the support of an external diagnosing tool in that by this method predetermined optional diagnostic data can be flexibly specified externally by the diagnosing tool and highly reliable analysis can be performed based on the diagnostic data received thereby. When a vehicular system is diagnosed using the external diagnosing tool, data communications are performed between the diagnosing tool and the electronic controllers usually based on a system structure specified by International Standard ISO-9141 like that shown in Fig. 6. According to this Standard, serial data communications for diagnosis are performed using only one two-way or bidirectional communications line called a K line or using two communications lines formed by adding a one-way or unidirectional communications line called an L line to this K line. The K line is usually used when a data linkage is to be established between the diagnosing tool and the electronic controllers. More specifically, this line is used together with the L line when address information is transmitted from the diagnosing tool to the electronic controllers targeted for diagnosis and initialized, and after this initialization is completed this line is singly used as a communications channel through which various messages are exchanged between the diagnosing tool and the electronic controllers. On the other hand, the L line which is a one-way communications line from the side of the diagnosing tool is used as a communications channel for giving instructions to start communications to the electronic controllers only when address information is transmitted from the diagnosing tool to the electronic controllers targeted for diagnosis and initialized, and in other cases this line is maintained in an idle state (a logical H (high) level). Thus, it is preferable in terms of accurately grasping starting of the communications that the electronic controllers are provided with two communication terminals TM1 and TM2 corresponding to these K and L lines. In reality, however, as shown in Fig. 6, all the electronic controllers are not necessarily equipped with two such communication terminals. Given a situation like this, the Standard regulates, as described above, that the communication system can be established even when only one K line is used and communication specifications and procedures are arranged in order to allow normal data exchange even in such a case. Fig. 7 shows one example of the communication procedures arranged according to the Standard ISO-9141 and executed through the K line. As shown in Fig. 7, according to the Standard, the data communications for diagnosis follow the following procedure: (1) "Address" information on the object electronic controller is sent as data D1 from the diagnosing tool to the electronic controller targeted for diagnosis. Transmission of this "address" information is performed at a low speed of 5bps (bit/sec.), etc., so as to surely form a data linkage between these devices. (2) After receiving the address information and identifying that it indicates address of its own, the electronic controller sends "a synchronizing signal", "a key word 1" and "a key word 2" as data D2, D3 and D4 in sequence to the diagnosing tool. The data communications thereafter including transmission of these data D2 to D4 are executed by being switched to a high speed of 10.4Kbps, etc. (3) After receiving the data D2 to D4, for the purpose of confirmation, the diagnosing tool forms data "/keyword 2" by reversing the logic of the "keyword 2"as data D5 and sends this to the electronic controller. (4) After receiving the data "/keyword 2" which is the reverse of the logic of the "keyword 2", for the purpose of further confirmation, the electronic controller forms data "/address" by reversing the logic of "address" of its own as data D6 and sends this to the diagnosing tool. (5) After confirming the object electronic controller targeted for diagnosis through the data exchanges in (1) to (4), the diagnosing tool completes initialization and sends "a first request message" as data D7 for starting specified diagnosis to the electronic controller. (6) After receiving the "first request message", the electronic controller forms "a response message" as data D8 in order to respond to the request and sends this to the diagnosing tool. (7) After receiving the "response message", the diagnosing tool sends second, third,... "request messages" to the electronic controller when necessary and ends the communications relating to the diagnosis by receiving a last "response message" given by the electronic controller in response to a last "request message". (8) The diagnosing tool repeats transmission of the "address" information at the speed of 5bps (data D10) when necessary, including reexecution of the diagnosis, doing the diagnosis over again because of communication failures and the like. An 8 bit NRZ (non-return zero) system like that shown in Fig. 8 is adopted for a bit format of each data byte constituting the above-mentioned data and messages. A start bit of a logical L (low) level is added to the head thereof while a stop bit of a logical H (high) level is added to the end, enabling recognition of existence of the data byte. Thus, in asynchronous communications which do not need private or exclusive synchronous lines, data is fetched by detecting the start bit edge of the data transmitted to a signal line and then sampling only a specified bit length every 1 bit time. This means, in other words, that as long as sampling of a specified bit length is not finished after the start bit edge is detected, communication failures which occur cannot be detected. When communication failures are detected, the communication procedure is repeated from the start including "address" information exchanges and initialization, and on the receiving side the procedure is repeated from sampling at the low speed of 5bps so as to receive the "address" information. On the other hand, in the protocol which allows coexistence of data communications based on low and high speed transmissions each time a series of communications are performed as in the procedure according to the International Standard ISO-9141 for vehicle diagnosing communication system, shifts in communication synchronization are generated due to noises, etc., making it possible for data transmitted at a high speed to be received by low speed sampling. When this situation occurs, the following inconveniences will take place together with the above-described characteristics of the asynchronous communications: (1) Detection of communication failures is possible only after low speed sampling is performed by the specified bit length. That is, it takes a long time for a communication failure to be detected. (2) For this reason, restoration of communication synchronization is delayed, extending the period of time for diagnosing a vehicle itself. This is described further in detail by referring to Figs. 9(a) and 9(b) in the following. Here, it is assumed that with respect to data transmitted by the diagnosing tool in a mode shown in Fig. 9(a), an error E is generated during the operation process P1 of receiving data D11 on the electronic controller side as shown in Fig. 9(b). In this case, since the processing is started again from the low speed sampling on the electronic controller side, a receiving operation process P2 by the low speed sampling is started accompanying the detection of the start bit edge of data D12 transmitted at a high speed. Once such receiving operation process P2 by the low speed sampling is started, the error cannot be detected until the sampling of a specified bit length (in this case, 200ms × 10bits = 2s length) is finished. As a result, on the electronic controller side, a receiving operation process P3 by the low speed sampling is executed again with respect to low speed data D13 as shown in Fig. 9(b) after the operation process P2 is over. According to the Standard ISO-9141, the maximum time given to the diagnosing tool from detecting communication errors to starting retransmission of data ("address" information) at a low speed of 5bps, etc., is set at 300ms. Thus, in the worst case, it is possible that without correction of such shifts in synchronization, the low speed data exchanges are repeated endlessly. Conventionally, switching of the speeds by which the received data is sampled on the electronic controller has been made possible by replacing receiving registers in which exclusive sampling speeds are set. In the foregoing description, as a matter of convenience, reference has been made only to the data communications between the diagnosing tool and various on-vehicle electronic controllers based on the International Standard ISO-9141. However, the above-described situations generally apply to an environment in which in asynchronous serial communications data transmitted at different speeds coexist and are exchanged. DE-A-4230796 discloses a serial communication method for asynchronously communicating serial data transmitted at different speeds between a plurality of devices. Data is received at one device from another device at a first sampling speed and thereafter at a second sampling speed. The present invention has been made in view of the above-described background and it is an object of the invention to provide a method and device for serial communication capable of eliminating time losses in a preferred way at the time of error occurrences even in an asynchronous serial communication environment in which data transmitted at different speeds coexist and are exchanged. According to the present invention there is provided a serial communication method for asynchronously communicating serial data transmitted at different speeds between a plurality of devices, the method comprising the steps of: receiving at one device first data from another device at a first sampling speed characterised in that the method further comprises the steps of: determining a communication error when second data at a second sampling speed is received at the first data receiving step; and restarting the first data receiving step upon determination of the communication error. Edge detecting means and error processing means may be provided. At the time of receiving data by means of low speed sampling, a communication error is identified to be generated when a difference between first edge detecting time and next edge detecting time by the edge detecting means is shorter than 1 bit time of data transmitted at a low speed and the data receiving is repeated again by the low speed sampling based on timing with which the edge detecting means detects further next edge. This error processing makes it possible to accurately detect the existence of the communication error in "the timing with which the edge detecting means detects further next edge" even during receiving of the data by this low speed sampling. Also, by repeating the data receiving by the low speed sampling based on this timing, communication synchronization thereof can be restored with this timing in the shortest case. In short, by performing this error processing, time losses at the time when errors occur can be eliminated in a preferred way restoring the communication synchronization in a shorter time and surely. If the edge detecting means is provided separately from a communication terminal for exchanging the serial data and an edge detecting terminal is provided specially for identifying the threshold values of changes in the logic levels of the serial data, that is, if the means is constructed as hardware for performing edge detection, the edge of the serial data can be surely detected irrespective of the transmitting speed thereof and the receiving sampling speed. The edge detecting means can also be constructed as software for detecting the edge when data inputted from the communication terminal for receiving the serial data are sampled at predetermined time intervals and the signals of the sampled data show a specified difference in levels between the two respectively. That is, since the error processing based on this edge detection is executed when the data are received by the low speed sampling, even in such a structure constructed as software for detecting the edge of the serial data this processing is sufficiently dealt within terms of speeds. Moreover, in this case, special hardware is made unnecessary and the edge detecting means can be realized more easily. The serial data communications by means of the asynchronization are executed within a communication system in which a plurality of on-vehicle electronic controllers as slave devices and an external device as a master device are connected or one of the controllers and the external device are connected via a communications channel. The data transmitted at the low speed is the address data of the slave device to be first transmitted from the master device thereto when a data linkage is to be established between the master device and the slave device. In the serial communication device, the slave device receives the address data by means of low speed sampling. If the device is constructed in this way, even in the case of data communications between a diagnosing tool and various on-vehicle electronic controllers, time for diagnosing the failures of a vehicle is not unnecessarily lengthened due to errors in the communications and the overall diagnosing time can even be shortened. In the accompanying drawings: Fig. 1 is a block diagram showing a preferred embodiment of a serial communication device of the invention; Fig. 2 is a block diagram showing a terminal structure of a communication circuit shown in Fig. 1; Fig. 3 is a flow chart showing a communication processing procedure in each electronic controller; Fig. 4 is a flow chart showing in detail a communication processing, in particular a receiving processing at a speed of 5bps; Figs. 5(a) to 5(c) are time charts respectively showing mainly receiving processing modes when errors occur in the device in the preferred embodiment; Fig. 6 is a block diagram showing the structure of a conventional communication system between a diagnosing tool and on-vehicle electronic controllers; Fig. 7 is a time chart showing a communication procedure based on the International Standard ISO-9141 for the communication system; Fig. 8 is a time chart showing the bit format of data byte; and Figs. 9(a) and 9(b) are time charts showing receiving processing modes when errors occur in the conventional communication device. Fig. 1 shows one preferred embodiment of a method and device for serial communication according to the present invention. In the preferred embodiment, the device is constructed as an asynchronous serial communication system for performing data communications for diagnosis between various on-vehicle electronic controllers and diagnosing tool externally connectable thereto, especially for maintaining the data receiving efficiency of the controllers at a high level. First, explanation will be made of the structures of the communication system and the communication device in the preferred embodiment. In the communication system, a plurality of on-vehicle electronic controllers comprising, for instance, an engine controller 1 and a transmission controller 2 are connected via a communications line 3 (equivalent to the above-mentioned K line) and, to these on-vehicle electronic controllers, a diagnosing tool 5 as an external diagnosing device is further connected via the communications line 3 and a diagnosis connector 4. As a communication system between these external diagnosing tool 5 and on-vehicle electronic controllers connected to one another, for instance, the engine controller 1 and the transmission controller 2, a multiplex communication system called SCI (Serial Communication Interface) is used. As communication protocol for multiplex communications, one conforming to the Standard ISO-9141 which is an International Standard Organization in Europe is used. Each of these elements will be described in detail hereinbelow. Here, as one example of the on-vehicle electronic controllers, the structure and function of the engine controller 1 is explained. The engine controller 1 is, as shown in Fig. 1,constructed by a CPU 11, a ROM 12, a RAM 13, an input circuit 14, an output circuit 15, an AD conversion (ADC) circuit 16, a communication circuit (CM) 17, etc. The communication circuit 17 is a circuit having functions for mainly converting the ISO-9141 signal format of a diagnosing request message sent from the diagnosing tool 5, that is, 10 bit format of SCI (see Fig. 8), into a digital signal to be read by the CPU 11, reverse-converting a response message outputted from the CPU 11 in the ISO-9141 message format into the 10 bit format of SCI, etc. These bit format converting functions can be realized in hardware called a UART (an asynchronous communication circuit) and the content of a message constructed based on the 10 bit format of SCI can be processed by software. Inputted to the input circuit 14 constituting the engine controller 1 are sensor signals mainly made of pulse signals outputted from such sensors as a crank angle sensor 21 for detecting an engine speed, a car speed sensor 22, and the like while inputted to the AD conversion circuit 16 are sensor signals made of analog signals outputted from such sensors provided on respective parts of a vehicle as a throttle sensor 23, an air flow meter 24, a water temperature sensor 25, an O 2 (oxygen) sensor 26 and the like. These sensor signals are stored in a data area in the RAM 13 as sensor data corresponding to the detected values thereof and utilized as operation values on the basis of which the CPU 11 calculates a fuel injection quantity and ignition time. The CPU 11 calculates a fuel injection quantity and ignition time each time by executing a specified operation based on the sensor data fetched in the RAM 13 in accordance with a control program preinstalled in the ROM 12, exchanges communication messages (described later) with the diagnosing tool 5 and executes diagnosing processing specified through the messages. The fuel injection quantity thus calculated by the CPU 11 is given to the output circuit 15 and a signal corresponding to the obtained fuel injection quantity is outputted through this output circuit 15 to engine control device 27. As this engine control device 27, for instance, a fuel injection valve can be used. When the diagnosing processing is operated, the sensor data fetched in the RAM 13 are sequentially read by the CPU 11 in accordance with an instruction given by the diagnosing tool 5 for reading RAM values and the data thus read are outputted as diagnosing data to the communications line 3 via the communication circuit 17. Meanwhile, the diagnosing tool 5 is electrically connectable to the on-vehicle electronic controllers (in this case, the engine controller 1, the transmission controller 2, etc.) via the diagnosis connector 4 when the on-vehicle electronic controllers or the vehicular system therethrough need to be diagnosed, reads the data read as the diagnosing data and supports diagnosing of these data. The diagnosing tool 5 usually reports the existence of errors in the data to those who perform diagnosing by displaying the read diagnosing data altogether on a display portion or graphically displaying them. Electric power is supplied from a battery 19 to the diagnosis connector 4 through an ignition switch 18 and power is also supplied to the diagnosing tool 5 via the diagnosis connector 4 when the tool 5 is electrically connected to the on-vehicle electronic controllers. Next, explanation will be made of the terminal structure of the communication circuit 17 constituting the communication device in the preferred embodiment by referring to Fig. 2. As shown in Fig. 2, the communication circuit 17 is constructed by data transmission and receiving terminals (TxD) 171 and (RxD) 172 and an edge detecting terminal (Port) 173 specially set for identifying the threshold values of changes in logical levels when the data are received at a low speed (sampling). Here, the transmission and receiving terminals (TxD and RxD) 171 and 172 are equivalent to the communication terminal TM 1 corresponding to the K line in Fig. 6 and constructed as part of the UART (asychronous communication circuit) for realizing the bit format conversion function in the communication circuit 17. The edge detecting terminal (Port) 173 is a terminal equivalent to a port input usually provided in a CPU, and in the communication device in the embodiment the edge parts of the received serial data (timing) are monitored through this edge detecting terminal 173. Furthermore, in the communication device in the embodiment, the speed of the data sampling by this edge detecting terminal 173 is fixed at 5bps while that of the data transmission by the transmission terminal 171 and that of the data sampling by the receiving terminal 172 are fixed at 10.4Kbps. As previously described, the data communications between the diagnosing tool and the communication device in the embodiment (controller 1 or 2) executed based on the International Standard ISO-9141 follow the conventional procedure shown in Fig. 7. Figs. 3 and 4 show procedures to be performed when the asynchronous serial data communications are performed mainly through the CPU 11 and the communication circuit 17 in the communication device in the embodiment. Next, detailed explanation will be made of the operation of the communication device in the preferred embodiment by referring to Figs. 3 and 4. First, the whole communication processing procedure executed through the communication device in the embodiment is described with reference to Fig. 3. In this communication processing, when "address" information is transmitted from the diagnosing tool 5 in a mode shown as the data D1 in Fig. 7, the CPU 11 first executes receiving processing by means of low speed sampling, e.g., at 5bps, through the edge detecting terminal 173 in a step 110. Details on the receiving processing at the speed of 5bps will be described later by referring to Fig. 4. After finishing the receiving operation at the speed of 5bps, the CPU 11 switches the transmission and sampling speeds of the communication circuit 17 from 5bps to a high speed of 10.4Kbps in a step 120. That is, the communication terminal of the circuit 17 is switched from the edge detecting terminal (Port) 173 to the transmission and receiving terminals (TxD and RxD) 171 and 172. Then, the CPU 11 exchanges various data shown as D2 to D8 in Fig. 7 with the diagnosing tool 5 by repeating operations in steps 130, 140, 170 and 180. When there are no more requests from the diagnosing tool 5, the condition of "time over" in a step 150 is satisfied. After this "time over" condition is satisfied, the CPU 11 lastly switches the transmission and sampling speeds of the communication circuit 17 from 10.4Kbps to 5bps, that is, switches the communication terminal of the circuit 17 from the transmission and receiving terminals (TxD and RxD) 171 and 172 to the edge detecting terminal (Port) 173, and then ends the communication processing. In case where SCI format errors, e.g., a stop bit error, shown in Fig. 8, are detected when the data are exchanged with the diagnosing tool 5 in the step 180, or in case where message format errors, e.g., an error in the checking code of the received message (check-sum, etc.), are detected, the processing is forcibly moved to a step 160, and after the transmission speed is switched, the communication processing is forcibly ended. More specifically, even when some data are transmitted from the diagnosing tool 5 thereafter, in the communication device the processing is started again from "receiving at the speed of 5bps" in the step 110. Next, detailed explanation will be made of the "receiving at the speed of 5bps" in the step 110 by referring to Fig. 4. In this receiving operation, the CPU 11 first executes initialization in a step 111. This initialization includes that of a receiving register in the RAM 13 shown in Fig. 1, that of edge detecting counts and the like. After the initialization is over, the CPU 11 identifies the completion of receiving the data ("address" information) transmitted at the speed of 5bps in a step 112. If the completion of the data receiving is identified (10 bits have been received), the CPU 11 ends this operation and returns to the communication processing shown in Fig. 3. As previously described, after the initialization the data are allowed to be sampled at a low speed through the edge detecting terminal 173 of the communication circuit 17. On the other hand, in case where the non-completion of the data receiving is identified including the first fetching of the data at the speed of 5bps in the step 112, the CPU 11 further identifies the existence of the edge detection by the edge detecting terminal 173 in a step 113. In the receiving processing, these identifying operations in the steps 112 and 113 are repeated until completion of the data receiving or detection of the data edge. Now, if the edge of the data is detected including the start bit of the 5bps data, the detection time is stored in a specified area in the RAM 13 in a next step 114. If this is the first edge of the data in which edge detection count is "1", that is, the falling edge of the start bit, the operations in the steps 112, 113 and 114 are repeated until a next edge is detected. Then, when a second edge is detected, a difference between the current edge detecting time and the previous edge detecting time (first) is calculated in a step 116, and this calculated time difference is compared with time "150ms (milliseconds)" in a next step 117. Here, the time "150ms" is a value obtained by including the margin of "50ms" in "200ms" which is 1bit time of the 5bps data. In the communication device in the embodiment, in case where the time difference is found to be equal to "150ms" or higher by the comparison in the step 117, the operations in the steps 112 to 117 are repeated by determining that normal data receiving is maintained. Furthermore, in case where the time difference is found to be below the time "150ms" by the comparison in the step 117, the communication device in the embodiment ends the receiving processing by determining that communication errors have taken place. Then, the device performs the operation again starting from the initialization in the step 111. More specifically, the maximum edge interval time of the data transmitted at a high speed of, for instance, 10.4Kbps, is 9 bit time from the first rising edge of the start bit thereof to the first rising edge of the stop bit, that is, about "1ms". On the other hand, the minimum edge interval time of the 5bps data is "200ms" which is 1 bit time as described above, sufficiently larger compared with "1ms". For this reason, an edge having time interval shorter than the time "150ms (200ms - 50ms(margin)" is the one of the 10.4Kbps data, or due to noises, and in the communication device in the embodiment, in case where there exists an edge having such short time interval, communication errors are identified. Figs. 5(a) to 5(c) show a receiving processing mode in the communication device in the preferred embodiment in comparison with that in a conventional device. In the following, this receiving operation in the communication device in the embodiment is described in detail by referring to Figs. 5(a) to 5(c). Conventionally, with respect to data transmitted by the diagnosing tool in a mode shown in Fig. 5(a), as indicated by P11 to P13 in Fig. 5(b) corresponding to P1 to P3 in Fig. 9(b), the receiving operation has followed the following modes: (1) In case where some error E is generated in the receiving processing P11 of data D11, since the operation is restarted from low speed sampling in the electronic controller side, the receiving processing P12 by means of the low speed sampling is started accompanying detection of the start bit edge of data D12 transmitted at a high speed; (2) Once the receiving processing P12 by the low speed sampling is started, errors thereof cannot be detected until sampling of the specified bit length (200m × 10 bits = 2s) is over; (3) As a result, in the electronic controller side, after this receiving processing P12 is over, the receiving processing P13 by means of low speed sampling is executed with respect to data D13 in the mode shown in Fig. 5(b) again; and (4) According to the above-described Standard ISO-9141, the maximum time allowed from identification of communication errors by the diagnosing tool to starting of retransmission of the data ("address" information) at the low speed of 5bps is set at 300ms. Thus, in the worst case, there is a possibility that the low speed data exchanges are repeated endlessly while shifts in synchronization are left intact. In order to counter the defects of the receiving operation in the conventional device, as shown in Fig. 5(c), the communication device in the preferred embodiment follows the following modes: (1) In case where an error E is generated for some reason or other in the receiving processing P21 of the data D11 at time t1, in the electronic controller side the operation is started again from the low speed sampling upon arrival of the data D12 at time t2. Thus, as in the case of the conventional device, receiving processing P22 by means of low speed sampling is started following detection of the start bit edge of the data D12 transmitted at a high speed; (2) In the communication device in the embodiment, however, through the 5bps receiving processing shown in Fig. 4 errors in the receiving processing P22 are detected at time t3 based on determination (time t3 - time t2 < 150ms) and the processing P22 is interrupted; and (3) Upon arrival of the low speed data D13 from the diagnosing tool 5 at time t4, as receiving processing P23 the low speed sampling is performed again at the time t4 and at time t5 the processing P23 by the low speed sampling is normally ended. According to the serial communication device in the preferred embodiment, even during data receiving by the low speed sampling communication errors can be detected immediately and surely. It is with error detection timing that the data receiving by the low speed sampling is performed again (to be exact, the operation is placed on standby for transmission of new data from the diagnosing tool 5). In the shortest case, the communication synchronization is restored with this timing. Thus, according to this error processing, time losses at the time of error occurences can be eliminated and the communication synchronization can be surely restored within a short time. Furthermore, in the communication device in the embodiment as means for detecting edges at the time of low speed sampling (5bps receiving processing) the special edge detecting terminal 173 shown in Fig. 2 is used. Thus, it is possible to surely detect the edge of the data irrespective of the data transmission and receiving sampling speeds. However, in view of the fact that the error processing based on this edge detection is executed at the time of data receiving by the low speed sampling, it may be advisable to provide edge detecting means as software for detecting the relevant edge when data inputted from the receiving terminal (RxD) 172 are sampled at specified time intervals and the signal levels of these sampled data show a specified difference between the two respectively. Even when the device is constructed having means as software for detecting the edge of serial data as in the above, errors can be sufficiently dealt within terms of speeds. Moreover, in this case, the special edge detecting terminal 173 is made unnecessary, making it easier to realize edge detecting means. In the above description of the preferred embodiment, reference was made to a case where the serial communication device provided by the present invention is applied to the system for data communications performed between the diagnosing tool 5 and the electronic controller 1 or 2 conforming to the International Standard ISO-9141. This device can also be applied to a communication system in which a communications channel is formed among a plurality of on-vehicle electronic controllers with one as a master and the others as slaves. Furthermore, data communication protocol among these devices is not limited to that specified by the International Standard ISO-9141. Rather it can be selected optionally. The fact is that as long as a serial communication system by which serial data transmitted at different speeds are asynchronously communicated is used, the same effects as in the case of the preferred embodiment can be obtained by adopting the communication device of the invention. The transmission speeds of the data are not limited to the two, low and high, either. For example, even when three data transmission speeds, low, medium and high, coexist, it is basically possible to perform the above-described receiving processing with respect to low or medium speed data. In this case, moreover, even when communication errors are generated during receiving of the data, time losses can be effectively eliminated by adopting the receiving processing. As explained in detail above, according to the present invention, even in the asynchronous serial communication environment in which data transmitted at different speeds coexist and are exchanged, it is possible to effectively eliminate time losses when communication errors are generated. The present invention is not limited to the disclosed embodiment and its modifications but may be modified in many other ways.

Claims: A serial communication method for asynchronously communicating serial data transmitted at different speeds between a plurality of devices, the method comprising the steps of: receiving (110) at one device (1, 2) first data from another device (5) at a first sampling speed characterised in that the method further comprises the steps of: determining (111-117) a communication error when second data at a second sampling speed is received at the first data receiving step; and restarting the first data receiving step upon determination of the communication error. A serial communication method according to claim 1, wherein the first sampling speed is for receiving the first data to be transmitted when data transmission is started. A serial communication method according to claim 1 or claim 2, wherein the first sampling speed is lower than the second sampling speed. A serial communication method according to claim 1, 2 or 3, wherein the determining step measures the time difference between detecting times of a first edge and the next edge of each bit of the first data and determines whether the difference is shorter than a predetermined 1 bit time of the first data. A serial communication method according to claim 4, wherein the edge detection is performed by a special edge detecting terminal (173) of the one device (1, 2) other than a terminal for receiving the second data. A serial communication method according to claim 4, wherein the edge detection is performed by software on data sampled at specified timing with respect to a specified difference in signal levels. A serial communication method according to any preceding claim, wherein at least one of the devices (1, 2) is an on-vehicle electronic controller, and the first data is an address data to be transmitted first when a data linkage is to be established. A serial communication method according to any preceding claim, wherein the length of the second data transmitted after the first data is shorter than 1 bit time of the first data. A serial communication device for asynchronously receiving serial data at different transmission speeds, the device comprising: edge detecting means (17, 173) for detecting rising and falling edges of the serial data; and error processing means (110-117) for determining a communication error when the time difference between detection of a first edge and the next edge by the edge detecting means (17, 173) is shorter than a 1 bit time of the low transmission speed data at the time of receiving data by low speed sampling, and restarting receiving data by the low speed data sampling at the time of a further edge detection time by the edge detecting means (17, 173). A serial communication device according to claim 9, wherein the edge detecting means includes: an edge detecting terminal (173) provided exclusively and separately from a communication terminal (171, 172) provided for transmission of the serial data. A serial communication device according to claim 9 or claim 10, wherein the edge detecting means (17, 173) samples at a predetermined time interval the data inputted through a communication terminal (171, 172) for receiving the serial data and detects by software the edge when each signal level of the sampled data shows a level change between the successive two. A serial communication device according to any one of claims 9 to 11, wherein: the asynchronous serial communication is performed in a communication system between a slave device (1, 2) and a master device (5), the slave device (1, 2) including a plurality of electronic controllers mounted on a vehicle and the master device (5) including an external device or one of the electronic controllers mounted on the vehicle; the low transmission speed data is address data of the slave device (1, 2) to be transmitted first from the master device (5) to the slave device (1, 2) at the time of establishing data link between the master device (5) and the slave device (1, 2); and the slave device (1, 2) receives the address data by the low speed sampling. A serial communication method according to claim 1, for asynchronously communicating serial data transmitted at different speeds between a plurality of devices through a communication line, the method comprising the steps of: receiving at one device (1, 2) through the communication line first data from another device (5) at a first fixed sampling speed; determining a communication error when second data which is to be communicated at a second fixed sampling speed different from the first sampling speed is received during the first data receiving step; and restarting the first data receiving step upon determination of the communication error thereby inhibiting switching of sampling speeds from the first sampling speed to the second sampling speed. A serial communication device according to claim 9, for asynchronously receiving first and second serial data through a communication line at different transmission speeds, the device comprising: edge detecting means (17, 173) for detecting rising and falling edges of the first serial data; error processing means (110-117) for determining a first data communication error when the time difference between detection of a first edge and the next edge by the edge detecting means is shorter than a 1 bit time of the low transmission speed data at a time of receiving the first serial data by low speed sampling, and restarting receiving the first serial data by the low speed data sampling at the time of detection of a further edge by the edge detecting means (13, 173). A serial communication device according to claim 14, wherein the device includes speed switching means for switching from low speed sampling to high speed sampling to enable communication of the second serial data, when no error in receiving the first serial data is determined.

Inventors: KOBAYASHI MASAYUKI, KOBAYASHI, MASAYUKI
Applicants: DENSO CORP, DENSO CORPORATION
Application year: 1995
Main classification: H04L1
IPC codes: H04L7, H04L12, B60R16, F02D45