| Contents | Index |
Embedded Coder/ Embedded Targets/ Processors/ Texas Instruments C2000/ C2803x
Embedded Coder/ Embedded Targets/ Processors/ Texas Instruments C2000/ C280x
Embedded Coder/ Embedded Targets/ Processors/ Texas Instruments C2000/ C28x3x
Embedded Coder/ Embedded Targets/ Processors/ Texas Instruments C2000/ C2834x
The C280x/C2803x/C28x3x 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/C2803x/C28x3x supports eCAN data frames in standard or extended format.
The eCAN Receive block has up to two and, optionally, three output ports.
The first output port is the function call port, and a function call subsystem should be connected to this port. When a new message is received, this subsystem is executed.
The second output port is the message data port. The received data is output in the form of a vector of elements of the selected data type. The length of the vector is always 8 bytes. The message data port will always output data. When the block is used in polling mode, if there is no new message created between the consecutive executions of the block, then the old message, or the existing message, is repeated.
The third output port is optional and appears only if Output message length is selected.
To use the eCAN Receive block with the eCAN Pack block in the canmsglib, set Data type to CAN_MESSAGE_TYPE.

Select the processor that has the eCAN module.
Determines which of the two eCAN modules is being configured by this instance of the eCAN Receive block. Options are eCAN_A and eCAN_B.
This parameter is not visible when you set Chip family to C2803x.
Sets the value of the mailbox number register (MBNR). For standard CAN controller (SCC) mode, enter a unique number from 0 to 15. For high-end CAN controller (HECC) mode enter a unique number from 0 to 31 . In SCC mode, transmissions from the mailbox with the highest number have the highest priority. In HECC mode, the mailbox number only determines priority if the Transmit priority level (TPL) of two mailboxes is equal.
Sets the value of the message identifier register (MID). The message identifier is 11 bits long for standard frame size or 29 bits long for extended frame size in decimal, binary, or hex format. For the binary and hex formats, use bin2dec(' ') or hex2dec(' '), respectively, to convert the entry.
Select Standard (11-bit identifier) or Extended (29-bit identifier).
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.
Note For information about setting the timing parameters of the CAN module, see Configuring Timing Parameters for CAN Blocks. |
Select one of the following options:
uint8 (vector length = 8 elements)
uint16 (vector length = 4 elements)
uint32 (vector length = 2 elements)
CAN_MESSAGE_TYPE (Select this option to use the eCAN receive block with the CAN Unpack block.)
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. The data are unpacked as follows using the data buffer, which is 8 bytes.
For uint8 data, eCAN Receive reads each unit of 8 bytes in the registers, and outputs 8-bit data to 8 elements (using the lower part of the 16-bit memory):
Output[0] = data_buffer[0]; Output[1] = data_buffer[1]; Output[2] = data_buffer[2]; Output[3] = data_buffer[3]; Output[4] = data_buffer[4]; Output[5] = data_buffer[5]; Output[6] = data_buffer[6]; Output[7] = data_buffer[7];
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
When you select CAN_MESSAGE_TYPE, the block outputs the following struct data (defined in can_message.h):
struct {
/* Is Extended frame */
uint8_T Extended;
/* Length */
uint8_T Length;
/* RTR */
uint8_T Remote;
/* Error */
uint8_T Error;
/* CAN ID */
uint32_T ID;
/*
TIMESTAMP_NOT_REQUIRED is a macro that will be defined by Target teams
PIL, xPC if they do not require the timestamp field during code
generation. By default, timestamp is defined. If the targets do not require
the timestamp field, they should define the macro TIMESTAMP_NOT_REQUIRED before
including this header file for code generation.
*/
#ifndef TIMESTAMP_NOT_REQUIRED
/* Timestamp */
double Timestamp;
#endif
/* Data field */
uint8_T Data[8];
};
Set the value the eCAN node outputs to the model before it has received any data. The default value is 0.
Select to output the message length in bytes to the third output port. If not selected, the block has only two output ports.
Select this check box to post an asynchronous interrupt when a message is received.
Select the interrupt line the asynchronous interrupt uses. This action sets bit 2 (GIL) in the Global Interrupt Mask Register (CANGIM):
1 maps the global interrupts to the ECAN1INT line.
0 maps the global interrupts to the ECAN0INT line.
For detailed information on the eCAN module, visit ti.com and search for the documentation related to your processor. The following materials are available at the Texas Instruments Web site:
TMS320F2833x, 2823x Enhanced Controller Area Network (eCAN) Reference Guide, Literature Number SPRUEU1
TMS320x280x/2801x Enhanced Controller Area Network (eCAN) Reference Guide, Literature Number SPRUEU0
TMS320x2803x Piccolo Enhanced Controller Area Network (eCAN) Reference Guide, Literature Number: SPRUGL7
C280x/C2803x/C28x3x/c2834x eCAN Transmit
C280x/C2802x/C2803x/C28x3x Hardware Interrupt

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |