Using the Peak CAN (Classic/FD) Bus Adapter
A CAN-Bus adapter enables the reading and writing of messages from/to a CAN-Bus device. With the new Peak Can-Bus adapter, you can use all Peak USB CAN-Bus devices with impulse to trace and inject messages. You may use the extension on Win32/Linux and OsX. The native extension is based on the Peak PCAN Basic library. Users need to install the Peak drivers on Win32/Linux. For OsX, drivers are not required.
Configuration
- Channel: Select a CAN-BUS channel from the list. You may press the "Identify" button to find the right device (Windows only).
- Rate: Select the required data rate.
Filters
You may configure up to 4 filters:- Id from/to: Select the id range you want to receive.
- Disabled/Standard/Extended/Any: Select the filter mode.
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".
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".
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; }