CAN Definition

This MotoHawk™ block selects which CAN bus to initialize.

Block ID

CAN Definition

Library

MotoHawk_lib/CAN Blocks

Description

This MotoHawk™ block selects which CAN bus to initialize. It has configuration options for the baud rate settings.

The first option is choosing one of the fixed "default" baud rate settings. All of these selections won't be supported on all modules, but it offers default time quanta settings that are appropriate for the target if it is available.

The second option is setting up "custom" baud rate settings. This option controls the exact baud rate and the time quanta settings. Additionally, there is an option to specify these settings with a data store. The block cross checks for data type and dimension if this is selected. If a data store is used for selecting the time quanta, then another option exists for some modules to choose if time quanta changes should take place immediately, or only upon a restart of the application. The default is for time quanta changes to take place upon the next application startup.

Note that the baud rate settings are only applied on power on unless the 'Update Bit Timing Without Restart' option is available and chosen. The data store "Storage" setting is very important when the bit timing is only applied at application startup.

The CAN Baud Rate Status block can assist the configuration of these settings at run time.

Selecting Time Quanta

When setting up "custom" baud rate settings, the following equation is used to determine the actual attainable baud rate:
baudrate calcuation
Where:
rp = required prescalar
mp = maximum prescalar
ab = attainable baud rate
db = desired baud rate
ttq = total time quanta
clock = clock frequency

Refer to the appropriate target help page to determine CAN clock frequency and hardware specific limits to prescalar.

Example: Suppose a particular module has a CAN clock of 14000000 Hz and a Total Time Quanta of 14 is desired for the 250 KBaud bus speed. The equation would reveal a required prescalar of floor(14000000/(250000*14)) = 4. The module limits the prescaler between 1 and 255, so the actual attainable baud rate would be 14000000 / (max (min(4, 255) , 8) * 14 ) = 250000.

Block Parameters

Parameter Field Values Comments/Description
Name Alpha-numeric text, single-quote enclosed Name of CAN definition. Should be unique and C-legal (no special characters such as spaces, dashes, commas, though underscore allowed. Other MotoHawk blocks may reference this CAN channel by the name entered in this field. For instance, the user could define the name of CAN 1 as ‘Body_Bus’ while naming CAN 2 ‘Engine_Bus’.
Resource Dropdown Specify which CAN resource to initialize.
Bit Timing Source Dropdown "Default" displays a fixed dropdown list of baud rate options or "Custom" displays more options for baud rate settings.

NOTE: Most applications use one of the pre-defined baud rates, usually 250k. Only advanced users with specific needs are advised to attempt to utilize a custom baud rate.
Default Bit Timing Dropdown Only visible if "Default" is selected for the Bit Time Source.
Select from a fixed dropdown list of baud rates. The time quanta settings are chosen automatically.
Update Bit Timing Without Restart Checkbox Only visible if "Custom" is selected for the Bit Time Source and a time quanta parameter source is a data store.
If checked, time quanta changes are effective without a restart of the application.
Baud Rate Source Dropdown Only visible if "Custom" is selected for the Bit Time Source. Select either "Constant" or "Data Store Reference".
Baud Rate Numeric Only visible if "Custom" is selected for the Bit Time Source and Baud Rate Source is set to "Constant". Specifies the desired baud rate. It must be from 1-1000000.
Baud Rate Data Store Name Alpha-numeric text Only visible if "Custom" is selected for the Bit Time Source and Baud Rate Source is set to "Data Store Reference". Specifies an existing uint32 scalar data store name.
Sample Point Time Quanta Source Dropdown Only visible if "Custom" is selected for the Bit Time Source. Select either "Constant" or "Data Store Reference".
Sample Point Time Quanta Dropdown Only visible if "Custom" is selected for the Bit Time Source and Sample Point Time Quanta Source is set to "Constant". Specifies the desired sample point time quanta.
Sample Point Time Quanta Data Store Reference Alpha-numeric text Only visible if "Custom" is selected for the Bit Time Source and Sample Point Time Quanta Source is set to "Data Store Reference". Specifies an existing uint8 scalar data store name.
Total Time Quanta Source Dropdown Only visible if "Custom" is selected for the Bit Time Source. Select either "Constant" or "Data Store Reference".
Total Time Quanta Dropdown Only visible if "Custom" is selected for the Bit Time Source and Total Time Quanta Source is set to "Constant". Specifies the desired total time quanta.
Total Time Data Store Reference Alpha-numeric text Only visible if "Custom" is selected for the Bit Time Source and Total Time Quanta Source is set to "Data Store Reference". Specifies an existing uint8 scalar data store name.
Synchronization Jump Width Source Dropdown Only visible if "Custom" is selected for the Bit Time Source. Select either "Constant" or "Data Store Reference".
Synchronization Jump Width Dropdown Only visible if "Custom" is selected for the Bit Time Source and Synchronization Jump Width Source is set to "Constant". Specifies the desired synchronization jump width.
Synchronization Jump Width Data Store Reference Alpha-numeric text Only visible if "Custom" is selected for the Bit Time Source and Synchronization Jump Width Source is set to "Data Store Reference". Specifies an existing uint8 scalar data store name.
Transmit Queue Size Numeric Specify the number of messages held in the transmit queue. For most applications the default of 16 is adequate. Applications sending many CAN messages may require a larger value.
Receive Queue Size Numeric Specify the number of messages held in the receive queue. For most applications the default of 16 is adequate. Applications receiving many CAN messages may require a larger value.
Receive Self-Transmitted Messages Check box The hardware supports a configuration that will allow message frames transmitted by this resource to also be received by this resource. Such received message frames are indistinguishable from received message frames sent by another source. This feature is enabled when checked and disabled when unchecked. Disabling this feature may enhance execution performance by minimizing the number of messages that the CAN software needs to service.

This option will only be visible if the selected resource's hardware allows the application to control how this "self-reception" feature is to behave.
HW Receives Self-Transmitted Messages Check box Hardware may have an inbuilt, unmodifiable configuration that defines whether message frames transmitted by this resource are also received by this resource. This resource will receive message frames that it transmits when this attribute is checked and won't receive them when unchecked.

This attribute will only be visible when MotoHawk is able to determine how the selected resource will behave.