In a FlexRay node, message buffers are the means by which the application can decouple its message transmission and reception from the actual FlexRay protocol, allowing asynchronous operation of the application with respect to the timing of FlexRay bus.
Setting up the message buffers in a FlexRay node involves implementing the required hardware and developing application software to configure, control, and monitor the message buffers according to the communication needs of the target system. In this article, we introduce the message buffer concept and illustrate how to set up message buffers to meet various requirements regarding deterministic latency and fault tolerance.
OverviewPlace data to be transmitted into a region of shared memory and know that the corresponding FlexRay frame will be transmitted on the FlexRay bus in its assigned slot
The message buffer concept essentially enables the application associated with a FlexRay node to:
Respond to a notification that a valid FlexRay frame has been received and retrieve the corresponding data from its assigned region of shared memory
Figure 1 below shows the structure of a typical FlexRay node connected in a five-node FlexRay cluster using a dual-channel bus topology. Within the FlexRay Communication Controller, there are two main blocks:The FlexRay Protocol Engine (PE) implements the majority of the FlexRay protocol, including transmitting and receiving frames, maintaining clock synchronization with other nodes in the cluster, and generating and checking CRC.
The Controller Host Interface (CHI) provides the application with the means to configure, control, and monitor the PE and to exchange the message data and status between the application and the PE. Message exchange is accomplished through a set of message buffers implemented in the node; each message buffer is assigned to a communication slot in the FlexRay bus timing hierarchy.
View a full-size image
A well-designed FlexRay Communication Controller will typically implement the configuration, control, and status registers for the message buffers in the CHI and use a region of the shared memory to store the actual transmit/receive frame header, payload data, and slot status data associated with the configured message buffers.
Transmit-message buffer setupFrame ID: Corresponds to the slot number in which the message will be transmitted. Whether the selected slot is a static or dynamic slot depends on how many static slots are configured for the cluster.
The configuration data required for a transmit message buffer includes:
Channel: For static slots, a message buffer can be assigned to channel A or channel B or channels A and B. For dynamic slots, a message buffer can be assigned to channel A or B, but not both A and B.
For each transmit buffer, the CHI must also provide a means for the host to access the following control and status information:Data valid: An indication from the host that the transmit message buffer contains data that is valid for transmission
Slot status: A set of specification-defined slot status bits made available to the host from the CHI
Other configuration information that may be implemented by a CHI includes:Cycle count filtering so that message transmission only occurs in the assigned slot in the assigned communication cycle (used only in the dynamic segment)
Pointer to the location of the message header and payload data in the shared memory
State or event mode transmission, which determines whether the node always transmits the valid data in each assigned slot or only when the data has been updated since the last transmission of that message buffer
As a simple example, suppose that nodes B, C, D, and E in Figure 1 must send a critical message to node A once per communication cycle; the message must be duplicated on channels A and B. Suppose also that nodes B, C, D, and E must also send diagnostic messages to node A on an ad-hoc basis (as requested by node A); separate diagnostic messages are required for channels A and B on each node. Nodes B, C, D, and E would then each require the following transmit buffer setup:One transmit buffer assigned to the static segment, channels A and B
One transmit buffer assigned to the dynamic segment, channel A
One transmit buffer assigned to the dynamic segment, channel B
To transmit the diagnostics request message to each node, node A could use:Four transmit buffers assigned to the dynamic segment, channel A (one for each node)
Four transmit buffers assigned to the dynamic segment, channel B (one for each node)