add CAN bus error information to CAN state change error messages - #310
Merged
marckleinebudde merged 4 commits intoJun 30, 2026
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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