Skip to content

add CAN bus error information to CAN state change error messages - #310

Merged
marckleinebudde merged 4 commits into
candle-usb:masterfrom
marckleinebudde:add-CAN-bus-error-information
Jun 30, 2026
Merged

add CAN bus error information to CAN state change error messages#310
marckleinebudde merged 4 commits into
candle-usb:masterfrom
marckleinebudde:add-CAN-bus-error-information

Conversation

@marckleinebudde

Copy link
Copy Markdown
Collaborator

With commit 4cf2b41 ("Merge pull request #303 from marckleinebudde/can-error-handling") the firmware implements CAN bus error reporting (GS_CAN_FEATURE_BERR_REPORTING).

With that series CAN state change error messages and CAN bus error messages (which are disabled by default) are send separately.

This means CAN state change messages never contain any information about the CAN bus error, even if there is one. In #308 @Elmue pointed out that this might break existing applications.

To avoid this breakage, always augment all CAN state change error messages with CAN bus error information, even if CAN bus error reporting is not enabled.

Closes: #308

Fixes: ba0fb8c ("can_common: CAN_HandleError(): read status register once and pass it to called functions")
…ndling functions

No functional change intended.
… counters are both 0

With automatically bus off recovery enabled, the controller will go into
error active automatically. Both RX and TX error counters might show `0`,
while the `LEC` still shows a bus error.

To avoid inconsistent error messages (both error counters equal `0` but a
controller problem) like this:

```
 (2026-06-30 18:53:23.864243)  can0  RX - -  2000028C   {8}  00 40 08 00 00 00 00 00   ERRORFRAME
        controller-problem{back-to-error-active}
        protocol-violation{{tx-dominant-bit-error}{}}
        bus-error
        error-counter-tx-rx{{0}{0}}
```

... do not send bus error messages with error counters equal `0`.
…to CAN state change error messages

With commit 4cf2b41 ("Merge pull request candle-usb#303 from
marckleinebudde/can-error-handling") the firmware implements CAN bus error
reporting (`GS_CAN_FEATURE_BERR_REPORTING`).

With that series CAN state change error messages and CAN bus error
messages (which are disabled by default) are send separately.

This means CAN state change messages never contain any information about
the CAN bus error, even if there is one. In
candle-usb#308 @Elmue pointed out
that this might break existing applications.

To avoid this breakage, always augment all CAN state change error messages
with CAN bus error information, even if CAN bus error reporting is not
enabled.

Closes: candle-usb#308
@marckleinebudde
marckleinebudde merged commit 7519ad0 into candle-usb:master Jun 30, 2026
48 checks passed
@marckleinebudde
marckleinebudde deleted the add-CAN-bus-error-information branch June 30, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for flag GS_CAN_FEATURE_BERR_REPORTING breaks all CAN software

1 participant