The present invention relates to a method of and apparatus for addressing a device within a daisy chain of devices, and for retrieving data from a device within a daisy chain of devices.
It is known that devices can be arranged in a “daisy chain” in order to transfer data from one device to another, and then on to subsequent devices. This arrangement is used to allow a serial interface, for example a three wire serial interface, to address many devices. However, within a daisy chain of such devices it is desirable to give each device a unique address such that a control system can send a message intended for one, and only one, of the devices and to receive a response from the device. It is again advantageous that the response includes the address of the sending device such that the identity of the sending device can be validated by the receiving device or system.
According to a first aspect of the present invention there is provided a method of addressing a target device within a chain of devices, the method comprising a sending device setting an address value and sending data in association with the address value, and wherein each device receiving the address value and data compares the address value to a device number, and if they are different modifies the address value by a predetermined amount and transmits the data and the modified address value to a subsequent device.
It is thus possible to provide a system in which each and every device internally regards itself as having the same address. The nominal value of the address associated with each device is largely irrelevant, but for simplicity we might assume that each device regards itself as having address “0”. This means that there is no need to provide pins on the device package to enable the device address to be set by external switches or hardwired connections. This saves valuable pins on the packaging of a device and may enable the device to be encapsulated in a package with fewer pins, thereby giving rise to a cost saving. Even if the device cannot be packaged in a smaller packaging, the option to avoid having to provide external switches to set the address of the device reduces the cost of systems containing such a device, and where the systems are modular enables each module to be identical. The pins that would have been used to set the device address can then become available for other functions. The addresses can also be set using fuses or ROM, but then the addresses have to be programmed and tested, which is often inconvenient.
Advantageously, data transmitted in a first direction along the daisy chain of devices has its address value decremented with each device that the data passes through. This means, that if a sending device wants to transmit data to a device three devices along the daisy chain, then it sets the address value of the recipients device to N−1, where N=the relevant distance between the sending device and the target device. In this example N=3 so the address is set to “2”. The first device receiving the information will examine the address, see that the address is 2, understands that as its own address is 0 is that data is not destined for it, and then retransmit the data to the next device in the daisy chain after decrementing the address field. The next device receives data having an address value of “1”. It again compares this address with its own address “0” and noting that the data is not intended for it transmits the data on to the next device after decrementing the address field. The third device to receive the data examines the data, notes the address is “0”, which corresponds to its own address and thereby acts on the data.
Preferably when data is passing in a second direction along the daisy chain the address field is incremented. Thus, suppose the third device in the daisy chain wishes to send information to a system controller located at the end of the daisy chain, then it packages the data and associates it with its own address of “0”. The next device receiving the data travelling in that direction (towards the system controller) can infer that the data is not intended for it because of the direction of data travel. It therefore passes the data along the daisy chain after having incremented the address field. The next device, does the same, and so on until the data arrives at the system controller located at the end of the daisy chain. It can then use the address field to determine from which device within the daisy chain the data originated.
It is thus possible to provide a inexpensive way of addressing a specific device within a daisy chain of devices, and identifying the source device when data is transmitted from the daisy chain.
According to a second aspect of the present invention there is provided a method of transferring data from a Jth device to a Kth device in a chain of devices, wherein the Jth device forms an address value as a function of the difference between J and K, and sends data in association with the address value, and wherein each device receiving the data examines the address value to determine whether it is in intended recipient of the data, and if it determines that it is not the intended recipient it modifies the address value and passes the data along the chain of devices in association with the modified address value.
According to a third aspect of the present invention there is provided an addressable device adapted to be connected in series with other addressable devices, wherein the device is arranged to receive data which comprises an address value, and wherein the addressable device is arranged to compare the address value with a device number, and if they are different to modify the address value to form a modified address value and to transmit the data and modified address value to a subsequent device.
According to a third aspect of the present invention there is provided a data processing system comprising a plurality of addressable devices arranged in a series connected chain, wherein when a first device wishes to exchange data with a further device which is not immediately connected to the first device, the first device calculates an address value indicative of the number of devices intermediate the first device and the further device, and sends the data in association with the address value, and wherein each device examines the address value to determine whether the data is intended for it or should be passed along the chain.
The present invention will be described, by way of non-limiting example only, with reference to the accompanying Figures, in which:
It is useful to consider an arrangement where a plurality of devices are provided in a monitoring arrangement and are connected in a “daisy chain”. Such a situation may occur in, for example, monitoring of batteries within an electric or hybrid vehicle.
Each battery monitor can derive power for its own operation from the battery module which it is monitoring. Thus, for example, battery monitor 34 receives its local negative voltage by connection to node 52 and its local positive voltage by connection to node 54. This defines a voltage difference of up to 25 volts across the monitor 34. Typically it is desired to monitor the voltage across each individual cell in the battery stack rather than the total voltage across each one of the groups. Consequently, as shown in detail for the second battery monitor 32 a plurality of connections are made to nodes intermediate each one of the cells associated with the monitor 32 such that the potential difference across each individual cell can be measured, for example, by an analog to digital converter provided within the battery monitor 32. The result for each cell may be sent as a digital word to a system controller 70 such that the system controller 70 has knowledge of the voltage occurring across each individual cell and can control switches (not shown) to selectively remove one or more cells from the current path through the battery stack during a charging phase. The potential within each battery monitor, as measured with respect to ground, varies considerably and if each individual monitor was connected directly to the system controller then considerable effort and expense would be required to ensure that the controller was protected from the DC voltage occurring at each battery monitor. It is safer and less expensive to connect the devices in a chain and to pass data along the chain.
In this example, only one of the battery monitors, namely the first one 30, is in communication with the system controller 70. It should be noted that the communication path between the first battery monitor 30 and a controller 70 may itself include an additional isolating component, such as an opto isolator, so as to ensure that the system controller is protected from voltages occurring within the battery stack and within the battery voltage monitors.
As shown in
As can be seen from
A circuit for interchanging data between adjacent ones of the battery monitors is the subject of a co-pending patent application having the title “battery monitoring apparatus and daisy chain interface suitable for use in a battery monitoring apparatus”.
However, for the purpose of this application it is sufficient to assume that the devices are capable of exchanging data with one another and the interface may be constructed in accordance with the co-pending application, or may indeed by any other interface design, optionally including DC blocking capacitors or opto isolators such that the relative potential occurring at the neighbouring devices is not an issue. This is therefore merely sufficient to assume that we have a daisy chain of devices, and indeed because the devices are not limited to being battery monitors, they could all be at the same potential.
As noted hereinbefore, the system controller may wish to communicate with an individual one of the monitors. Thus, suppose, that it wishes to instruct battery monitor 36 to measure the voltage across one of its associated cells, or alternatively it may wish to send an instruction to the monitor 36 to, for example, remove one of the cells associated with it from the current path during a charging phase of the battery stack. We can use knowledge of the system configuration to address the device 36. The system controller has knowledge that device 36 is the fourth device in the daisy chain. It therefore knows that there are three devices intermediate it (i.e. devices 30, 32, 34) and its target device, namely device 36. Thus, when it is seeking to address device 36, it can take the number of intermediate devices into account and set an address word with a value such that, when each intermediate device acts on the address word, the address is modified in such a way that by the time the data arrives at device 36 device 36 recognises that the data is intended for it.
In a first embodiment of the present invention the address word associated with data is decremented when the data travels in a direction away from the system controller 70, that is up the stack as shown in
Alternatively, if the address data is modified in accordance with a modulo arithmetic, then the address field can be incremented as data travels from the device 70 to the target device. Assume, for example, that the devices operate on the address in modulo 15 arithmetic, such that the address would be incremented 12, 13, 14, 15 but the next increment would return the address to 0. In this arrangement when the device 70 wished to address the device 36, it would send an instruction associated with an address of 13. The first device 30 would receive the instruction, examine the address, note that it is not equal to 0, and then increment it before passing it on the second device 32. The second device 32 would receive the instruction associated with an address of “14”, examine it, note that it is not the intended recipient, increment the address to “15” and transmit it to the next device 34. The device 34 would receive the data/instruction, examine the address, note that it is not equal to “0” and therefore transmit it along the daisy chain after incrementing the address from “15” to “0”. Thus the device 36 would receive the instruction, examine the address, note that the instruction was associated with the address that pertained to that device and therefore act on it.
A similar methodology can be used when transmitting data from a cell. Suppose that in response to a control word from the system controller 70, each one of the battery monitors measures the voltage across each cell that it is monitoring, and also the temperature of individual cells or the group of cells. This data can be packaged in the word, as shown in
In this arrangement the address associated with the data is incremented as it passes along the chain. Thus data originating from device 34 would be sent with an origin address of “0”. This would be passed through device 32 having been incremented to an origin address of device 1. As this data passes through the device 30, this address is further incremented such that the address now becomes equal to “2”. When the data is received by the system controller 70, it examines the address which is equal to “2”, which informs the controller that the data has been passed through two intermediate devices. This is sufficient to determine that the data originated from the third device in the chain i.e. device 34.
Returning to step 154, if the step is not equal to “0” then the device knows that it is not the intended recipient and control is passed to step 160. Here a test is made to determine whether the data is travelling away from the system controller. If data is travelling away from the system controller, i.e. up the daisy chain of
It is thus possible to provide an addressing scheme where the need to indicate to each device that it has a unique address is obviated because the transfer of data from one device to another along the chain causes the address of the transmitting and receiving devices to become explicit even though each device internally assumes that it has a unique address, but the internal address for each device is in fact the same.