Error handling¶
Fieldbus Access automatically sets up system signals during its initialization face. These signals are accessed for various error information in your application.
CAN bus error¶
The system signal fieldbusAccess_CANBusError_CAN#
receives CAN-Bus info,
warning and errors from the SocetCAN driver as follows:
WarningLimitSet
WarningLimitReset
ErrorPassiveSet
ErrorPassiveReset
BusOff
Overrun
StuffError
FormError
AckError
CrcError
RxBuffHighOverrun
RxBuffLowOverrun
BusOffReset
FirstBusContact
J1939¶
J1939 errors and CAN bus errors are available on the following signals:
J1939 error¶
With the LinX Manager plugin configured applications will have generated files
injected. These files helps with Data Engine connection and communication.
System signal fieldbusAccess_J1939Error_CAN#
receives listed error codes from
the J1939 stack.
Following information is available for each received error message.
Info | Description |
---|---|
Bus | CAN bus interface # |
Level | Error level |
Code | Error Codes |
Identifier | Error identifier |
AddInfo | Additional info if available, like PGN concerned |
Description | Descripton of the error in clear text |
Started | Time when error was received |
Ended | Time when the error was cleared (if possible) |
Exists | True if error still active |
J1939 error example¶
For a table showing received errors, use fieldbusAccessErrorModel
and add
following to main.qml:
ListView {
id: errorListView
width: view.width - exitButton.width
height: view.height / 1.5
model: fieldbusAccessErrorModel
delegate: Rectangle {
id: listComponent
width: view.width - exitButton.width
height: 20
color: "#333"
border {
width: 1
color: "#777"
}
property color textColor: level == 'OK' ? "#fff" : "#f33"
Row {
spacing: 25
topPadding: 2
Text {
text: Number.fromLocaleString(addInfo).toString(16).toUpperCase()
color: listComponent.textColor
}
Text {
text: level
color: listComponent.textColor
}
Text {
text: description
color: listComponent.textColor
}
Text {
text: started
color: listComponent.textColor
}
}
}
}
Output:
Info | Level | Description | Received |
---|---|---|---|
FEEE | Error | A registered message wasn't received in given time | 2021-03-18T13:43:09.974 |
FF71 | Error | A registered message wasn't received in given time | 2021-03-18T13:43:09.974 |
FEEE | Error | A registered message wasn't received in given time | 2021-03-18T13:43:10.524 |
For a description of received error codes, please see J1939 Error description
CANopen¶
Stack errors, NMT state and bus errors will be available as Data Engine signals:
If loosing connection to Data Engine, the node will go to pre-operational. This behaviour is configurable.
CANopen error¶
With the LinX Manager plugin configured applications will have generated files
injected. These files helps with Data Engine connection and communication. The
system signal fieldbusAccess_CANopenError_CAN#
receives CANopen stack specific
errors.
For a description of received error codes, please see CANopen Error description
CANopen error example¶
For a table showing received errors, use canopenStatusModel
and add
following to main.qml:
ListView {
id: listView
anchors {
left: parent.left
right: parent.right
top: parent.top
margins: 10
}
width: view.width - exitButton.width
height: view.height / 1.5
model: canopenStatusModel
delegate: Rectangle {
id: listDelegate
implicitWidth: listView.width - exitButton.width
implicitHeight: 30
color: "#000"
border {
width: 1
color: "#ccc"
}
Row {
anchors.fill: parent
anchors.leftMargin: 10
spacing: 5
Text {
anchors.verticalCenter: parent.verticalCenter
color: "#fff"
text: bus
}
Text {
anchors.verticalCenter: parent.verticalCenter
color: "#fff"
text: type
}
Text {
anchors.verticalCenter: parent.verticalCenter
color: "#fff"
text: message
}
Text {
anchors.verticalCenter: parent.verticalCenter
color: "#fff"
text: received
}
}
}
}
Output:
CAN-bus | Level | Description | Received |
---|---|---|---|
0 | Error | Successful | 2021-03-18T14:54:20.549 |
0 | Status | Pre-operational | 2021-03-18T14:54:20.549 |
CANopen status¶
The system signal fieldbusAccess_CANopenStatus_CAN#
receives stack state
specific information from the Network Management (NMT).
State | Code (hex) |
---|---|
Initialisation | 0x00 |
Pre-Operational | 0x04 |
Operational | 0x05 |
Stopped | 0x7F |
CANopen status example¶
To show information about received status, add following to main.qml.
Text {
anchors.right: parent.right
anchors.bottom: parent.bottom
color: "#C00"
font.pixelSize: 32;
text: (dataEngine.fieldbusAccess_CANopenStatus_CAN0.value === FieldbusAccessCANopenStatusModel.NodeStateInitialisation) ? "Initialisation" :
(dataEngine.fieldbusAccess_CANopenStatus_CAN0.value === FieldbusAccessCANopenStatusModel.NodeStateStopped) ? "Stopped" :
(dataEngine.fieldbusAccess_CANopenStatus_CAN0.value === FieldbusAccessCANopenStatusModel.NodeStateOperational) ? "Operational" :
(dataEngine.fieldbusAccess_CANopenStatus_CAN0.value === FieldbusAccessCANopenStatusModel.NodeStatePreOperational) ? "Pre Operational" : "N/A";
}
Output:
Description |
---|
Pre Operational |