MotoHawk:CAN Overview

From MotoHawk
Revision as of 14:47, 17 September 2012 by Wendy.Bolakowski (talk | contribs) (CAN Recive Slot Properties and CAN Recive Slot Trigger)
Jump to navigationJump to search

CAN Overview

CAN= Controller Area Network.

MotoHawk doesn't define a protocol, but provides a set of blocks to access the CAN hardware of the module to implement a protocol.

MotoHawk CAN blocks support CAN 2.0B messages, with both standard (11 bit) and extended (29 bit) IDs.

Blockset Overview

CAN Definition Block

First the Bus must be Initialized for Use.

The CAN DEFINITION BLOCK is used to initialize the CAN hardware, set the baud rate, and configure the transmit queue size.   

Key parameters that can be set on the block include:

  • Bus name
  • Resource (Hardware Channel)
  • Bit Timing - User can select a preset baud rate, or 'Custom' to set Prescalar, Propagation Segment, and RJW
  • Transmit Queue Size
  • Install MotoTune Protocol Checkbox - User selects whether to initialize MotoTune protocol on this CAN bus. If 'None' is selected for all Buses, the module cannot communicate with MotoTune, or be Reflashed via MotoTune. A bootkey would be needed to recover the module
  • City ID - this is the "address" used by MotoServer port to communicate with the module

There must be one CAN definition block for each CAN bus used in the applicaiton. It is only needed to enable MotoTune protocol on one CAN channel. Most modules can program on any CAN bus, the ECM-565-128 can only program on CAN-1.

CAN Raw Blocks

 The Read CAN Raw Block and the Send CAN Raw Block can be used to recieve or send a CAN message without unpacking the content. 

In these blocks, the user would configure what raw message content is recieved or sent by the block. The messages can be filtered by address or message content.


Some terminology:

  • ID: The address of the message
  • Payload: The message content
  • Masks: Which parts of the message to care about, or which to ignore

The ID and Payload use a 'MASK' to tell the MotoHawk model which parts of the ID or payload to care about, and which parts to ignore when filtering a message. The Mask can be defined in the CAN Send or CAN Recieve block mask, or left as the default.

As an example of filtering, lets say the user defines the message ID and ID Mask as follows and does not define any filtering based on payload:

CANFilter.jpg

CAN Recive Slot Properties and CAN Recive Slot Trigger

 The CAN Recieve Slot Properties Block can be used to set the filtering of the recieved message at runtime.  

The CAN message can be associated with a particular 'SLOT'. The Slot is defined by the MotoHawk CAN Recieve Slot Properties Block.

The CAN Recieve Block and its Slot Properties BLock are linked by SLOT NAME.

The filters set in the CAN Read and Send blocks can be made more restrictive by the use of a slot, but not less restricive.

A CAN Slot Trigger Block can also be used to function call a subystem when its CAN message is recieved. The SLOT name in this block must match the name specifid in the corresponding CAN Read block.


CAN Read and CAN Send Blocks

The CAN Read and Send Raw blocks are nice, but often more advanced data parsing is required. The MotoHawk SEND and MotoHawk Read blocks allow the user to set up more complex message struture using an .m file for the message definition.

CAN SEND CAN READ

In the .m file, the user defines: The CAN Channel Interval ID MASK

Message: Name Description Payload Size LSB Length Type (signed/unsigned) Byte Order (Big or Little Endian) Gain Offset