CAN Blocks: Difference between revisions
No edit summary |
No edit summary |
||
Line 78: | Line 78: | ||
[[Image: ReceiveTriggerBlock.JPG]] | [[Image: ReceiveTriggerBlock.JPG]] | ||
== Workflow of developing CAN using MotoHawk == | |||
There are a couple of workflows to consider for MotoHawk and CAN | |||
a. DBC file -> DBC to M converter -> MotoHawk manipulation to Simulink. This is a standard product New Eagle offers to generate M files. You can purchase DBC files externally or create them using a 3rd party DBC file editor | |||
b. MotoHawk CAN primitives. Create messages from scratch using the MotoHawk CAN blockset. | |||
c. DBC Networking Toolbox - Convert a DBC file -> Simulink model. This is a New Eagle product: '''[http://store.neweagle.net/ProductDetail.jsp?LISTID=8000028A-1294072858 Webstore: DBC Networking Toolbox]''' | |||
==Show an example of configuring the MotoHawk CAN Block== | |||
Those settings are exposed by the custom CAN baud rate selection: | |||
[[Image:CAN_baud_rate.JPG]] | |||
Here is an example of the block correctly configured for 500 kbaud operation on a ECM5554: | |||
[[Image:Show_CAN_baud.JPG]] | |||
[[Image:CAN_def_block.JPG]] | |||
==CCP CAN Protocol Handler== | |||
*Click on the following link to view block description: | |||
'''[[CCP CAN Protocol Block| CCP Protocol Block]]''' | |||
===Motohawk Calibration with INCA=== | |||
*Click the following link to download the document on steps for using INCA as a calibration tool. | |||
'''[http://www.neweagle.net/support/wiki/docs/Extra_Resources/MotoHawk_Calibration_w_Inca.pdf Motohawk Calibration with INCA]''' | |||
[[Category:Application Notes]] | |||
Revision as of 20:44, 11 July 2011
D
MotoHawk:Blocks:CAN Definition Block
Use this MotoHawk® block to select which CAN bus to initialize and define. CAN_1 is available on most ECUs, but CAN_2 and even CAN_3 are also available on some. See specific ECU datasheet for CAN information. Use this block's Bit Timing to select a preset baud rate, or have user-defined attributes set up the CAN baud rate. If a user-defined baud rate is selected, these fields are definable:
- Prescaler
- Propagation Segment
- Phase Segment 1/2
- Resynchronization Jump Width
Each CAN RX block includes an ID, which is used in combination with the mask. Only the bits set to 1 in the mask for the corresponding buffer are compared when detecting a received message. If a Queue Size of zero is input, then no queue will be attached. Check Install MotoTune Protocol to use MotoTune over the given CAN interface.
F
MotoHawk:Blocks:CAN Fault Status Block
This MotoHawk® block reports the current fault status of the selected CAN resource. "Bus Passive" is true when the bus is disconnected, shorted, improperly terminated, the baud rate is incorrect, or if bit error rates are high enough to cause hardware failures. "TX Error Counts" is 0 when the bus is operating properly and greater than 0 when the module is unable to transmit CAN messages. "RX Error Counts" is 0 when the bus is operating properly and greater than 0 when the module is unable to receive CAN messages.
R
MotoHawk:Blocks:CAN Read Message Block
This MotoHawk® block will receive and unpack a CAN message on the selected CAN channel. Attach Simulink signal specifications the output ports, to convert the output signals to an appropriate data type. Specifically, if a gain or offset is applied in the message specification, assign the signal to the floating-point data type.
Physical CAN Channel: The physical channel on which to transmit
Message Definition: A structure or a cell array of structures describing all of the details of 1 or more CAN messages. See motohawk_can_example.m for precise details of the structure.
Queue Size: This sets the size of the incoming message queue that will hold messages until this block executes. A value of zero or one will make only the most recently received message available.
Slot Name: The slot name can be used to connect this block to a slot which can be used to dynamically adjust the ID, ID Mask, Payload, and Payload Mask values.
Show Data Available Port: If selected a port will be added that will have the value 1 if a message is available and zero otherwise. If the queue size is larger than 1 than you can hook a Simulink Do-While block to this port and poll all of the messages out of the Queue.
Show Age Count Port: This port will increment every time the block executes and no messages are available. The date from this port can be used to do timeout logic on a message.
Label Wires with Field Names: Selecting this checkbox will cause the field names to be applied to the wires leading out of the block.
MotoHawk:Blocks:CAN Receive Slot Properties Block
This MotoHawk® block allows the user to configure the slot properties at run time.
S
MotoHawk:Blocks:CAN Send Message Block
This MotoHawk® block will pack and transmit one or more CAN messages on the selected CAN channel.
Name: The name of the CAN channel on which to transmit that is defined in a CAN definition block.
Message Definition: A structure or a cell array of structures describing all of the details of 1 or more CAN messages. See motohawk_can_example.m for precise details of the structure.
Pacing Interval[ms]: The time to delay between transmitting messages for a multiple message group. The pacing interval will insert the selected amount of time between each message if an array of messages has been specified. The group of messages will be transmitted at the interval defined in the message structure but will have an inter-message delay of the Pacing Interval. If the number of messages multiplied by the pacing interval is longer than the message interval, the latter messages will be dropped the cycle restarted with the first message in the group.
Label Wires with Field Names: Selecting this checkbox will cause the field names to be applied to the wires leading into the block.
MotoHawk:Blocks:CAN Send Message Raw Block
This MotoHawk® block is analogous to the Read CAN Raw block except that it transmits messages on the CAN bus instead of reading them. For single frame messages, the more advanced Send CAN Message block is typically preferred instead since this block does not perform any bit packing. It can be useful, however for sending multi-frame messages where data spans multiple CAN frames using the same message ID.
MotoHawk:Blocks:CAN Slot Trigger Block
This MotoHawk® block triggers whenever a CAN message is received on the given Slot.
Workflow of developing CAN using MotoHawk
There are a couple of workflows to consider for MotoHawk and CAN
a. DBC file -> DBC to M converter -> MotoHawk manipulation to Simulink. This is a standard product New Eagle offers to generate M files. You can purchase DBC files externally or create them using a 3rd party DBC file editor
b. MotoHawk CAN primitives. Create messages from scratch using the MotoHawk CAN blockset.
c. DBC Networking Toolbox - Convert a DBC file -> Simulink model. This is a New Eagle product: Webstore: DBC Networking Toolbox
Show an example of configuring the MotoHawk CAN Block
Those settings are exposed by the custom CAN baud rate selection:
Here is an example of the block correctly configured for 500 kbaud operation on a ECM5554:
CCP CAN Protocol Handler
- Click on the following link to view block description:
Motohawk Calibration with INCA
- Click the following link to download the document on steps for using INCA as a calibration tool.
Motohawk Calibration with INCA
Vector DBC to M-file Conversion
Product:
Common Errors
Error while running the .exe file on XP:
This occurs because the motohawk_candb2mhcan application has a dependency on the Vector canDBlib. Make sure that all files from the Vector CanDBlib disk are installed. Installing the files should place the cdbmsmo.dll on the computer. If it is not installed to the Windows\System32 directory, than simply make sure the motohawk_canb2mhcan.exe and the cdbmsmo.dll are in the same directory.
New Eagle DBC CAN Networking Toolbox
New Eagle's Network Toolbox makes it easy to create CAN input and output blocks in MotoHawk. Instead of manually writing code in MATLAB to handle CAN messaging, Network Toolbox enables you to have useful CAN blocks starting from an industry-standard .dbc file to describe the CAN network. This saves development and debugging time and reduces complexity.
Please request a data sheet from Contact Sales
To purchase, please visit our webstore link webstore
J1939 CAN Implementation
The J1939 tool box includes an m file of most of the basic J1939 messages. There is also a Simulink model for DM1, DM11, Address Claiming, and Static and Dynamic messaging. Since the model does not cover the entire protocol, some customized setup may required and assistance for this is included with the purchase of the library.