LOCAL NETWORK COMMUNICATION PROTOCOL
FIELD OF THE INVENTION
The present invention relates, in general, to communication protocol and, more particularly, to communication protocol between a device and a network.
BACKGROUND OF THE INVENTION
Electronic devices are widely used in various aspects of daily life. Many electronic devices, such, as those found in mobile telephones, automobile control systems, vending machines, utility meters, security systems, medical monitoring systems, etc., include microprocessors such as, for example, embedded microcontroller units (MCUs) for performing different functions and processes. It is often desirable to connect the MCU in an electronic device to a network such as Internet, so that the operation of the electronic device can be remotely monitored and/or controlled.
One approach for connecting a microprocessor such as an MCU to a network is to program a network protocol, e.g., Transmission Control Protocol/Internet Protocol (TCP/IP) , into the MCU. An MCU with TCP/IP programmed therein can access Internet through a modulation and demodulation device (MODEM) . This approach normally needs an MCU of at least 16 bits . It also needs a large
memory, e.g., at least 32 kilobytes, and a high operating speed in order to achieve a satisfactory performance. Furthermore, the engineers who program the MCU chip must be familiar not only with the applications of the MCU but also with the TCP/IP protocol and related interfaces. Therefore, this approach usually requires a long development period, a high performance chip, and is cost inefficient .
Another approach for connecting a microprocessor such as an MCU to a network is to establish an off chip network interface, e.g., an interface developed by emWare, Inc. under the trademark "emGateway", and program a network interface compatible protocol, e.g., a protocol developed by emWare, Inc. under the trademark "emNet", into the MCU chip. An MCU with emNet programmed therein can access Internet via the network interface emGateway. Although emNet requires less memory than TCP/IP, this approach still requires the design engineers to be familiar not only with the application of the MCU but also with the emΝet and related interfaces. The emΝet is built on the concept of distributed memory architecture that shares variables, events, functions, and messages between the emGateway and the MCU. This shared memory concept adversely affects the application programming flexibility. Furthermore, the existing MCU chips in a user's application systems may not satisfy the designer's expectation because of chip capability, memory, speed, etc. Therefore, this approach often also requires a long development period, a relatively high performance chip, and is cost inefficient.
Accordingly, it would be advantageous to have a cost efficient method for communicating between a microprocessor and a network. It is desirable for the method to be simple and reliable. It is also desirable for the method to be compatible with different types of microprocessors in terms of capabilities, performances, costs, etc. It would be of further advantage for the method to be compatible with a user's existing microprocessor chips .
SUMMARY OF THE INVENTION
A general aspect of the present invention is to provide a simple and cost efficient process for communicating between a microprocessor and a network. A particular aspect of the present invention is to provide a communication protocol between the network and microprocessors with wide spectra of applications, capabilities, performances, bit numbers, memory sizes, etc. A further aspect of the present invention is that the communication process and protocol can be readily implemented with an existing microprocessor chip.
In order to achieve these and other aspects of the present invention, a method for communicating between a microprocessor and a network is implemented by coupling a microprocessor interface or a signal adapter to the microprocessor and coupling a network interface or gateway between the signal adapter and the network. The signal adapter communicates with the microprocessor in accordance with a microprocessor-interface protocol that
can be implemented without significant changes to the software and hardware structures of the microprocessor. A local network protocol is implemented for the communication between the network gateway and the signal adapter. By way of example, the local network protocol is sometimes referred to as MCU Application Protocol (MCUAP) . The local network protocol establishes a master-slave relation between the network gateway and the signal adapter. The signal adapter, functions as an intermediary between the microprocessor and the network gateway, and the network gateway functions as an intermediary between the signal adapter and, the network.
A signal in the network typically follows a network protocol. For example, a signal in the Internet typically follows Transmission Control Protocol/Internet Protocol (TCP/IP) . In accordance with the present invention, a signal in the network is sent to the microprocessor through the network gateway and the signal adapter. The network gateway coverts the signal from TCP/IP to the local network protocol, and the signal adapter converts the signal from the local network protocol to the microprocessor protocol acceptable to the microprocessor .
The return signal from the microprocessor is sent to the signal adapter according to the microprocessor- interface protocol. The signal adapter converts the signal from the microprocessor-interface protocol to the local network protocol and sends the converted signal to the network gateway. The network gateway converts the signal into the network protocol sends it to the network.
The local network protocol in accordance with the present invention establishes a master-slave relationship between the network gateway and the signal adapters. As a master with respect to the signal adapters, the network gateway can send commands and requests to the signal adapters. As a slave respect to the network gateway, a signal adapter responds the commands and requests from the network gateway. The signal adapter cannot initiate commands and requests to the network gateway.. When connected to the network gateway, the signal adapter can report an event to the network gateway in response to an event polling command from the network gateway. Preferably, the network gateway periodically sends event polling commands to the signal adapters, thereby enabling the ' signal adapters to timely report the events to the network gateway. If an event happens in a signal adapter or reported to the signal adapter from a microprocessor coupled thereto when the signal adapter is disconnected from the network gateway, the signal adapter will request connection from the network gateway. After being connected to the network gateway, the signal adapter reports the event to network gateway in response to an event polling signal from the network gateway.
The local network protocol in accordance with the present invention provides an object-oriented method and treats parameters in the microprocessor as objects. An object property table is generated for each microprocessor coupled to the network gateway via a corresponding signal adapter. Each object property table includes the objects in the respective microprocessor. Through the mapping of the object property tables, the
objects in the corresponding microprocessors can be identified, accessed, described, or modified. The object property tables can be stored in the microprocessors, in the signal adapters, in the network gateway, or in a server connected to the network. During operation, an object property table can be mapped from one place, e.g., the microprocessor, to another place, e.g., the signal adapter or the network gateway. The object property tables are identified through the device names associated with the microprocessors and/or the digital identifications in the signal adapters. In accordance with a preferred embodiment of the present invention, the object property tables are accessible through pointers. The processes of the mapping object property tables pass the pointers according to the mapping instructions.
An optional feature of the local network protocol in accordance with the present invention is to support in-application re-programming (IAP) in the signal adapters and in the microprocessors. To perform an IAP process in a signal adapter, the network gateway sends an IAP request signal to the signal adapter to interrupt the application in the signal adapter. The programming codes are subsequently transmitted to the signal adapter. The signal adapter implements the new programming codes into an application memory block in the signal adapter. To perform an IAP process in a microprocessor, the network gateway sends an IAP request signal to the signal adapter coupled the microprocessor. The signal adapter reformats the request signal and transmits the reformatted signal to the microprocessor to interrupt the application in the microprocessor. The programming codes are subsequently
transmitted to the microprocessor via the signal adapter. The microprocessor implements the new programming codes into an application memory block in the microprocessor. Using the protocol in accordance with the present invention, the applications in the microprocessors can be efficiently modified and upgraded by downloading new programming codes from the network.
In conjunction with the microprocessor-interface protocol, the local network communication protocol of the present invention can establish communications between networks and microprocessors of various capabilities, performances, bit numbers, and memory sizes. Using the local network communication protocol as an intermediary between the network protocol, e.g., Internet protocol TCP/IP, and the microprocessor-interface communication protocol significantly improves the simplicity and reliability of the signal adapter coupled the microprocessor .
BRIEF DESCRIPTION OF THE DRAWINGS
Fig. 1 is a block diagram of a microprocessor- network communication system in accordance with the present invention;
Fig. 2 is a functional block diagram illustrating a local network communication protocol in accordance with the present invention;
Fig. 3 is a block diagram illustrating an object property table logic structure in a local network communication protocol in accordance with the present invent on;
Fig. 4 is a block diagram of an object in an object property table in accordance with the present invention; Fig. 5 is a block diagram illustrating a memory structure in a signal adapter for In-Application re- Programming in accordance with the present invention; and
Fig. 6 is a flow chart illustrating an In- Application re-Programming process in accordance with the present invention.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
Various embodiments of the present invention are described herein below with reference to the figures, in which elements having similar functions are labeled using the same or related reference numerals in the figures . It should be understood that the scope of the present invention is not limited to those embodiments shown in the figures and described herein below.
Figure 1 is a block diagram illustrating a microprocessor-network communication system 10 in accordance with the present invention. By way of example, Fig. 1 shows communication system 10 between a network 15 and a plurality of microprocessors 25A, 25B, ..., and 25N. In accordance with the present invention, communication system 10 is capable of establishing the communications between network 15 and any number of microprocessors, e.g., one, two, three, four, and so on. Microprocessors 25A-25N include any kinds of processing units such as, for example, digital signal processors (DSP) , central processing units (CPU) , microcontroller units (MCU), etc. Microprocessors 25A-25N can be coupled to various kinds of electronic systems (not shown) such as, for example, smart devices, utility meters, refrigeration systems, home security systems, medical monitoring systems, vending machines, navigation systems, etc. for monitoring and/or controlling the operations of those electronic systems.
Communication system 10 establishes communications between network 15 and microprocessors 25A-25N through a network gateway 12 and a plurality of interfaces or signal adapters 20A, 2OB, ..., and 2ON. By way of example, signal adapters 20A-20N can be microprocessor, communication peripheral, field programmable gate array (FPGA) , programmable logic device (PLD) , system on chip (SOC) , application specific standard product (ASSP) , application specific integrated circuit (ASIC) , DSP, CPU, MCU, etc. Signal adapter 20A is coupled to microprocessor 25A via a signal transmission line 24A. Likewise, signal adapter 2OB is coupled to microprocessor 25B via a signal transmission line 24B, and signal adapter 20N is coupled to microprocessor 25N via a signal transmission line 24N. Signal adapters 20A-20N establish communications between network gateway 12 and respective microprocessors 25A-25N. In a preferred embodiment, each of signal adapters 20A-20N and corresponding microprocessors 25A-25N is located adjacent to each other and close to respective electronic systems (not shown) coupled to corresponding microprocessors 25A-25N.
Network 15 and network gateway 12 communicate with each other using a network protocol, e.g., TCP/IP. Signal adapters 20A-20A communicate with respective microprocessors 25A-25N using a microprocessor protocol compatible with the software and hardware structures of microprocessors 25A-25N. A local network communication protocol is implemented for communications between network gateway 12 and signal adapters 20A-20N. The local network communication protocol in accordance with the present invention is simple compared with the network
protocol such as TCP/IP. Thus, the local network communication protocol enables signal adapters 20A-20N to be simple, reliable, cost efficient.
By way of example, Fig. 1 shows network interface or gateway 12 being coupled to network 15 via a signal transmission line 14 and coupled to signal adapters 20A, 20B, ..., and 20N via corresponding signal transmission lines 16A, 16B, ..., and 16N. This is not intended as limitations of the present invention. In a preferred embodiment, network 15, e.g., an Internet browser with
TCP/IP, a web page, a database, a graphic user interface (GUI), a custom application program interface, etc., and network gateway 12 are installed in a single system, e.g., an information server, a database server, a personal computer, a personal digital assistant (PDA) , a set-top box (STB), an Internet appliance (IA) , etc. Alternatively, the communications between network gateway 12 and network 15 can be either wired or wireless. The communications between network gateway 12 and signal adapters 20A-20N can also be either wired or wireless. Examples of wireless communication include radio frequency (RF) communication, the Bluetooth (having a frequency of approximately 2.4 giga-Hertz) communication, and infrared communication. Wired communication can be either serial or parallel signal transmissions. Examples of serial signal transmissions include asynchronous data transmissions following the RS-232 and RS-485 serial communication standard published by the Electronic Industries Alliance (EIA) , universal serial bus (USB) , controller area network (CAN) , consumer electronics bus (CEBus) , etc. The serial signal transmissions are
typically more cost efficient and more reliable than parallel signal transmissions. However, the parallel signal transmissions are usually faster than the serial signal transmissions. Signal transmission lines 24A-24N between signal adapters 20A-20N and microprocessors 25A- 25N can also be wired or wireless transmission lines. Like signal transmission lines 16A-1GN between network gateway 12 and signal adapters 20A-20N, signal transmission lines 24A-24N can be any kind of serial or parallel signal transmission lines. In a preferred embodiment, at least one of signal transmission lines 24A-24N includes a three-wire serial synchronous communication interface protocol referred to as a Serial Peripheral Interface (SPI) and developed by Motorola, Inc. In another preferred embodiment, at least one of signal transmission lines 24A-24N includes a multi-master bus referred to as an Inter-Integrated Circuit (I2C) bus and developed by Philips Semiconductors, Inc. In yet another preferred embodiment, at least one of signal transmission lines 24A-24N includes a serial bus developed by National Semiconductor Corporation under the trademark MICROWARE.
Figure 2 is a functional block diagram illustrating a local network communication protocol 30 in accordance with the present invention. By way of example, local network communication protocol 30, which is referred to as MCU Application Protocol (MCUAP) by way of example, governs the command and data transmissions between network gateway 12 and signal adapters 20A-20N as shown in Fig. 1. In accordance with local network communication protocol 30, network gateway 12 and signal
adapters 20A-20N have a master-slave relationship, with network gateway 12 being the master and signal adapters 20A-20N being the slaves. Similarly, signal adapters 20A-20N and respective microprocessors 25A-25N have a master-slave relationship, with adapters 20A-20N being the master and signal microprocessors 25A-25N being the slaves. A master can initiate a process in a slave by sending a command to the slave, and the slave can send a signal to the master only in response to a command from the master.
Communication protocol 30 has a multiple layer model as shown in Fig. 2. Specifically, protocol 30 includes an application layer 32, a communication interface protocol stack 34, and a physical layer 36. Application layer 32 performs the functions of defining device object properties, mapping object property tables, and transmitting commands and responses. Communication interface protocol stack 34 performs the functions of controlling data transmission and trouble shooting. Through physical layer 36, communication interface communication interface protocol stack 34 sets up connection between network gateway 12 and signal adapters 20A-20N, thereby insuring data transmission between network gateway 12 and signal adapters 20A-20N. Communication interface protocol stack 34 preferably supports various types of communication interfaces, e.g., RS-232, RS-485, universal serial bus (USB), controller area network (CAN) , consumer electronics bus (CEBus) , Bluetooth, TCP/IP, etc. For those interface protocols, e.g., RS-232 and RS-485, that do have no data links, communication interface protocol 84 preferably adds
headers and tails to the transmitted data packets. The headers and tails serve to improve the data transmission reliability. The header may include an address byte to indicate the destination network address of the transmitted data packet . The tail may include the result of a validity check of the data packet, e.g., the result of a cyclic redundancy check (CRC) . The trouble shooting process is preferably able to identify the mistakes in the signal transmission between network gateway 12 and signal adapter 20A. Examples of such mistakes include signal transmission timeout mistakes, clock signal mistakes, data packet size mistakes, signal transmission sequence mistakes, etc. Physical layer 36 determines the physical communication model, e.g., RS-232, RS-485, MODEM, USB driver, CAN driver, CEBus driver, etc., and signal levels.
Object property definition is achieved using various types of objects, which include constants, variables, events, functions, and files. Object property definition includes identifying an apparatus (not shown) or a parameter of the apparatus that is monitored and/or controlled through microprocessor 25A coupled to signal adapter 20A, which uses local communication protocol 30 to communicate with network gateway. Examples of apparatuses that can be monitored and/or controlled through microprocessor 25A in accordance with the present invention include, but are not limited to, personal communication system, television, high fidelity audio equipment, home entertainment system, refrigerator, home cooling and heating system, home security system, irrigation system, automobile control system.
Application layer 32 in local network communication protocol 30 describes an object, e.g., temperature, humidity, pressure, air quality, volume, bass, treble, brightness, contrast, etc., through various types of objects including constants, variables, events, functions, and files. Microprocessor 25A and the apparatus controlled/monitored by microprocessor 25A are collectively referred to as a device. The objects associated with each device in communication system 10 are grouped together in one object property table.
Network gateway 12 accesses the objects by the mapping of the object property tables. After mapping, network gateway 12 can identify the object property table associated with each device and access the objects in the identified object tables.
OBJECT PROPERTY TABLE MAPPING
Figure 3 is a block diagram illustrating an object property table logic structure 40 in local network communication protocol 30 in accordance with the present invention. Figure 3 shows logical structure 40 having object property tables 42A, 42B, ..., and 42N. By way of example, object property table 42A, 42B, ..., and 42N are associated with microprocessors 25A, 25B, , ..., and 25N, respectively, coupled to respective signal adapters 20A, 20B, ..., and 20N, as shown in Fig. 1.
Using object property table 42A, network gateway 12 communicates with signal adapter 20A regarding the monitoring and controlling of the objects in object property table 42A. Particularly, object property table 42A allows the mapping of the parameters/objects related
to the controlling and monitoring of the object from microprocessor 25A to signal adapter 20A and, if desired, further to network gateway 12 and to network 15. In one preferred embodiment, the mapping scheme maps pointers to the objects to signal adapter 20A, network gateway 12, and network 15. In another preferred embodiment, the mapping scheme maps the contents of object property table 42A. The mapping scheme significantly increases the efficiency and speed of the communication between network 15 with microprocessor 25A through gateway 12 and signal adapter 20A.
Object property table 42A has a name field, referred to as DEVICE_A in Fig. 3. DEVICE_A can be filled with a constant data for identifying object property table 42A. The constant data in DEVICE_A can be various types of data such as, for example, binary, ASCII, UNICODE, etc. A user can choose the data to fill DEVICE_A. By way of example, the data in DEVICE_A can be the name of an apparatus controlled/monitored by microprocessor 25A. Other examples for the data in
DEVICE_A include model number, serial number, and manufacturer name, of the apparatus. Object property table 42A also includes an identification field, referred to as Digital_ID_A in Fig. 3. By way of example, Digital_ID_A has a length of six bytes for storing the digital identification (Digital ID) of signal adapter 20A shown in Fig. 1. The Digital ID of a signal adapter, e.g., signal adapter 20A, 20B, ..., or 20N, has a constant value, which is typically determined by the signal adapter manufacturer.
Object property table 42A includes a descriptor segment and a content segment . In a preferred embodiment, the descriptor segment includes two words, each word being two bytes in length. The first word has a symbol PROP_NUM by way of example and indicates how many objects there are in the content segment of object property table 42A. The second word has a symbol PORP_DESP by way of example and describes the data type of names the objects in object property table 42A. An example of how PR0P_DESP indicates data type of the name of the object is shown in Table 1.
It should be noted that the data types of the object names are not limited to those described above, other types of data, e.g., hexadecimal, binary coded decimal (BCD), alphanumeric code, etc., can also be used in accordance with the present invention. If more than four data types need to be defined, at least a portion of the reserved bits (D15-D4) can be used in conjunction with the bits D3D2 to define the data types. Further, the data types can be defined using any bits in the
PR0P_DESP. Using PROP_ΝUM, the user can create an index to objects in object property table 42A. The index establishes the order of the objects, thereby facilitating the management of the objects in object property table 42A.
TABLE 1
The content segment of object property table 42A contains the objects. The number of the objects in the 5 content segment is indicated by PROP_NUM in the descriptor segment in object property table 42A. Fig. 3 shows that there are i objects in object property table 42A, where i is an integer. A particular object, e.g., OBJECT_2 , in object property table 42A has a byte length
10 represented by the symbol 02, as shown in Fig. 3. Because of the object oriented mapping method in accordance with protocol 30 of the present invention, different objects in the content segment of object property table 42A preferably have the same structure.
15 Figure 4 is a block diagram illustrating an object 45 in object property table 42A in accordance with the present invention. Object 45 includes a description section 43 comprised of seven terms, which are object type description (OB TYPE) , address pointer (OB ADDR) ,
object memory type (OB_MEMO) , object data attribution (0B_ATTR1 and 0B_ATTR2) , object data size (0B_SIZE) , object name size (OB_NAME_SIZE) and object name (OB_NAME_VAR) . The byte length and the function of each term in description section 43 are described in Table 2 by way of example. The total byte length of description section 43 of an object is indicated in Fig. 3, e.g., 02 for 0BJECT_2 in object property table 42A. Preferably, description section 43 is stored in signal adapter 20A. However, description section 43 can also stored in other locations in communication system 10, e.g., microprocessor 25A, network gateway 12, etc. Object 45 also includes a data section 47 comprised of a plurality of data fields including an event control byte (ECB) , a DATA_FIELD_1, and a DATA_FIELD_2. Data section 47 is generally located in microprocessor 25A. However, this is not a limitation on the present invention. In accordance with the present invention, the data fields can be stored in any memory accessible by microprocessor 25A. In addition, the present invention is not limited to establishing three data fields in object 45 as shown in Fig. 4. Depending on the applications of microprocessor 25A, any number of data fields, e.g., one, two, four, five, etc., can be established for object 45. The data types of DATA_FIELD_1 and DATA_FIELD_2 include unsigned and signed binary, unsigned and signed word, unsigned and signed double word, floating point data, ASCII, UNICODE, etc. Depending on the object type, OB_ADDR in description section 43 can point to different addresses as described herein below. OB_NAME_VAR serves to identify each object 45 in object property table 42A.
For object property table 42A, the device name DEVICE_A (shown in Fig. 3) can be an object of the constant data type or an object of the variable data type. In other words, an object, e.g., OBJECT_i, in object property table 42A can serve as a special object in object property table 42A. The special object represents the name of object property table 42A.
A constant is generally used for describing fixed parameters objects such as, for example, the name, serial number, model or edition, number, protocol, etc. of the apparatus. In this context, the constant functions as an object identifier. By way of example, when microprocessor 25A is used to control an air conditioning system, the constant can be used to identify its model number, manufacturer name, serial number, etc. The constant can also include parameters for describing other object characteristics as defined by the user. The constant is preferably a read only data in order to maintain its constancy.
TABLE 2
The constant needs to fill only one data field, e.g., DATA_FIELD_1. Thus, DATA_FIELD_2 is blank when object 45 is a constant. In one preferred embodiment, OB__ADDR points to DATA_FIELD_1, which stores the value of the constant, OB ATTR2 stores the code of the constant
name, and OB_NAME_VAR is blank. In this embodiment, OB_ATTRl describes the data type of the constant value stored in DATA_FIELD_1 and OB_SIZE is set to be the size of DATA_FIELD_1. In another preferred embodiment, OB_ADDR points to OB_NAME_VAR, which stores the value of the constant, OB_ATTR2 stores the code of the constant name, and DATA_FIELD_1 is blank. In this embodiment, 0B_ATTR1 describes the data type of the constant value stored in OB_NAME_VAR and 0B_SIZE is set to be zero. In yet another preferred embodiment, where the constant is represented by its value only, OB_ADDR is pointed to DATA_FIELD_1, which stores the value of the constant, and OB_NAME_VAR is blank. In this embodiment, 0B_ATTR1 describes the data type of the constant value stored in DATA_FIELD_1, 0B_ATTR2 is blank, and OB_SIZE is set to be the size of DATA_FIELD_1. In an additional embodiment, where the constant is also represented by its value only, OB_ADDR is pointed to OB_NAME_VAR, which stores the value of the constant, and DATA_FIELD_1 is blank. In this embodiment, 0B_ATTR1 describes the data type of the constant value stored in OB_NAME_VAR, 0B_ATTR2 is blank, and 0B_J3IZE is set to be zero.
A variable typically represents those quantities that do not have fixed values, e.g., temperature, humidity, current, voltage, time, etc. A variable has only one data field, e.g., DATA_FIELD_1. Thus, DATA_FIELD_2 can be left blank when object 45 is a variable. 0B_ADDR points to DATA_FIELD_1, which stores the value of the variable, and 0B_ATTR1 describes the data type of the variable stored in DATA_FIELD_1.
OB SIZE is set to the size of DATA FIELD 1. In one
preferred embodiment, OB_NAME_VAR stores the name of the variable and OB_ATTR2 is left blank. In another preferred embodiment, OB_ATTR2 stores the code of the variable name and OB_ΝAME_VAR is left blank. The type of object 45 can also be an event. When an event happens, signal adapter 20A may report it to network 15 via network gateway 12 shown in Fig. 1. By way of example, an event may be the triggering of an alarm in a home security system, a temperature surpassing a user defined temperature upper limit in an air conditioning system, a carbon monoxide concentration over a safe limit, a noise level passing a certain decibel level, etc. An event is represented by the ECB in object 45. In a preferred embodiment, bit D7 in the ECB indicates whether the event can be reported to network gateway 12 and, therefore, is referred to as an enabling bit. For example, when the enabling bit D7 is one, the reporting is enabled and the event can be reported to network gateway 12. On the other hand, when the enabling bit D7 is zero, the reporting is disabled. The enabling bit D7 can be set either by network gateway 12 through network gateway 12 or by microprocessor 25A. Bit D6 indicates whether the event is triggered by a change in certain parameters, e.g., temperature, humidity, carbon monoxide concentration, noise decibel, etc., and is sometimes referred to as a parameter bit. The parameter bit D6 is set by microprocessor 25A. There are two situations in which the parameter bit D6 is zero. One is that the event is not associated with a parameter, and the other is that the event is not triggered by the
parameter associated therewith or the parameter is not reported to network gateway 12. Microprocessor 25A sets the parameter D6 in the ECB to one when the event is triggered by a parameter and that parameter is to be reported to network gateway 12 with the event . When signal adapter 20A reports an event triggered by a parameter. The parameter is stored in DATA_FIELD_1. Signal adapter 20A sends an address pointer of DATA_FIELD_1 when Signal adapter 20A reports the event to network gateway 12. Bits D5, D4 , and D3 are reserved for future development. Bit D2 is a user defined bit. Bit Dl is referred to as a connection bit and indicates whether the event requires signal adapter 20A to be connected to network gateway 12 when the event happens. By way example, the connection bit Dl being one indicates that the reported event requires signal adapter 20A to be connected to network gateway 12, thereby enabling signal adapter 20A to report the event to network 15 through network gateway 12. If signal adapter 20A is already connected to network gateway 12 when the event is reported to signal adapter 20A, the connection bit Dl in ECB is ignored. Bit DO is referred to as an event status bit . The event status bit DO is set to one upon the triggering of the event. After reporting the event to network gateway 12 and receiving a confirmation signal from network gateway 12 and through signal adapter 20A in a subsequent event polling command, microprocessor 25A resets the event status bit DO to zero.
Like that of the variable, the name of the event can be stored in OB_NAME_VAR and the code of the event name can be stored in OB_ATTR2. OB_ADDR points to ECB.
An event has at most only one data field, e.g., DATA_FIELD_1. Thus, DATA_FIELD_2 can be left blank when object 45 is an event. When the parameter bit D6 in ECB is zero, there is no parameter reporting to network gateway 12. In this situation, 0B_ATTR1 and DATA_FIELD_1 can be blank. When the parameter bit D6 in ECB is one, there is a parameter reporting from signal adapter 20A to network gateway 12. The parameter can be stored in DATA_FIELD_1. 0B_ATTR1 indicates the data type of the parameter stored in DATA_FIELD_1. OB_SIZE indicates the size of DATA_FIELD_1.
A function includes an input parameter and an output parameter. Network gateway 12 transmits an input parameter through signal adapter 20A to microprocessor 25A. Microprocessor 25A receives the input parameter, executes the input parameter, and transmits an output parameter to signal adapter 20A and further to network gateway 12. In a preferred embodiment, the input parameter is a write only data and the output parameter is a read only data with respect to network gateway 12.
Because it includes both input and output parameters, the function generally requires two data fields. DATA_FIELD_1 can store the input parameter and DATA_FIELD_2 can store the output parameter. OB_ADDR is points to DATA_FIELD_1. 0B_ATTR1 and OB_ATTR2 indicate the data types of the input and output parameters, respectively. OB_SIZE is divided into two segments. The first segment indicates the size of DATA_FIELD_1 and the second segment indicates the size of DATA_FIELD_2. OB NAME VAR stores the name of the function.
A file in object 45 can be any kinds of file, e.g., text file (.txt), binary file (.bin), hexadecimal file (.hex), executable file (.exe), image file (.gif), word document file (.doc), hypertext mark language file (.html), etc. Because the file requires only one data field, e.g., DATA_FIELD_1, DATA_FIELD_2 can be blank during the file transmission. OB_ADDR is points to DATA_FIELD_1. 0B_ATTR1 indicates the data type of the file in DATA_FIELD_1, and OB_SIZE indicates the size of the file in DATA_FIELD_1. In one preferred embodiment, OB_NAME_VAR stores the name of the file and OB_ATTR2 is left blank. In an alternative preferred embodiment, 0B_ATTR2 stores the code of the file name and OB_NAME_VAR can store the file name or be left blank. The structures of object property tables 42N, ..., 42N are similar to that of object property table 42A. Fig. 3 shows that object property table 42B has name field DEVICE_B and Ditigal_ID_B . The descriptor segment of object property table 42B includes P0RP_NUM indicating the number of objects in object property table 42B and PR0P_DESP indicating the data types of the object names in object property table 42B. As an example, Fig. 4 shows that object property table 42B has j objects, where j is an integer. Fig. 3 also shows that object property table 42N has name field DEVICE_N and Ditigal_ID_N. The descriptor segment of object property table 42N includes P0RP_NUM indicating the number of objects in object property table 42N and PR0P_DESP indicating the data types of the object names in object property table 42N. As an example, Fig. 4 shows that object property table 42N has k objects, where k is an integer.
PROTOCOL DATA PACKET
After mapping the object property table, information regarding a particular object 45 is preferably transmitted between network gateway 12 and signal adapter 20A in the form of data packets. A data packet transmitted between network gateway 12 and signal adapter 20A in accordance with local network communication protocol 30 preferably includes a status segment, a command segment, and a data segment. By way of example, the status segment is one byte long. Bit D7 is referred to as event bit. The event bit D7 is set by signal adapter 20A is set by signal adapter 20A in a response signal to network gateway 12. The event bit D7 indicates whether signal adapter 20 has an event to be reported to network gateway 12. Bit D6 is referred to a busy bit. The busy bit D6 is also set by signal adapter 20A in a response signal to network gateway 12. The busy bit D6 indicates whether signal adapter 20A is busy and cannot properly execute the command signals from network gateway 12. After receiving the busy signal from signal adapter 20A, network gateway periodically sends polling commands to signal adapter 20A inquiring the status of signal adapter 20A. Bits D5-D3 in the status segment of a data packet is reserved for future development. Bits D2-D0 are referred to as sequence bits. The sequence bits D2-D0 of a downlink data packet transmitted from network gateway 12 to signal adapter 20A include a sequence number set by network gateway 12. The sequence number provides an identification of the data packet. When signal adapter 20A transmits a response signal to network gateway 12,
the uplink data packet in the response signal includes the sequence number set by the network gateway 12. The sequence number in the response signal uplink data packet enables network gateway 12 to recognize to which downlink data packet the uplink data packet from signal adapter 20A is responding. This data packet correspondence recognition capability is especially beneficial when network gateway 12 communicates with a plurality of signal adapters, e.g., signal adapters 20A-20N as shown in Fig. 1.
The command segment controls the signal transmission between network gateway 12 and signal adapter 20A. In one preferred embodiment, the command segment has five bytes: one byte for the command, two bytes for command parameter, and two bytes for command subparameter . The command parameter and command subparameter serves to supplement the command byte for correct and efficient command transmission and execution. The data segment contains the information to be transmitted between network gateway 12 and signal adapter
20A. For example, in a READ command data packet, the data field of the data packet may include DATA_FIELD_1 of object 45 (shown in Fig. 4) in an object property table. The byte length of the data segment is variable depending on the amount of the information to be transmitted.
COMMAND
Network gateway 12 and signal adapter 20A has a master-slave relationship. Only network gateway 12 can initiate commands. Signal adapter 20A responds the commands transmitted from network gateway 12. If signal
adapter 20A does not respond a command from network gateway 12, network gateway 12 preferably repeats transmitting the command to signal adapter 20A until signal adapter 20A responds. After a predetermined number of command transmissions without response from signal adapter 20A, network gateway 12 detects a timeout mistake .
A command byte includes two parts, command type and command status. By way example, bits D4-D0 make up the command type, and bits D7-D5 make up the command status. The commands include control commands, setup commands, read commands, write commands, etc. In a preferred embodiment, the command status includes a MORE bit (D7) , an ERROR bit (D6) , and a RESPONSE ENABLING bit (D5) . The MORE bit (D7) indicates whether the current data packet includes all data to be transferred. The value in the ERROR bit (D6) is set in a response command, indicating whether the initial command has been successfully received and executed. The RESPONSE DISABLING bit (D5) is set by network gateway 12 for indicating whether network gateway 12 permits and requires signal adapter 20A to respond command signals from network gateway 12. For example, when the RESPONSE DISABLING bit (D5) in a data packet is set to one, network gateway 12 does not permit signal adapter 20A to respond to the data packet. This is beneficial when network gateway 12 broadcasts messages to many signal adapters. On the other hand, when the RESPONSE DISABLING bit (D5) in a data packet is set to zero, network gateway 12 does requires signal adapter 20A to respond to the data packet. This is beneficial when network gateway 12 seeks to control or
modify an object in the object property table associated with signal adapter 20A.
In accordance with a preferred embodiment, the commands between network gateway 12 and signal adapter 20A belong to several categories: connect/disconnect commands, read/write commands, object property table mapping commands, event polling/reporting commands, setup commands, data encryption/decryption commands, data compression/decompression commands, and In-Application re-Programming (IAP) commands. Because of its slave status, signal adapter 20A cannot initiate a command to network gateway 12. Signal adapter 20A can only responds to commands from network gateway 12. A command from network gateway 12 preferably requires an in kind response from signal adapter 20A in the sense that READ command from network gateway 12 requires a response READ command from signal adapter 20A, or the like.
Both network gateway 12 and signal adapter 20A can initiate the connection there between. Network gateway 12 can sent connection commands to signal adapter 20A to establish the connection. The connection command preferably specifies communication types, e.g., RS-485, RS-232, MODEM, USB, etc., between network gateway 12 and signal adapter 20A. Upon receiving the connection command, signal adapter 20A preferably checks the security in the connection command with the security code in signal adapter 20A. If the security codes match or signal adapter 20A does not have a security code, signal adapter 20A sends a response acknowledging the connection command from network gateway 12. The response preferably includes the digital ID (Digital_ID_A) , the descriptor
segment (PROP_NUM and PROP_DESP) , and parameters regarding the communication capabilities of signal adapter 20A. If the security codes do not match, signal adapter 20A sends response to network gateway 12 refusing the connection. In a preferred embodiment, the response includes Digital_ID_A, thereby by informing network gateway 12 the identity of signal adapter 20A. Signal adapter 20A can also initiate connection by sending a connection request to network gateway 12. In response to the connection request, network gateway 12 sends the connection command to signal adapter 20A to establish the connection there between.
As a master with respect to signal adapter 20A, network gateway 12 can send the disconnection command to signal adapter 20A to disconnect network gateway 12 from signal adapter 20A. While being disconnected from network gateway 12, signal adapter 20A ignores all commands from network gateway 12 except the connection command. The READ command enables network gateway 12 to read object data, e.g., an object in the object property table, from signal adapter 20A. In the case that the data is too large to be packaged in one data packet, signal adapter 20A can send data to network gateway 12 in several data packets. In this case, signal adapter 20A notifies network gateway 12 that there is at least an addition data packet following the one being sent to network gateway 12 by setting a particular bit, e.g., the MORE bit D7, in the return READ command to one. Upon receiving the return READ command with the MORE bit D7 set to one, network gateway 12 initiates an additional
READ command to read additional data from signal adapter 20A. This reading process continues until signal adapter 20A sets the MORE bit D7 in the return READ command to zero when there is no additional data to be sent to network gateway 12.
A write command, referred to as WRIT by way of example, enables network gateway 12 to send data regarding object 45 in object property table 42A to signal adapter 20A. If the object is a function, the WRIT command sends the input parameter to microprocessor 25A via signal adapter 20A. Upon receiving the input parameter, microprocessor 25A generates an output parameter in DATA_FIELD_2 of the object 45.
Network gateway 12 can also initiate a command, referred to as RDEV by way of example, to poll an event from signal adapter 20A. As discussed supra, network gateway 12 and signal adapter 20A have a master-slave relationship with respect to each other. When an event is reported from microprocessor 25A to signal adapter 20A, signal adapter 20A cannot report the report to network gateway 12 until network gateway 12 polls signal adapter 20A for events. Preferably, network gateway 12 periodically sends RDEV commands to signal adapter 20A to poll the events . Preferably, the RDEV commands poll the events in object property table 42A according to a predetermined order. Signal adapter 20A reports the events to network gateway 12 in an order determined by the event priority and the event polling sequence of network gateway 12. A command, referred to as WREV by way of example, enables network gateway 12 to set the value of the enable
bit (D7) in the ECB, thereby determining whether signal adapter 20A is permitted to report the event associated with the ECB to network gateway 12.
The data transmitted between network gateway 12 and signal adapter 20A can be encrypted to improve the security of the data. Data encryption can be performed on data transmitted in both directions between network gateway 12 and signal adapter 20A. Network gateway 12 can transmit an encrypted data packet to signal adapter 20A. Signal adapter 20A decrypts the data packet. The encryption at network gateway 12 and the decryption at signal adapter 20A are based on the same encryption formula to ensure the decrypted data packet correctly represents the data packet at network gateway 12 before encryption. Likewise, signal adapter 20A can transmit an encrypted data packet to network gateway 12. Network gateway 12 decrypts the data. It should be noted that the data packet transmitted from network gateway 12 to signal adapter 20A and the data packet transmitted from signal adapter 20A to network gateway 12 are not necessary to be encrypted based on the same encryption formula. By way of example, the encryption and decryption processes can follow the Data Encryption Standard (DES) . The data transmitted between network gateway 12 and signal adapter 20A can also be compressed to improve the data transmission efficiency and security. Data compression can be performed on data transmitted in both directions between network gateway 12 and signal adapter 20A. Network gateway 12 can transmit a compressed data packet to signal adapter 20A. Signal adapter 20A
decompresses the data packet . The compression at network gateway 12 and the decompression at signal adapter 20A are based on the same compression formula to ensure the decompressed data packet correctly represents the data packet at network gateway 12 before compression.
Likewise, signal adapter 20A can transmit a compressed data packet to network gateway 12. Network gateway 12 decompresses the data. It should be noted that the data packet transmitted from network gateway 12 to signal adapter 20A and the data packet transmitted from signal adapter 20A to network gateway 12 do not have to be compressed based on the same compression formula. By way of example, the encryption and decryption processes can follow the Huffman Encoding/Decoding process. In accordance with the present invention, object property table 42A can be stored in any memory location accessible to signal adapter 20A or microprocessor 25A. For example, object property table 42A can be stored in microprocessor 25A, signal adapter 20A, network gateway 12, or a server (not shown in Fig. 1) on network 15.
Object property table 42A mapping commands provide access to object property table 42A from anywhere in the communication system between network 15 and microprocessor 25A. In one embodiment, object property table 42A mapping commands transmit the pointers pointing to object property table 42A to a desired location in communication system shown in Fig. 1, e.g., signal adapter 20A, network gateway 12, a server on network 15, etc. In another embodiment, the object property table mapping commands transmit the contents the object property table to a desired location in communication
system shown in Fig. 1, e.g., signal adapter 20A, network gateway 12, a server on network 15, etc.
In the case that the object property table is stored in signal adapter 20A or microprocessor 25A, network gateway 12 can send a command, referred to as RDPR by way of example, to access object property table 42A. In a preferred embodiment, the RDPR command maps the description section of object property table 42A from microprocessor 25A to signal 20A and further to network gateway 12. This mapping process is preferably performed each time when network gateway 12 is connected to signal adapter 20A or signal adapter 20A is initialized or reset .
The setup commands are initiated by network gateway 12 to modify certain communication modes of signal adapter 20A or microprocessor 25A. For example, one function of the setup commands is setting up or changing the network address of signal adapter 20A. Another function of the setup function is implementing or changing security codes in signal adapter 20A.
In addition, object property table 42A can preferably be modified, thereby allowing the system to be upgraded or updated. When microprocessor 25A is programmed to control a different apparatus, it is also desirable to modify object property table accordingly. Alternatively, a new object property table 42A can be installed in place of old object property table 42A. In the case when object property table 42A is stored in signal adapter 20A, network gateway 12 can modify object property table by downloading the information from network 15 to signal adapter 20A. In the case when the
object property table is stored in microprocessor 25A or a memory accessible to microprocessor 25A, network gateway 12 downloads the modification from network 15 and modifies object property table 42 through signal adapter 20A.
In-Application re-Programming (IAP) COMMANDS
In a preferred embodiment, communication protocol 30 supports i.n-application re-programming (IAP) in signal adapter 20A and in microprocessor 25A. Through IAP, signal adapter 20A and microprocessor 25A are capable of modifying their programming codes during the execution of an application. Communication protocol 30 of the present invention enables the IAP of signal adapter 20A and microprocessor 25A to be initiated from network 15 or from network gateway 12. This network IAP initiation feature is referred to as WebIAP.
To perform IAP, each of signal adapter 20A and microprocessor 25A preferably includes a memory structure 50 as shown in Fig. 5. Memory structure 50 includes an application memory block or array 52 and an IAP memory block or array 54 independent of each other. IAP memory array 54 includes IAP management code block 55. IAP management code block 55 can include software codes stored in IAP memory array 54 or hardware circuitry coupled to IAP memory array 54. In accordance with a preferred embodiment of the present invention, application memory array 52 and IAP memory array 54 include programmable non-volatile memory such as, for example, FLASH memory, electrically erasable and programmable read only memory (EEPROM) , etc. In
accordance with an alternative embodiment, IAP memory array 54 includes a non-volatile memory for storing the IAP management codes in block 55 and a volatile memory for the IAP operation. A memory array controller 56 controls the access to application memory array 52 and IAP memory array 54.
Figure 6 is a flow chart describing an IAP process 100 in accordance with the present invention. A user on network 15 can request an IAP by sending the request and new programming codes to network gateway 12. Network gateway 12 relays the IAP request and the new programming codes to signal adapter 20A. In order to perform IAP process 100, network gateway 12 preferably has the information regarding the address, size, and type of the programming codes in signal adapter 20A or microprocessor 25A. In accordance with the present invention, network gateway 12 can access this information from signal adapter 20A and microprocessor 25A through a READ command. IAP process 100 is described herein below using an example of performing IAP on signal adapter 20A. Performing IAP on microprocessor 25A follows similar procedures. It should be noted that, when performing IAP on microprocessor 25A, signal adapter 20A functions as a signal relay between network gateway 12 and microprocessor 25A.
First, network gateway 12 transmits an IAP request signal to microprocessor 25A to initiate IAP process 100 in a step 102. Signal adapter 20A may have an IAP security code to safeguard its application system. The
IAP request signal preferably also has a security code
therein. The security code in the IAP request signal is generally provided to network gateway 12 by a user (not shown in Fig. 1) on network 15. In a step 103, a security code in the IAP request signal is compared with the security code in signal adapter 20A. If the security codes do not match, IAP process 100 is terminated in a step 118. If the security codes match or signal adapter 20A does not have an IAP security code, signal adapter 20A sends a response to network gateway 12 indicating the permission to continue IAP process 100 in a step 104. Furthermore, memory array controller 56 transfers a duplicate copy of the programming codes to be re- programmed from application memory array 52 to IAP memory array 54. Subsequently in a step 106, network gateway 12 sends an erase signal to signal adapter 20A to erase the original copy of the programming codes from application memory array 52 (shown in Fig. 5) . In a step 108, network gateway 12 sends programming codes to signal adapter 20A. Through the IAP management codes in block
55, signal adapter 20A implements the new program codes into application memory array 52. The new program codes are transmitted from network gateway 12 to signal adapter 20A in data packets. Each data packet has a bit, referred to as MORE bit by way of example, indicating whether there is additional programming codes following the current data packet. In a step 111, signal adapter 20A reads the MORE bit to determine whether there are additional data packets for the programming code. If there is more data packet, IAP process returns to step
108. The loop comprised of steps 108 and 111 repeats
itself until network gateway 12 finishes sending programming codes to signal adapter 20A.
After finishing sending programming codes to signal adapter 20A, network gateway 12 sends a verification signal to signal adapter 20A in a step 112. In a preferred embodiment, signal adapter 20A sends the pointers to and the size of the newly implemented programming codes to network gateway 12 in response to the verification signal. In an alternative embodiment, signal adapter 20A sends the content of newly implemented programming codes to network gateway 12 in response to the verification signal. Network gateway 12 verifies the implemented programming codes to determine whether it is correctly implemented. After the verification, network gateway 12 sends a finish signal to signal adapter 20A and notifies signal adapter 20A the verification result in a step 114.
In a step 115, signal adapter 20A receives the verification result from network gateway 12. If the programming code is not correctly implemented, network gateway 12 resends an erase signal to signal adapter 20A to erase the incorrectly implemented programming codes from application memory array 52 in step 106. Thus, IAP process 100 repeats steps 106, 108, 111, 112, and 114. If the verification indicates that the programming code is correctly implemented, signal adapter 20A releases the newly implemented programming codes in application memory array 52 in a step 116. Then, IAP process 100 terminates in step 118. If steps 106, 108, 111, 112, and 114 in IAP process 100 are repeated for a predetermined number of times,
e.g., five, ten, or twenty, due to incorrect implementation, IAP process 100 will generate an error message and abort.
In one preferred embodiment, the duplicate copy of the programming codes to be re-programmed is stored in IAP memory array 54 for safekeeping while the new programming codes is implemented in application memory array 52 in steps 108, 111, 112, 114, and 115. If IAP process 100 is interrupted, e.g., by a power failure, network connection failure, etc., the duplicate copy stored in IAP memory array 54 is restored to application memory array 52. In addition, signal adapter 20A can continue the execution of the programming codes in IAP memory array 54 while the new programming codes are implemented in application memory array 52. If the programming codes are too large to be implemented in a single IAP process, IAP process 100 can includes several subprocesses . Each subprocess re-programs a portion of the programming codes stored in a memory block in application memory array 52.
IAP process 100 in accordance with the present invention allows efficient modification of the programming codes in signal adapter 20A and microprocessor 25A. IAP process 100 is beneficial to keeping the programming codes updated and implementing any new programs, e.g. a new control program for operating an apparatus coupled to signal adapter 20A and microprocessor 25A.
By now it should be appreciated that a local network communication protocol for communicating between a network gateway and devices in local network has been
provided. In accordance with the present invention, the local network communication protocol, which is referred to as MCUNAP by way of example, creates an object property table in each device in the local network. The mapping of the object property tables enables the identification, description, controlling, monitoring, and modification of the devices that may include signal adapters, microprocessors, and the apparatuses controlled/monitored by the microprocessors. The protocol establishes a master-slave relationship between the network gateway and the devices, thereby providing reliable and robust communication links between the network gateway and the devices. The local network communication protocol also supports the IAP process in the devices. Using the local network communication protocol of the present invention, the communication between the devices and a network, e.g., the Internet, can be established without modifying the software and hardware structures of existing microprocessors in the devices. The designers of the microprocessors are not required to be familiar with the network protocol. The protocol can be implemented with microprocessors, MCUs, CPUs, etc., of various capabilities, performances, bit numbers, and memory sizes. Thus, the development time and cost of a device-network communication system in accordance with the present invention are significantly reduced compared with prior art communication systems. The protocol of the present invention is simple, reliable, and cost efficient. In addition, the local network communication protocol of the present invention
can be readily implemented with microprocessors in a user's existing application systems.