add FD support to slcan according to CANable 2.0 impementation#1920
add FD support to slcan according to CANable 2.0 impementation#1920zariiii9003 merged 9 commits intohardbyte:mainfrom
Conversation
|
fixed the black and ruff failings. |
|
Hi Bro, I have modify the code as your commit, send message is ok, but seems can not received message (windows platform), do you have this issue? |
|
Hello, Thank you for submitting this pull request. However, I noticed an issue regarding compatibility with classical devices that do not support CAN FD. When using your branch, the initialization fails with the following exception: In my opinion, the initialization should still work to support classical slcan devices. By the way, I tested the CAN FD capability with a 500k/2Mbps bus. Thank you. |
I agree my changes should not have that effect. I will update and check that useage. |
I send and receive without issue. I have found that ListenOnly mode doesn't work properly. I believe it is a canable firmware issue. |
|
Apologies for the delays. That fix is in to allow non-FD rates again and I believe this to be ready to merge. |
I confirmed that my issue has been resolved. Thank you for the update. |
can/interfaces/slcan.py
Outdated
| super().__init__(channel, **kwargs) | ||
|
|
||
| def set_bitrate(self, bitrate: int) -> None: | ||
| def set_bitrate(self, bitrate: int, dbitrate: int = 0) -> None: |
There was a problem hiding this comment.
I'd prefer data_bitrate over dbitrate for consistency with other interfaces. The default value should be None, not zero.
|
Overall this looks fine except for a lack of tests. |
|
I added some tests and they made it clear to me I had an error in the DLC handling in the initial implementation. That's resolved and I hope this makes the PR a bit more compelling. Let me know if there's anything else needed. Thanks! |
Looking at the original CANable firmware source it just silently fails. I'm not sure about other HW devices that use slcan. |
|
ok, I think this one is ready (finally)! |
zariiii9003
left a comment
There was a problem hiding this comment.
Looks okay to me. I hope you'll be available to fix potential issues 😄
|
Happy to help out. Tag me in any issues that look related. Thanks! |
The canable 2.0 project has extended the slcan interface to add support for CAN-FD frames and bitrate switching (see https://github.com/normaldotcom/canable2-fw). I needed this support for my work so I've implemented it in the library. If this work is useable I'd love to have it merged in. Happy to make tweaks or whatever, just need some direction.
Thank you for maintaining this project. It's immensely useful.