Raptor:CAN Send Message: Difference between revisions

From NewEagleWiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
[[Raptor-Dev-CAN-Library|Return to CAN page]]
[[Raptor-Dev-CAN-Library|Return to CAN page]]


[[File:RaptorCANSendMessage.jpg|right|thumb|Raptor™ CAN Send Message|300px]]
[[File:CANTX.png|right|thumb|Raptor™ CAN Send Message|300px]]


== Description ==
== Description ==
Line 9: Line 9:


<p>The payload mask and value can be used to specify a particular value for certain bits in the message. All bits in the message with a 1 in the payload mask will be initialized to the value in the payload mask value. The contents of the message will then be bitwise or'd together.</p>
<p>The payload mask and value can be used to specify a particular value for certain bits in the message. All bits in the message with a 1 in the payload mask will be initialized to the value in the payload mask value. The contents of the message will then be bitwise or'd together.</p>
<p>A signal's initial value (aka the start value) can be defined in the DBC using signal attributes named 'GenSigStartValue'.</p>
<p>The ID input allows for calibration of CAN message ID after building the software. It is important to note that the transmitted message ID will be:
[(ID && Mask) || (ID Port && !(Mask))]
where 'ID' is the parameter, and 'ID Port' is the input. This means that at runtime you can only alter the parts of the ID that are not 1 in the mask.</p>
<p>If the Tx Period is set to 0 (or a negative number) for asynchronously transmit the message, you should consider how frequently the containing subsystem is executing. It is easy to send more frequently than you may expect or need. For example, an asynchronously transmitted message in a 5ms task will transmit 200 times per second, which would be 10% of the total bus load on a 250K CAN bus.</p>
<p>250K CAN Bus - handles about 2000 msg/sec</p>
<p>500K CAN Bus - handles about 4000 msg/sec</p>
<p>1000K CAN Bus - handles about 8000 msg/sec</p>


== Inputs ==
== Inputs ==
Line 22: Line 33:
uint32
uint32
|
|
The CAN message ID
The ID used in the receive message filter. This is automatically set from the dbc file.
Shown/hidden by the "Show ID Port" checkbox.
|-
| IsDataValid
| boolean
| Whether the data received at the signal ports is valid.
If true, sends the signal values received; if false, sends the signal start values defined in the DBC.
Signal attribute 'GenSigStartValue' is used to define a start value in the DBC; if the attribute is not defined for that signal, the value will be 0.
Shown/hidden by the "Use Start Vals" checkbox.
|-
|-
|
|
Signals
Signals
| uint32
|
|
|
Any signals from the .dbc that are enabled will appear as inputs on this block.
All the signals defined and enabled in the dbc file.
|}
|}


Line 46: Line 65:
| A list of messages defined in the dbc file, click on a message name to select a new message.
| A list of messages defined in the dbc file, click on a message name to select a new message.
|-
|-
! Signal List
! Side/DLC
|  
| Number
| A list of the signals defined in the message. Select a signal and press 'e' or 'd' to enable and disable signals within a message.
| The length of the CAN Message in bytes.
|-
! CAN Bus
| String
| The CAN bus to transmit the message on.
|-
! Signal Order
| Select
| The option to how the signals are sorted within the GUI.
|-
! Edit ID
| Checkbox
| Allows the Message ID to be edited.
|-
! Message ID
| Number
| The ID used in the transmit message filter. This is automatically set from the dbc file.
|-
! ID Mask
| Number
| The mask used in the transmit message filter.
|-
|-
! Label wires with channel names
! Queue
|  
| Number
| Enable this to automatically name the wires on the input ports with the names of the signals
| Specifies the size of the transmit queue.
|-
|-
! ID
! Payload Value
| Number
| Vector
| The ID used in the receive message filter. This is automatically set from the dbc file.
|-
! Mask
| Number
| The mask used in the receive message filter
|-
! Payload Mask Value
| Vector
| The value used with the payload filter for messages. This will be set automatically for messages with a mode signal.
| The value used with the payload filter for messages. This will be set automatically for messages with a mode signal.
|-
|-
! Payload Mask
! Payload Mask
| Vector
| Vector
| The mask used with the payload filter. This value will be set automatically for messages with a mode signal.  
| The mask used with the payload filter. This value will be set automatically for messages with a mode signal.
|-
! Tx Interval
| Number
| Specifies the period to transmit the CAN message. Set this value to 0 or a negative number to transmit the message each time this block executes (asynchronously).
|-
|-
! Msg Length
! Fill unused bits with '1'
| Number
| Checkbox
| The length of the message in bytes. This will be set automatically from the dbc file.
| Any unused bits in the message will be filled with ones.
|-
|-
! CAN Bus Name
! Use Pretransmit Simulink Function Callback
| checkbox
| Whether to use a Simulink Function callback as a pretransmit hook.
The Simulink Function takes in the raw CAN data to be transmitted & allows the data to be checked and/or manipulated before being sent out on the bus.
Messages longer than 8 bytes are not supported on single-transmit CAN blocks; please use CAN FD or a transport protocol (UDS/J1939) instead.
|-
! Simulink Function Name
| String
| String
| The CAN bus to transmit the message on.
| Name of the Simulink Function to call when the CAN pretransmit hook is triggered.
|-
! Create
| button
| Create a Simulink Function to call when this CAN pretransmit hook is triggered. Must first provide a valid function name.
|-
! Update
| button
| Update the signature of an existing Simulink Function to have 2 inputs and 2 outputs.
|-
! Enable
| Checkbox
| Enable or disable signals within a message.
|-
! Scaled
| Checkbox
| Enable or disable scaling of the signal.
|-
! Show ID Port
| Checkbox
| Makes the ID port available.
|-
|-
! Queue Size
! Label Port Signals
| Number
| Checkbox
| Specifies the size of the receive queue.
| Enable this to automatically name the wires on the output ports with the names of the signals.
|-
|-
! Tx Period
! Use Start Vals
| Number
| Checkbox
| Specifies the period to transmit the CAN message. Set this value to 0 or a negative number to transmit the message only when the block executes.
| Enable this to specify signal start values from the DBC instead of using the default (all zeroes).
This also adds one extra input port, "IsDataValid".
When the value at that port is True, the signal values are taken from the input ports as usual; when the value at the port is False, the Tx block will send out the default values defined in the DBC.
Signal attribute 'GenSigStartValue' is used to define a start value in the DBC; if the attribute is not defined for that signal, the value will be 0.
|}
|}

Latest revision as of 16:56, 12 September 2023

Return to the main Raptor page

Return to CAN page

Raptor™ CAN Send Message

Description

Each CAN tx message block not set to transmit periodically has a transmit queue. This queue is used to store messages if the transmit block is executed faster than the messages can be transmitted on the CAN bus. This will typically happen if the tx raw block is located in a for or while loop. If the queue is full when the block executes the oldest tx message will be overwritten.

The payload mask and value can be used to specify a particular value for certain bits in the message. All bits in the message with a 1 in the payload mask will be initialized to the value in the payload mask value. The contents of the message will then be bitwise or'd together.

A signal's initial value (aka the start value) can be defined in the DBC using signal attributes named 'GenSigStartValue'.

The ID input allows for calibration of CAN message ID after building the software. It is important to note that the transmitted message ID will be: [(ID && Mask) || (ID Port && !(Mask))] where 'ID' is the parameter, and 'ID Port' is the input. This means that at runtime you can only alter the parts of the ID that are not 1 in the mask.

If the Tx Period is set to 0 (or a negative number) for asynchronously transmit the message, you should consider how frequently the containing subsystem is executing. It is easy to send more frequently than you may expect or need. For example, an asynchronously transmitted message in a 5ms task will transmit 200 times per second, which would be 10% of the total bus load on a 250K CAN bus.

250K CAN Bus - handles about 2000 msg/sec

500K CAN Bus - handles about 4000 msg/sec

1000K CAN Bus - handles about 8000 msg/sec

Inputs

Input Type Description

ID

uint32

The ID used in the receive message filter. This is automatically set from the dbc file. Shown/hidden by the "Show ID Port" checkbox.

IsDataValid boolean Whether the data received at the signal ports is valid.

If true, sends the signal values received; if false, sends the signal start values defined in the DBC. Signal attribute 'GenSigStartValue' is used to define a start value in the DBC; if the attribute is not defined for that signal, the value will be 0. Shown/hidden by the "Use Start Vals" checkbox.

Signals

uint32

Any signals from the .dbc that are enabled will appear as inputs on this block.

Parameters

Parameter Type Description
.dbc File The dbc file being used. Click the Load button to select a new dbc file.
Message List A list of messages defined in the dbc file, click on a message name to select a new message.
Side/DLC Number The length of the CAN Message in bytes.
CAN Bus String The CAN bus to transmit the message on.
Signal Order Select The option to how the signals are sorted within the GUI.
Edit ID Checkbox Allows the Message ID to be edited.
Message ID Number The ID used in the transmit message filter. This is automatically set from the dbc file.
ID Mask Number The mask used in the transmit message filter.
Queue Number Specifies the size of the transmit queue.
Payload Value Vector The value used with the payload filter for messages. This will be set automatically for messages with a mode signal.
Payload Mask Vector The mask used with the payload filter. This value will be set automatically for messages with a mode signal.
Tx Interval Number Specifies the period to transmit the CAN message. Set this value to 0 or a negative number to transmit the message each time this block executes (asynchronously).
Fill unused bits with '1' Checkbox Any unused bits in the message will be filled with ones.
Use Pretransmit Simulink Function Callback checkbox Whether to use a Simulink Function callback as a pretransmit hook.

The Simulink Function takes in the raw CAN data to be transmitted & allows the data to be checked and/or manipulated before being sent out on the bus. Messages longer than 8 bytes are not supported on single-transmit CAN blocks; please use CAN FD or a transport protocol (UDS/J1939) instead.

Simulink Function Name String Name of the Simulink Function to call when the CAN pretransmit hook is triggered.
Create button Create a Simulink Function to call when this CAN pretransmit hook is triggered. Must first provide a valid function name.
Update button Update the signature of an existing Simulink Function to have 2 inputs and 2 outputs.
Enable Checkbox Enable or disable signals within a message.
Scaled Checkbox Enable or disable scaling of the signal.
Show ID Port Checkbox Makes the ID port available.
Label Port Signals Checkbox Enable this to automatically name the wires on the output ports with the names of the signals.
Use Start Vals Checkbox Enable this to specify signal start values from the DBC instead of using the default (all zeroes).

This also adds one extra input port, "IsDataValid". When the value at that port is True, the signal values are taken from the input ports as usual; when the value at the port is False, the Tx block will send out the default values defined in the DBC. Signal attribute 'GenSigStartValue' is used to define a start value in the DBC; if the attribute is not defined for that signal, the value will be 0.