RC04 SocketCAN Adapter
Outline
The SocketCAN adapter enables the reading and writing of messages (classic and FD) from SocketCAN as well as the extraction and tracing of message contents such as bits, integer and text. CAN-Bus symbols can be imported from PCAN symbol files. Using simple scripts, users can generate messages or handle received CAN frames.The adapter can be combined with other adapters using a multi-adapter port.
Platforms: |
|
|||
Requirements: |
|
|||
Known limitations: |
|
|||
Status: |
|
|||
Operations: |
|
|||
Parameters: |
|
Video
Modes
- In "Normal" mode, the adapter supports all operations.
- If "Listen only" mode is chosen, the adapter is only capable to listen to the bus.
Source Configuration
- Channel: Enter the SocketCAN port name.
Filters
You may configure up to 4 filters:
- Id value/mask: Enter the value/mask pair for messages for want to receive.
- Disabled/Standard/Extended/Any: Select the filter mode.
SocketCAN uses a value/mask filter. A message passes this filter if "received_can_id & mask == value & mask".
Symbols
You may define/import a hierarchy of CAN symbols with optional multiplexers and variables. Each
variable creates exactly one signal.
CAN Messages that comply with the configured hierarchy
of symbols and multiplexers, trigger the containing variables to update their value (and create a
new sample for their signal).
CAN Symbol
- Id from/to: Define the id range for the symbol. In most cases just "Id from" is used.
- Type: Select either Standard or Extended type messages.
- Frame: Select Classic or FD frame (FD devices only)
- Packet length: Select either the required packet length or "Any".
- Direction: Select the message direction "Receive", "Send" or "Any".
If a CAN Message is received or send and complies with the symbol information above, all child multiplexer and variables are triggered.
CAN Multiplexer
A multiplexer can be seen as a filter. Only CAN message with the correct data bits at a given position trigger its child variables to update.
- Endianess: Select the byte order mode Little (Intel) or Big (Motorola)
- Value: Type in the multiplexer value (an unsigned integer).
- Bit pos: Select the start position of the multiplexer value.
- Length: Type in the length of the multiplexer value.
- Packet length: Select either the required packet length or "Any".
Instead of entering the bit pos/length manually, you may use the mouse to select the bit range.
CAN Variable
A variable is updates with the data of a CAN message if its parent multiplexer and symbol comply with the message.
- Type: Select the variable/signal type (Binary, Logic, Event(Enums), Text, Integer, Float).
- Endianess: Select the byte order mode Little (Intel) or Big (Motorola). This has no effect for text and binary data type.
- Bit pos: Select the start position of the message value (Alternatively you may use the the mouse to select the bit field).
- Length: Type in the length of the message value.
- Display format: Select the default value representation of the variable.
- Enums: If Event is selected as data type, define here the enumeration values.
- Min/Max: Optionally select a min/max range. If the actual value exceed the given range, the conflict flag is set to true (will paint samples with red color).
Script
If you need to inject messages, check the flag "Enable Script" and modify the example script below. You may also define handlers for in-coming message.
// can: Can bus adapter // can.send(id,type,data,..); // with type in STANDARD,EXTENDED or RTR // generator: generator of type IRecordGenerator // console: console output of type MessageConsoleStream // progress: progress control of type IPortProgress function onMessage(message <:CanMessage:> ) { // answer if (message.id == 12) { console.println("received " + message.getLength()); can.send(14, STANDARD, 0, 1, 2, 3); } // cancel if (message.id == 99) progress.cancel(); } var n = 0; while (true) { // send messages n++; can.send(12, STANDARD, n, 1, 2, 3); can.send(24, EXTENDED, n, 1, 2, 3, 4, 5, 6, 7); // sleep and check end java.lang.Thread.sleep(100); if (progress.isCanceled()) break; }
Synchronization
Using a multi adapter port, you can combine an unlimited number of different input adapters. The synchronization section of the adapters allows you to synchronize inputs with different domain bases (e.g. each input has its own time base).
11 Synchronisation