TouCAN Transmit - Transmit CAN message via TouCAN module on MPC5xx

Library

Target Support Package FM5/ MPC555 Driver Library/ CAN 2.0B Controller Module

Description

The TouCAN Transmit block transmits a CAN message onto the CAN bus. The TouCAN Transmit block uses the queue set up by the MPC555 Resource Configuration object (see MPC555 Resource Configuration). The block should be connected to CAN Message Packing blocks. Do not ground the block or leave it unconnected. See the demos mpc555rt_io and mpc555rt_candb for an example.

The TouCAN Transmit block provides three different transmission modes. You should choose which transmission mode to use depending on the requirements of your application. The properties of each transmission mode are summarized in the following table.

Transmit Modes

Priority Queued Transmission with Shared Buffer

Direct Transmission with Dedicated Buffer

FIFO Queued Transmission with Dedicated Buffer

Uses Interrupts

Yes

No

Yes

Configurable queue size

Yes

No

Yes

Order of message transmission

Messages transmitted in order of priority; a new message will overwrite any existing message that is in the queue and has the same identifier and type (standard or extended)

Most recent message overwrites any unsent message in the buffer

Messages transmitted in the order that they were placed in the queue

Hardware buffers consumed

Either one or three hardware buffers are shared by many CAN Transmit blocks

One hardware buffer required for each CAN Transmit block

One hardware buffer required for each CAN Transmit block

CPU time required

Generally more than the other modes; interrupts used but time required to service interrupts is longer because it takes account of message priorities and increases with queue length

Very little; no interrupts used

Little; interrupts used but very simple interrupt service routine

For applications where the message contains time-sensitive (e.g. real-time sensor readings) information, it is recommended to use one of the Priority queued transmission with shared buffer or Direct transmission with dedicated buffer modes. For applications where it is more important that messages are received in the order that they were queued for transmission (e.g. a data logging protocol), it is recommended to use the FIFO queued transmission with dedicated buffer mode.

Note that the Queued transmission with shared buffer mode can use one or three shared buffers depending upon the setting in the Resource Configuration block. See Transmit Shared Buffers in the TouCAN configuration settings of the MPC555 Resource Configuration object. When three buffers are used, the driver ensures that the message entered into arbitration to be transmitted via the CAN bus is always the highest priority message available; furthermore in this mode the TouCAN module is able to transmit messages continuously by re-loading hardware buffers that become empty while another buffer is active transmitting. The shared buffer approach uses either buffer 0 or buffers 0, 1, and 2, depending on the setting in the Resource Configuration block.

If the Queued transmission with shared buffer mode is configured to use three shared buffers, there is a small possibility that some messages would be transmitted more than once. If you want to prevent this behavior, you should use this mode with a single shared buffer or use a mode other than Queued transmission with shared buffer.

The 'Queued transmission with shared buffer' mode maintains a queue of messages that are loaded into a hardware buffer of the TouCAN module as soon as one is available. Note that if a new message is ready to be sent that is higher priority than messages already in the hardware buffers then the lowest priority message will be moved from the hardware buffer back into the queue. This approach ensures that a high priority message cannot be blocked by one or more lower priority messages that are already in the hardware buffers. Under some circumstances it is possible that a lower priority message will actually be transmitted despite being moved from the hardware buffer back into the software queue; if this happens, the message concerned would be transmitted twice rather than once.

Dialog Box

Module

Select TouCAN module A, B or C. Note that the MPC555 only has modules A and B. MPC56x (561-6) also have module C. An error will be thrown if you select C and your target processor does not support this.

The CAN C module shares its pins with the MIOS module (which pins are shared depends on the variant). If you use the CAN C module and MIOS module together, you may experience resource conflicts which you will need to resolve.

Transmit mode

Select one of the transmit modes described in the table.

Length (number of messages) of FIFO queue

If you select the FIFO transmit mode, you can set the number of messages in the FIFO queue here. Note this is only for the FIFO queue and is not the same as the Transmit_Queue_Length Resource Configuration parameter in TouCAN Configuration Parameters, which only applies to shared queues.

Buffer numbers allocated (at last Update Diagram)

Read only field for information on which buffers are in use.

Sample time

Choose -1 to inherit the sample time from the driving blocks. The TouCAN Transmit block does not inherit constant sample times and runs at the base rate of the model if driven by invariant signals.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS