Softing CAN-AC2-PCI with Philips SJA1000 FIFO Read

Softing CAN-AC2-PCI with Philips SJA1000 FIFO Read block (not recommended)


Simulink® Real-Time™ Library of Drivers No Longer Recommended for Use.

To open this library, type xpcobsoletelib in the Command Window.


The FIFO Read driver block reads CAN messages from the receive FIFO. The firmware running in FIFO mode puts received events (CAN messages) into the receive FIFO from which the FIFO Read driver reads it.

If you select CAN_MESSAGE data type as the output, use CAN Unpack blocks to unpack individual signals from a CAN message.


To process a remote frame, use the CAN Unpack block with the Output remote check box selected to enable the Remote port. When the Remote port becomes true, send the current value to the requesting subsystem.

If you specify matrix as the output data type, the FIFO Read driver block has one output port of type double. The signal of this port is a matrix of size m*6, where m is the FIFO Read depth defined in the block parameters. For example, if the FIFO read depth is 5, then the matrix signal of port 1 has size 5*6. Therefore, one row for each event is read out of the receive FIFO (no new message is considered an event as well).

If you select double values in a matrix as the output, each row with its six elements contains the information defining a CAN message:


The value can be either 1 (port 1) or 2 (port 2) and reports the port at which the CAN message was received.


Identifier of the CAN message being received. If it is a standard CAN message the range is 0 to 2047. It is an extended CAN message, the range is 0 to 229-1.

Event type

This value defines the type of event read from the receive FIFO. The following values are defined in the Softing® user manual.



No new event.


Standard data frame received.


Standard remote frame received.


Transmission of a standard data frame is confirmed.




Change of bus state.






Transmission of a standard remote frame is confirmed.


Extended data frame received.


Transmission of an extended data frame is confirmed.


Transmission of an extended remote frame is confirmed.


Extended remote frame received.






Error frame detected.

Data frame size

If a data frame has been received, the length of the data in bytes is reported by this element. Possible values are 0 to 8.


Time at which the event was received. The resolution of the timestamp counter is 1 μs.


Data of the data frame itself returned as a CAN_MESSAGE or double value (8 bytes) depending on which data type you are using for your messages. Use the CAN Unpack block to extract the data from the CAN_MESSAGE data value. Use the CAN Bit-Unpacking block to extract the data from the double value.

Block Parameters


Defines the board used to send the CAN messages defined by this block instance. For more information about the meaning of the board number, see the Setup driver block. If one board is present in the target system, select board number 1.

Output format

From the list, select:

  • Matrix of doubles (legacy)

    Formats messages as double values in a matrix. See Description for details on this message format.

  • Vector of CAN_MESSAGE plus count

    Formats messages as vectors of CAN_MESSAGE structures.

    Selecting this option enables the Port parameter. It also creates an N output port that contains the number of valid entries in the CAN_MESSAGE data vector. The block interprets the FIFO read depth value as the size of the vector. The block outputs up to FIFO read depth number of messages. For example, if you enter a read depth of 3, but the receive FIFO has only two messages, the output vector has only two messages.

  • Function call for each CAN_MESSAGE

    Formats messages as vectors of CAN_MESSAGE structures.

    Selecting this option enables the Port parameter. It also creates a function-call output (f()) output port. This port contains a function-call for a single CAN_MESSAGE data element. The block repeats the function-call for each message from the FIFO, up to the value of FIFO read depth. You input this function-call output into a function-call subsystem.


CAN_MESSAGE only. From the list, select 1 or 2 for the input port. The block reads the message from that FIFO (1 or 2). Its output is a vector of CAN_MESSAGE messages. If you want to read from both ports, use two FIFO Read blocks, one for each port. Selecting Vector of CAN_MESSAGE plus count for Output format enables this parameter.

Selecting Matrix of doubles (legacy) or Function call for each CAN_MESSAGE for the Output format parameter disables this parameter. The block ignores the port. In this case, the block reads from both ports and records the port for each message in the output matrix.

FIFO read depth

Defines the number of receive FIFO read attempts. Each time the block is executed it reads this fixed number of events (CAN messages), which leads to a deterministic time behavior regardless of the number of events currently stored in the receive FIFO. The Read depth (m) also defines the size of the matrix signal (m*6) leaving the first output port. If an event is not currently stored in the receive FIFO, the FIFO is read anyway, but the event type is reported as 0 (no new event).

Show status output port

Select this to enable the status output port (S). If the box is cleared (disabled), the block has one output port for the events (D). If enabled, a second port is shown. The signal leaving that port is a vector of doubles, with two elements:

[Number of lost messages (events), Bus state]

The first element returns the current value of the lost messages counter. The receive FIFO can store up to 127 events. If the receive FIFO is not regularly accessed for reading events, the FIFO is filled and the lost messages counter starts to count up. This is an indicator that events (messages) will be unavoidably lost. The second element returns the current bus state. Possible values are



Error active.


Error passive.


Bus off.

Sample time

Defines the sample time at which the FIFO Read block is executed during a real-time application run.


Use only one instance of this block per physical CAN board in your model. Otherwise, one instance can read events that are intended for blocks connected to another instance.

Introduced in R2006a

Was this topic helpful?