C280x eCAN Receive

www.kxcad.net Home > CAE Software Index > MATLAB Index >



Enhanced Control Area Network receive mailbox

Library

c280xdspchiplib in Target for TI C2000

Description

The C280x enhanced Control Area Network (eCAN) Receive block generates source code for receiving eCAN messages through an eCAN mailbox. The eCAN modules on the DSP chip provide serial communication capability and have 32 mailboxes configurable for receive or transmit. The C280x supports eCAN data frames in standard or extended format.

The C28x eCAN Receive block has up to two and, optionally, three output ports.

Dialog Box

Module

Determines which of the two eCAN modules is being configured by this instance of the C280x eCAN Receive block. Options are eCAN_A and eCAN_B.

Mailbox number

Unique number from 0 to 15 for standard or from 0 to 31 for enhanced CAN mode. It refers to a mailbox area in RAM. In standard mode, the mailbox number determines priority.

Message identifier

Identifier of length 11 bits for standard frame size or length 29 bits for extended frame size in decimal, binary, or hex. If in binary or hex, use bin2dec(' ') or hex2dec(' '), respectively, to convert the entry. The message identifier is associated with a receive mailbox. Only messages that match the mailbox message identifier are accepted into it.

Message type

Select Standard (11-bit identifier) or Extended (29-bit identifier).

Sample time

Frequency with which the mailbox is polled to determine if a new message has been received. A new message causes a function call to be emitted from the mailbox. If you want to update the message output only when a new message arrives, then the block needs to be executed asynchronously. To execute this block asynchronously, set Sample Time to -1, check the Post interrupt when message is received box, and refer to Asynchronous Interrupt Processing for a discussion of block placement and other necessary settings.

Data type

Type of data in the data vector. The length of the vector for the received message is at most 8 bytes. If the message is less than 8 bytes, the data buffer bytes are right-aligned in the output. Only uint16 (vector length = 4 elements) or uint32 (vector length = 8 elements) data are allowed. The data are unpacked as follows using the data buffer, which is 8 bytes.

For uint16 data,

Output[0] = data_buffer[1..0];
Output[1] = data_buffer[3..2];
Output[2] = data_buffer[5..4];
Output[3] = data_buffer[7..6];

For uint32 data,

Output[0] = data_buffer[3..0];
Output[1] = data_buffer[7..4];

For example, if the received message has two bytes,

data_buffer[0] = 0x21
data_buffer[1] = 0x43

the uint16 output would be:

Output[0] = 0x4321
Output[1] = 0x0000
Output[2] = 0x0000
Output[3] = 0x0000
Output message length

Select to output the message length in bytes to the third output port. If not selected, the block has only two output ports.

Post interrupt when message is received

Select this check box to post an asynchronous interrupt when a message is received.

References

Detailed information on the eCAN module is in TMS320x281x, 280x Enhanced Controller Area Network (eCAN) Reference Guide (Rev. D), Literature Number SPRU074D, available at the Texas Instruments Web site.

See Also

C280x eCAN Transmit, C280x Hardware Interrupt

  


© 1984-2007 The MathWorks, Inc. Terms of Use Patents Trademarks Acknowledgments