Home

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:
32/64bit 32/64bit 64bit (only PCAN-USB)
Requirements:
  • This adapter uses a native extension to open and read data from the connected device. A setup of this extension maybe required.
Known limitations:
  • None
Status:
  • Stable
Operations:
  • Connect
  • Read
  • Sync
  • Stimulate
  • Handle
Parameters:
  • Enable: Enables/disables the port adapter.
  • Channel: Enter the CAN Bus channel.
  • Mode: Normal , Listen only
  • Symbols: Optionally, define symbols, multiplexers and variables to map message content into signal values.
  • Filters: Optionally, define filters to limit message reception.
  • Script: Allows to define a script to send and receive CAN Bus messages.
  • Insert as root: If the adapter is included in a multi adapter port, the flag will force the adapter to add its signal hierarchy into the root of the combined record.
  • Synchronisation: Allows to define a script to do adapter synchronisation.


Video

Screen Cast: Using the SocketCAN Adapter



Modes



Source Configuration



Filters

You may configure up to 4 filters:

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

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.

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.



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