SERIAL DATA COMMUNICATION WITH IN-FRAME RESPONSE
20220327092 · 2022-10-13
Inventors
Cpc classification
International classification
Abstract
A method for a slave bus and a master bus includes receiving a first frame via a first data channel, wherein the first frame includes at least first header data, first payload data and first checksum. The method further includes implementing a function depending on the header data contained in the received first frame, and generating a second frame including second header data, second payload data, which are determined by the implemented function, and a second checksum. The second checksum is ascertained at least on the basis of the second payload data and the first header data contained in the received first frame. The method also includes transmitting the second frame via a second data channel simultaneously with receiving the first frame via the first data channel.
Claims
1. A method comprising: receiving a first frame via a first data channel, wherein the first frame comprises at least first header data, first payload data and a first checksum; and implementing a function depending on the header data contained in the received first frame; generating a second frame comprising second header data, second payload data, which are determined by the implemented function, and also a second checksum, which is ascertained at least on a basis of the second payload data and the first header data contained in a currently received first frame; and transmitting the second frame via a second data channel simultaneously with receiving the first frame via the first data channel.
2. The method as claimed in claim 1, wherein the second frame is transmitted in the same time interval in which the first frame is received.
3. The method as claimed in claim 1, in the first frame and the second frame are received and respectively transmitted synchronously with a clock signal.
4. The method as claimed in claim 1, wherein the first header data contain an address of a memory element, and the function is applied to that part of the memory which is designated by the address.
5. The method as claimed in claim 1, wherein the first header data include an address of a memory, and the function comprises reading data from a memory element designated by the address, and wherein the second payload data are dependent on the data read.
6. The method as claimed in claim 1, wherein the first header data contain an address of a memory, and the function comprises writing data to a memory element designated by the address, and wherein the data written are the first payload data or dependent thereon.
7. The method as claimed in claim 6, wherein before writing the data, the data stored in a part of the memory which is designated by the address are read, and wherein the second payload data are the data read or are dependent thereon.
8. The method as claimed in claim 1, wherein the second payload data identify a transmitter of the second frame and/or comprise status information.
9. The method as claimed in claim 1, further comprising: validating the first checksum on a basis of received first header data and received first payload data.
10. The method as claimed in claim 1, wherein the second checksum contained in the second frame is ascertained on the basis of the second header data, the second payload data and on the basis of the first header data contained in the received first frame.
11. The method as claimed in claim 1, wherein the second header data are dependent on the first header data.
12. A bus node comprising: a transmitting and receiving device configured to receive a first frame via a first data channel, wherein the first frame comprises at least first header data, first payload data and a first checksum; a control logic configured to implement a function depending on the first header data contained in a currently received first frame; and a frame encoder configured to generate a second frame which comprises second header data, second payload data, which are determined by the implemented function, and also a second checksum, wherein the frame encoder is further configured to ascertain the second checksum on a basis of the second payload data and further on the basis of the first header data contained in the received first frame; and wherein the transmitting and receiving device is further configured to transmit the second frame via a second data channel simultaneously with receiving the first frame via the first data channel.
13. A method comprising: generating a first frame comprising at least first header data, first payload data and a first checksum; transmitting the first frame via a first data channel, and simultaneously with transmitting the first frame: receiving a second frame comprising second header data, second payload data and also a second checksum; and validating the second checksum on a basis of the second payload data and further on the basis of the first header data contained in a generated first frame.
14. The method as claimed in claim 13, wherein the second checksum is validated on the basis of the second header data, the second payload data and further on the basis of the first header data generated for the generated first frame.
15. A bus node comprising: at least one processor and a memory containing instructions which, when they are executed on the processor, cause the bus node to carry out the method as claimed in claim 13.
16. A non-volatile memory medium having software instructions which, when they are executed on a processor of a bus node, cause the bus node to carry out the method as claimed in claim 13.
17. A bus node comprising: a transmitting and receiving device configured to transmit a first frame via a first data channel, wherein the first frame comprises at least first header data, first payload data and a first checksum, and configured to receive via a second data channel a second frame comprising second payload data and also a second checksum; a frame decoder configured to check the second checksum on a basis of the second payload data and further on the basis of the first header data contained in the first frame; and wherein the transmitting and receiving device is further configured to receive the second frame via a second data channel simultaneously with transmitting the first frame via the first data channel.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Exemplary embodiments are explained in greater detail below with reference to figures. The illustrations are not necessarily true to scale and the exemplary embodiments are not restricted only to the aspects illustrated. Rather, importance is attached to representing the principles underlying the exemplary embodiments. In respect of the figures:
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
DETAILED DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS
[0018]
[0019] The bus node 10 shown in
[0020] The SPI interface ii of the bus node 10 is connected to a corresponding SPI interface 21 of a further bus node 20 via a plurality of bus lines, which in the case of an SPI bus are usually designated by CSN (Chip Select), SCK (Serial Clock), MOSI (Master Out Slave In) and MISO (Master In Slave Out). The signals transferred via the respective bus lines are likewise designated by CSN, SCK, MOSI and MISO. The master bus node stipulates the points in time at which frames are transmitted (activation of CSN) and also the data transfer rate (generation of SCK). Moreover, the master bus node also defines whether data are read or written (as viewed from the master bus node in each case).
[0021] In some applications, the signal CSN can be regarded as optional and is used in particular if a plurality of slave bus nodes are connected to a master bus node. In other applications, CSN is indispensable; by way of example, CSN may be incorporated in a safety concept of a component. SCK denotes a shift clock signal, which is output by the master bus node 10 for the synchronization of the data transfer on the data channels MISO and MOSI. The data channel MOSI (having at least one data line) serves for data transfer from the master bus node 10 to the slave bus node 20, and the data channel MISO (having likewise at least one bus line) serves for data transfer in the other direction. In the case of a full-duplex data transfer, data are transferred on both data channels, MOSI and MISO, simultaneously and synchronously with the shift clock signal SCK.
[0022] The serial data transfer is usually effected on the basis of frames (MOSI frames from the bus node 10 to the bus node 20; MISO frames from the bus node 20 to the bus node 10). The structure of a frame will be explained in even greater detail later. In the bus node the data D.sub.IN received by the SPI interface 21 are forwarded to a frame decoder/encoder 22. In the other direction, the frame decoder/encoder 22 supplies the data D.sub.OUT to be transferred to the SPI interface. The frame decoder/encoder 22 is configured firstly to “unpack” and validate the data contained in a MISO frame and to “pack” and safeguard the raw data to be transmitted in a MISO frame.
[0023] Validating and safeguarding data contained in a frame usually comprises calculating or verifying a checksum. In the exemplary embodiments described here, the cyclic redundancy check (CRC) is used for calculating and verifying checksums, although other algorithms for ascertaining and verifying checksums are also possible. In the simplest case, the checksum consists of one or more parity bits. Various CRC methods or CRC polynomials and other methods for ascertaining and verifying checksums are known per se and are therefore not explained in detail here. In general, the frame decoder/encoder 22 adds a checksum to those (raw) data D.sub.READ which are packed into a frame (to be transmitted), and verifies the checksum contained in a (received) frame in order to check the integrity of the received data (e.g., an address ADDR, D.sub.WRITE)
[0024] In the case of a write access, bus node 10 writes data D.sub.WRITE to address ADDR in the bus node 20. For this purpose, D.sub.WRITE and ADDR have to be transferred in one or more MOSI frames. In the case of a read access, bus node 10 reads data D.sub.READ from an address ADDR of bus node 20. For this purpose, it is necessary to transfer the address ADDR in at least one MOSI frame and the read data D.sub.READ in at least one MISO frame. The address ADDR identifies a location in the modules or memory areas of the bus node 20 at which data can be written or read.
[0025] In the present example, the data received in a MOSI frame in the (slave) bus node 20 are designated by D.sub.WRITE and ADDR and are fed to a control logic 23. The data transmitted in a MISO frame by the bus node 20 are output by the control logic 23 to the frame decoder/encoder 22 and are designated by D.sub.READ in the present example. The construction of a frame and the meaning of the data contained therein will be explained in even greater detail later (cf.
[0026]
[0027] The frames F1 and F2 are transferred synchronously with a clock signal (which is generated by the bus node 10 and output to the SCK line) and simultaneously. In the examples described here, “simultaneously” is understood to mean that the two frames (from and to the master) overlap at least temporally. In one exemplary embodiment, in a specific time interval in which a MOSI frame is transferred, a MISO frame is also transferred simultaneously. Particularly in the case of an SPI, the transfer is isochronous since both frames (apart from avoidable propagation delay effects) begin and end substantially at the same point in time.
[0028] In systems with a next-frame response (NFR) structure, therefore, the response to a command transferred in a MOSI frame is only transferred in a temporally succeeding MISO frame. The MISO frames F2 lag behind the corresponding MOSI frames F1 temporally by at least one frame duration. This time offset is undesired in some applications, however, for which reason a concept known as in-frame response (IFR) was developed. One example of this is illustrated in
[0029] As illustrated in
[0030] In the case of an in-frame response, the slave bus node 20 already implements the function (e.g., a read operation) requested by the master bus node as soon as the header data of the MOSI frame F1 have been received. The MOSI CRC has not yet been evaluated at this point in time. The response (e.g., the data D.sub.READ read from a register at the location ADDR), is sent in the payload field of the MISO frame F2 while the corresponding MOSI frame F1 is still being received. The header data of the MISO frame F2 can be dummy data (e.g., a sequence of zeros), on which currently received MOSI header data are dependent, or can be e.g., status information indicating the current status of the bus node 20 (e.g., independently of the currently implemented operation). In one example, the header data (ADDR) currently received in the MOSI frame F1 are copied bit by bit into the header data field of the MISO frame F2 (status information identical to MOSI header data). The checksum in the checksum field of the MISO frame F2 (MISO CRC) protects the payload data of the MISO frame F2 and optionally also the header data of the MISO frame F2. That means for the example illustrated that the CRC checksum (MISO CRC) is calculated in the slave bus node 20 (e.g., in the frame decoder/encoder 22) on the basis of the payload data and optionally also on the basis of the header data of the MISO frame F2.
[0031] It can already be discerned from the temporal sequence illustrated in
[0032]
[0033] In the present example, before implementing the write operation, the content of the addressed register is read out (data word D.sub.READ) and the data word D.sub.READ read is sent as an in-frame response to the write command back to the bus node 10 (master node). Directly after receiving the destination address ADDR in the MOSI header data field (still before the check of the MOSI CRC), the control logic 23 performs a read operation at the received address ADDR and transfers the data read there to the frame encoder 222. The frame encoder 222 receives the data word D.sub.READ (e.g., from the control logic 23) and also status information and generates therefrom the MISO/response frame F2 to be transmitted, wherein the MISO header data represent the status information and the MISO payload data represent the data word D.sub.READ. The frame encoder 222 is configured to calculate a checksum on the basis of the MOSI header data (address) of the presently received MOSI frame F1, the MISO payload data of the presently current MISO frame F2 and optionally also on the basis of the MISO header data of the presently current MISO frame F2. The calculated checksum value MISO CRC is written into the checksum field of the current MISO frame F2 and transferred via the bus to the master bus node 10. As already mentioned, the received MOSI frame Fl and the response frame F2 (MISO frame) are transferred in parallel in the same time slot. In the case of a SPI interface, the MOSI and MISO frames are transferred in parallel (in a manner controlled by the common signals CSN and SCK). In the case of other transfer interfaces, MOSI and MISO frames can be transferred with a temporal offset relative to one another. As soon as a slave bus node initiates an action in response to an only partly received MOSI frame (still before the check on the complete MOSI frame), it is possible to apply the mechanisms described here for safeguarding the MISO frame.
[0034] In contrast to known concepts, the header data contained in the presently received MOSI frame F1 are taken into account—as illustrated schematically in
[0035] The master bus node 10 receives by way of its SPI interface 11 (see
[0036] During the verification of the checksum of the received MISO/response frame F2, the master bus node 10 can already recognize whether the slave bus node 20 has correctly received the MOSI header data (which contain e.g., the address for a write or read operation) of the corresponding MOSI frame F1. If that were not the case, the header data (of the MOSI frame F1) received in the slave bus node 20 would not be the same as those used for the generation of the MOSI frame in the master bus node 10 (in this case, the slave bus node 20 would have “incorrectly understood” the master bus node 10). Since the received MOSI header data are taken into account in the checksum calculation in the slave bus node and the intended MOSI header data are taken into account in the checksum verification in the master bus node, during the verification of the checksum of a received MISO/response frame the master bus node can immediately recognize whether the slave bus node 20 has correctly received the header data of the corresponding MOSI frame (and thus the information about the function/operation to be performed).
[0037] One example of the concept described here is summarized below with reference to the flow diagrams in
[0038] The second header data can additionally also concomitantly influence the second checksum in order to completely safeguard the MISO frame by means of the checksum. Since the header data of the presently received MOSI frame also concomitantly influence the checksum calculation, the master bus node (cf.
[0039] The MISO frame is transmitted in the same time interval in which the MOSI frame is received (simultaneously, i.e. in the same time interval or in an overlapping manner). The payload data of the MISO frame can therefore represent an in-frame response to the MOSI frame. In the case of an SPI interface, the MOSI frame and the MISO frame are usually received and respectively transmitted synchronously with a common clock signal. The abovementioned function implemented by the slave bus node can comprise a memory access, wherein the header data of the MOSI frame contain the address of a memory element which is accessed during the implementation of the function in the slave bus node. The function can be in particular a read or write operation. In the case of a read operation, the payload data in the response frame (MISO frame) can be the data read or can be dependent thereon. In the case of a write operation, the payload data in the received MOSI frame are the data to be written to the memory or the data to be written to the memory are dependent on the payload data of the received MOSI frame. Before the write access, the content (overwritten later) of the memory can be read and can be sent back as an in-frame response to the master bus node. Alternatively, the payload data of the response frame can also identify the transmitting (slave) bus node or include status information. The status information transmitted back can also contain the previously received address.
[0040] When the MOSI frame has been completely received by the slave bus node, the first checksum contained in the MOSI frame can be validated on the basis of the received first header data and the received first payload data. At this point in time, the function initiated by the MOSI frame has already been performed and the corresponding data as an in-frame response have already been completely transferred back to the master bus node, or their transfer has begun.
[0041] The flow diagram in
[0042] While this invention has been described with reference to illustrative embodiments, this description is not intended to be construed in a limiting sense. Various modifications and combinations of the illustrative embodiments, as well as other embodiments of the invention, will be apparent to persons skilled in the art upon reference to the description. It is therefore intended that the appended claims encompass any such modifications or embodiments.