Skip to content

Conversation

@lesti
Copy link

@lesti lesti commented Jan 23, 2026

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

  • Bug fix
  • New feature
  • Documentation update
  • Refactoring
  • Other (please describe):

Checklist

  • I have followed the contribution guide.
  • I have added or updated tests as appropriate.
  • I have added or updated documentation as appropriate.
  • I have added a news fragment for towncrier.
  • All checks and tests pass (tox).

Additional Notes

* 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
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.

1 participant