-
-
Notifications
You must be signed in to change notification settings - Fork 110
Fix bitrate calculation for PCAN interfaces #367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bitrate calculation for PCAN interfaces #367
Conversation
54b9783 to
d5eb647
Compare
Could be caused by long wiring, or large uncompensated transceiver delays, if we're talking about CAN FD. This might or might not be relevant: https://forum.opencyphal.org/t/on-can-bus-topology-and-termination/1685 EDIT: Sorry I cited an old document here; disregard that. I can only say that CiA 1301 recommends 80% for the arbitration phase, and for the data phase the value depends on the bitrate, going toward lower values with higher bit rates. Here's a relevant chart from Holger Zeltwanger's presentation, although it's not CANopen-specific:
|
pavel-kirienko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please bump the patch version in __version__.py
Set the BRS bit for pythoncan transports when the interface operates in CAN FD mode. Fixes OpenCyphal#368
|
@pavel-kirienko, is there anything that prevents this PR from being merged? |
|
@Finwood I don't think so. A CI has failed for a non-code-related reason so I restarted it; I am going to enable auto-merge now. In the future it is best to request a new review explicitly so that I know when it's ready. |

The existing PCAN interface implementation disregarded the configured bitrate preferences, and used static magic-numbers instead. This PR changes the timing calculation by utilizing
can.BitTimingFd.from_sample_point(), which leads to a cleaner implementation.I am unsure regarding the target sample point location: my setup works well with 87.5%, and does not work with 75%, but that might be an edge case (low clock precision). Does anyone have recommendations on sample point location?