CAN-Bus smartCORE Socket Module
Description
The CAN-Bus module provides the CAN-Bus hardware interface via the Fast Message Dispatcher.
It
- on the one hand, read CAN-Bus messages are dispatched
- on the other hand, a write mechanism is provided
In principle, the module can be operated with any Fast Message Receiver. In the context of the CAN bus, the following are appropriate:
- the (generic) Fast Message Producer ("fmproducer")
- the DBC Receiver module ("dbc")
Interfaces & Protocols Used
- CAN bus
- Fast Message Dispatching
JSON Configuration
The following section describes the module’s entire JSON configuration and explains the individual parameters.
Example Configuration (Minimal)
{
"module":"CANBus1",
"factory":"canbus",
"config":{
"interface":1
}
}
Example Configuration (Maximal)
{
"module":"CANBus1",
"factory":"canbus",
"config":{
"fmd":"CANBus1",
"priority":80,
"writeBufferSize":1024,
"interface":1,
"bitrate":500000,
"listenOnly":false,
"maxBurstDurationUs":0,
"dispatchCanIdAsDataPrefix":false,
"smioUtcClock":"0x010"
}
}
Parameter List
| Parameter Name | Required | Data Type | Valid Value Range | Default | Description |
|---|---|---|---|---|---|
| fmd | No | STRING | Name of the module instance | Fast Message Dispatcher Name | |
| priority | No | INT | 1 - 99 | 80 | Scheduling priority of the CAN bus interface |
| writeBufferSize | No | INT | 1 - | 8192 | Maximum number of frames in the write buffer |
| interface | YES | INT or STRING | 1 - | N/A | Index or name of the CAN bus interface (see smartDEVICE documentation) |
| bitrate | No | INT | 1 - | 500000 | Bitrate of the CAN bus interface |
| listenOnly | No | BOOL | false, true | false | Listen-only flag of the CAN bus interface |
| maxBurstDurationUs | No | INT | 0 - | 0 | Maximum burst duration [us] of the CAN bus interface |
| dispatchCanIdAsDataPrefix | No | BOOL | false, true | false | Prepend the 32-bit CAN ID in little-endian format to the forwarded CAN bus data frame. This is useful for CAN ID-independent fast message receivers, such as CAN RAW and debugging |
| keepEFFFlag 1 | No | BOOL | false, true | false | Typically, the EFF flag is set automatically in CAN addressing, depending on the value range of the CAN ID (11 / 29 bits). For interpretation, the bit can be passed on to the fmproducer. In this case, 29-bit addresses must be specified with the offset 2147483648 (0x80000000). |
| smioUtcClock 2 | No | INT or STRING | 0, 1 - 0x7FF | 0 | CAN ID on which the system time is sent every 10 seconds to all smartIO with ESP32 firmware (see smartIO clock). 0 disables the function. As a STRING, hex values such as "0x010" are also accepted. |
smartIO clock (smioUtcClock)
The smartIO devices with ESP32 firmware (e.g. smartIO 8x24) have no battery-backed real-time clock. They take their time from a CAN message whose CAN ID is set on the smartIO with SYStem:UTC (default 0x010).
If smioUtcClock is set, the canbus module sends this message every 10 seconds as a broadcast to all smartIO on the bus. There is no acknowledgement. The CAN ID in the canbus module and on the smartIO must match.
| Byte | Content |
|---|---|
| 0 - 5 | System time in milliseconds since 1970-01-01 UTC, 48 bit, Motorola (big endian) |
| 6 | 0 |
| 7 | Checksum: sum of bytes 0 - 6 (modulo 256) |
The system time of the smartCORE device is sent as it is. If the system clock is wrong, the smartIO receive the wrong time as well.
With "listenOnly": true, smioUtcClock is ignored.
Module Information
| Information | Value |
|---|---|
| Author | optiMEAS GmbH |
| Since smartCORE | 0.120 |
| Module Type | Dispatcher (Producer) |
| Dependencies | Any Fast Message Receiver module (e.g., "dbc", "fmproducer") |