-
Notifications
You must be signed in to change notification settings - Fork 611
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
Add notes/kvaser support for non-iso support #1752
Conversation
Add unit test
Black to pass premerge checklist
Fixed the test that was failing the black formatting check. The unit test that was failing appears to be intermittent and unrelated to these changes |
doc/interfaces/kvaser.rst
Outdated
@@ -39,6 +39,11 @@ in the ``recv`` method. If a message does not match any of the filters, | |||
``recv()`` will return None. | |||
|
|||
|
|||
ISO/Non-ISO CAN FD Mode | |||
----------------------- |
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.
can/interfaces/kvaser/canlib.py
Outdated
@@ -415,6 +415,10 @@ def __init__( | |||
In this case, the bit will be sampled three quanta in a row, | |||
with the last sample being taken in the edge between TSEG1 and TSEG2. | |||
Three samples should only be used for relatively slow baudrates. | |||
:param bool fd_non_iso: |
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.
Move this closer to the fd parameter.
@@ -37,7 +37,14 @@ Here is an example configuration file for using `PCAN-USB <https://www.peak-syst | |||
``bitrate`` (default ``500000``) | |||
Channel bitrate | |||
|
|||
ISO/Non-ISO CAN FD Mode |
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.
The heading here also looks out of place. IMO the paragraph is not necessary.
@lumagi What do you think about adding |
Although it is very specific to this interface, I generally don't see any reasons against it. The enum already has multiple values so there's no real harm in one more. And it would certainly do away with the mess of book flags. |
What value would there be in tracking this in bus's protocol property? For all use cases I've seen ISO and Non-ISO CANFD should behave identically at the app layer - the only difference is some bits in the header change but that's at a layer below python-can. A bus can't mix/match frames between the two types and I don't see any interesting uses of protocol outside of the bus implementations. Ultimately you still need a kwarg for the Bus init, there's no way to guess if it's ISO or not from say bittimings or other flags. I agree that it's unfortunate that more drivers don't expose this in a way that python-can can exploit. I can update the docs per the recommendations later. |
New enum for non-iso mode Documentation sections fixes Test update
I made some updates per the suggestions. |
Black cleanup
Fixed the black issue -would be nice if that was in the default workflow but oh well. |
Some older devices in the wild use non-iso CAN FD (Bosch). Some hardware supports choosing the mode in the driver, others are configurable during install or with a separate application. Kvaser is in the canlib API. PCAN requires either socket-can driver or the Windows GUI. Socket-CAN is an initialization flag.
Add documentation and hooks for kvaser. Relatively unintrusive. It didn't fit nicely with the bit-timings concept as it's purely associated with CRC calculation and stuffing.