SERIAL DATA COMMUNICATION WITH IN-FRAME RESPONSE
20230032989 · 2023-02-02
Inventors
Cpc classification
G06F21/64
PHYSICS
G11C7/1006
PHYSICS
International classification
G06F21/64
PHYSICS
G11C7/10
PHYSICS
Abstract
A method for a bus node includes receiving a first frame via a first data channel. The first frame includes a first header field having first header data and a first payload field having first payload data. The method further includes implementing a read operation at a read address determined by the first header data, and generating a second frame containing at least a second payload field having second payload data. The latter are based on the data read when implementing the read operation. The method further includes transmitting the second frame via a second data channel simultaneously with receiving the first frame via the first data channel, and implementing a write operation on the basis of the first payload data.
Claims
1. A method comprising: receiving a first frame via a first data channel, wherein the first frame comprises at least a first header field having first header data and a first payload field having first payload data; implementing a read operation at a read address determined by the first header data; generating a second frame containing at least a second payload field having second payload data based on the data read when implementing the read operation; transmitting the second frame via a second data channel with a temporal overlap with receiving the first frame via the first data channel; and implementing a write operation on the basis of the first payload data.
2. The method as claimed in claim 1, wherein the first frame additionally contains a checksum and the write operation is implemented only after successful checking of the checksum.
3. The method as claimed in claim 1, wherein the first payload data contain information regarding a write address and a data word, and wherein implementing the write operation comprises writing data based on the data word to the write address.
4. 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.
5. The method as claimed in claim 1, wherein the first frame and the second frame are received and respectively transmitted synchronously with a clock signal.
6. The method as claimed in claim 1, wherein implementing the read operation takes place directly after receiving the first header data and even before the first frame has been completely received.
7. 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 a first header field having first header data and a first payload field having first payload data; a control logic configured to implement a read operation at a read address determined by the first header data, and further configured to implement a write operation on the basis of the first payload data; and a frame encoder configured to generate a second frame containing at least a second payload field having second payload data based on the data read when implementing the read operation; wherein the transmitting and receiving device is further configured to transmit the second frame via a second data channel with a temporal overlap with receiving the first frame via the first data channel.
8. The bus node as claimed in claim 7, wherein the first frame additionally contains a checksum and the control logic is configured to implement the write operation only after successful checking of the checksum.
9. The bus node as claimed in claim 7, wherein the first payload data contain information regarding a write address and a data word, and wherein implementing the write operation comprises writing data based on the data word to the write address.
10. The bus node as claimed in claim 7, wherein the control logic is configured to implement the read operation directly after receiving the first header data even before the first frame has been completely received.
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]
[0018]
[0019]
DETAILED DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS
[0020]
[0021] The bus node 10 shown in
[0022] The SPI interface 11 of the bus node 10 is connected to a corresponding SPI interface 21 (generally referred to as a transmitting and receiving device) 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 (by activation of CSN) and also the data transfer rate (generation of the clock signal SCK). Moreover, the master bus node also defines whether and which data are read or written (as viewed from the master bus node in each case).
[0023] In some applications, the signal CSN is optional. It 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. The clock signal SCK is usually a shift clock signal generated 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 (downlink), and the data channel MISO (having likewise at least one bus line) serves for data transfer in the other direction (uplink). 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. In the case of application of the abovementioned concept of in-frame response (IFR), therefore, the frame transmitted by the master bus node 10 and the corresponding response frame transmitted by the slave bus node 20 are transferred simultaneously (in the same time window determined by the signal CSN) and synchronously with the shift clock signal SCK.
[0024] As described above, the serial data transfer is 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 20 the data DIN 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 optionally validate the data contained in a MOSI frame and to “pack” the raw data to be transmitted in a MISO frame and optionally to safeguard them using a checksum or the like.
[0025] Validating and safeguarding data contained in a frame usually comprises calculating or verifying a checksum. In some of 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 includes 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). However, safeguarding data by means of checksums is not absolutely necessary and can be omitted in less critical applications.
[0026] In the case of a write access, bus node 10 writes data D.sub.WRITE to the 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 memory location in the modules or memory areas of the bus node 20 to which data can be written.
[0027] 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.
[0028]
[0029] The frames F1 and F2 are transferred 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 (cf. e.g.,
[0030] In systems with a next-frame response (NFR) structure, the response to a command transferred in a MOSI frame is only transferred in a temporally succeeding MISO frame. In this case, 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
[0031] As illustrated in
[0032] 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 value has not yet been completely received and evaluated at this point in time. The response (e.g., the data D.sub.READ read from a register at the location ADDR) is transferred 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), may depend on the currently received MOSI header data, 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.
[0033] It can already be discerned from the temporal sequence illustrated in
[0034]
[0035] 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 F1 and the response frame F2 (MISO frame) are transferred in parallel in the same time slot. In the case of an SPI interface, the MOSI and MISO frames are transferred simultaneously and isochronously (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 of the complete MOSI frame), it is possible to apply the mechanisms described here for safeguarding the MISO frame.
[0036] In contrast to known concepts, the header data contained in the presently received MOSI frame F1 are taken into account, as illustrated schematically in
[0037] The master bus node 10 receives by way of its SPI interface 11 (see
[0038] 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, then 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).
[0039]
[0040] As illustrated in
[0041] In accordance with the example from
[0042] The payload data in the payload data field of the received MOSI frame F1 can be e.g., control bits, status flags, configuration data or the like, which are written to a predetermined memory area, for example in order to configure the slave bus node for a desired purpose or a desired operating mode. In a further example, the payload data field of the received MOSI frame F1 contains both a write address and the data to be written to this address. This situation is illustrated in
[0043] A write operation does not necessarily mean that exactly the payload data contained in the payload data field are written. A write operation may also include existing data (e.g., status flags) being modified, wherein the type of modification may depend on the payload data contained in the payload data field. Furthermore, writing to an address also does not necessarily mean that data are actually stored in a memory. The writing of (payload) data to an address can also initiate a specific action, which may depend on the (payload) data, e.g. erasing status information or advancing a state machine. Furthermore, the payload field need not necessarily contain the write address directly; instead, the payload field can also contain a pointer that refers to the actual address. In general terms, the payload field contains firstly information regarding a write address (e.g., the address itself or a pointer) and secondly data which in some way determine/indicate what is intended to be written to the write address or how the data are to be modified at the write address.
[0044] The frame type in accordance with
[0045] In the previous example with a frame length of 32 bits (header 8 bits, payload 16 bits, checksum 8 bits), the amount of memory that is addressable in the case of the new frame type in accordance with
[0046] The concept of a frame for the read access with an embedded write command as illustrated in
[0047] Receiving the first frame (MOSI frame) and transmitting the second frame (MISO frame, response frame) take place with a temporal overlap or simultaneously, hence the name in-frame response. Implementing the read operation can take place directly after receiving the first header data, and even before the MOSI frame has been completely received. The two frames (MISO and MOSI frames) can be transferred in the same time interval (cf.
[0048] In one exemplary embodiment, the MOSI frame additionally contains a checksum. In this case, the write operation is implemented only after successful checking of the checksum. The first payload data (of the received MOSI frame) can contain both information regarding a write address and a (payload) data word. In this case, implementing the write operation comprises writing data based on the data word to an area of one or more memories that is specified by the write address.
[0049] Since the read operation is executed even before the entire MOSI frame has been completely received and validated, the checksum of the MOSI frame need not necessarily comprise the read address. In one example, the MOSI checksum can concomitantly comprise the read address in order to be able to concomitantly analyze this part of the frame as well, e.g. with regard to disturbances present during the transfer.