IXXAT: improve handling of controller errors #2023
Open
+29
−13
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