IXXAT: improve handling of controller errors#2023
Open
lesti wants to merge 1 commit intohardbyte:mainfrom
Open
IXXAT: improve handling of controller errors#2023lesti wants to merge 1 commit intohardbyte:mainfrom
lesti wants to merge 1 commit intohardbyte:mainfrom
Conversation
78f1a42 to
b185330
Compare
* move errors indicated by CANLINESTATUS into own exceptions * raise data overrun exception based on error frame instead of CANLINESTATUS because the CAN_STATUS_OVRRUN flag is only cleared on controller reset
b185330 to
3d3d59a
Compare
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.
Summary of Changes
I encountered an issue that came down to the current handling of the data overrun flag in the IXXAT recv function. When some other controller would write data with an invalid baudrate to the CAN bus, the IXXAT would generate so many error frames that would rather quickly cause the receive fifo to overrun.
In its current state this would cause python-can to raise a VCIError("Data overrun occurred") for every recv() call till the controller is reset. On other words: This exception raising is not stopping even if the wrong-baudrate-situation is over.
This is because the meaning of the CAN_STATUS_OVRRUN flag of the CANLINESTATUS struct is basically whether an overflow has ever occurred during the lifetime of the channel, so I think it should not be used for exception raising. My patch adapts the recv-function to raise the "Data overrun occurred" exception based on actual error frames instead of this status flag. This allows my application to ignore these errors till the baudrate on the bus has normalized and everything is working again.
Type of Change
Checklist
tox).Additional Notes