Type
Generic CAN
CAN Bus semantics
This driver is a generic purpose driver. It allows implementing a basic CAN bus listening or writing scenarios.
CAN bus open is a specific protocol built on top of CAN bus.
Connection String Options
Name |
Default Value |
Required |
Description |
|
Name |
Generic CAN |
|||
Code |
|
|||
Maven Dependency |
<dependency> <groupId>org.apache.plc4x</groupId> <artifactId>plc4j-driver-can</artifactId> <version>0.12.0</version> </dependency> |
|||
Default Transport |
|
|||
Supported Transports |
|
|||
Config options: |
||||
|
INT |
Node id of the target device. |
||
|
INT |
1000 |
Default timeout for all types of requests. |
|
Transport config options: |
||||
socketcan |
Name | Value | Description |
---|---|---|
Supported Operations |
||
publish |
|
Allows to publish a CAN frame via CAN transport. |
receive |
|
This operation allows listening for incoming data or requests. |
More details on the driver
Given popularity of CAN in multiple market segments there is variety of protocols which can’t be published. Also, for many cases which are data acquisition oriented it is necessary to tap only parts of communications.
This driver allows to model incoming and outgoing communication using plain Apache PLC4X api. The written CAN data is constructed from fields submitted via write request builder. The receiving data is transformed in similar fashion, based on subscribed fields.
Address format
Service | Format | Supported operations | Description |
---|---|---|---|
n/a |
nodeId:type[arraySize] |
|
There is only one syntax which is currently supported by this driver. |
Pay attention. You can use multiple fields to write and subscribe actual data. All fields must sum to up to 64 bits. If you subscribe less, then remaining data is discarded and not available via PLC4X api.
The data will be sent in the same order as fields.
Below table contains type mapping defined in Generic CAN driver.
CANopen Type |
Length (in bits) |
PLC4X Type |
BOOLEAN |
1 |
BOOL |
UNSIGNED8 |
8 |
USINT |
UNSIGNED16 |
16 |
UINT |
UNSIGNED24 |
24 |
UDINT |
UNSIGNED32 |
32 |
UDINT |
UNSIGNED40 |
40 |
ULINT |
UNSIGNED48 |
48 |
ULINT |
UNSIGNED56 |
56 |
ULINT |
UNSIGNED64 |
64 |
ULINT |
INTEGER8 |
8 |
SINT |
INTEGER16 |
16 |
INT |
INTEGER24 |
24 |
DINT |
INTEGER32 |
32 |
DINT |
INTEGER40 |
40 |
LINT |
INTEGER48 |
48 |
LINT |
INTEGER56 |
56 |
LINT |
INTEGER64 |
64 |
LINT |
REAL32 |
32 |
REAL |
REAL64 |
64 |
LREAL |
The type table is similar to CANopen. Main difference is lack of support for string types.