We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Cannot set bitrate for some Candlelight devices. I'm using MKS CANable V2.0 Pro board with Candlelight firmware.
Demonstrated here on an interactive session:
>>> import usb >>> import can >>> dev = usb.core.find(idVendor=0x1d50, idProduct=0x606f) >>> bus = can.Bus(interface='gs_usb', channel=dev.product, bus=dev.bus, address=dev.address, bitrate=1000000) >>> bus.gs_usb.set_bitrate(1000000) False
bus.gs_usb.set_bitrate(1000000) returns True.
bus.gs_usb.set_bitrate(1000000)
True
OS and version: Windows 10 Python version: 3.9.15 python-can version: main (@d40915ca) python-can interface/s (if applicable):
The board works perfectly fine in Linux / SocketCAN, bitrate can be set through ip link command as is usual with native SocketCAN devices.
ip link
The text was updated successfully, but these errors were encountered:
Checking deeper, looks like the culprit is this: https://github.com/jxltom/gs_usb/blob/master/gs_usb/gs_usb.py#L79
The gs_usb module only implements bit timing conversion for 48 MHz and 80 MHz clocks, while my board apparently runs at 170 MHz.
>>> import usb >>> import can >>> dev = usb.core.find(idVendor=0x1d50, idProduct=0x606f) >>> bus = can.Bus(interface='gs_usb', channel=dev.product, bus=dev.bus, address=dev.address, bitrate=1000000) >>> bus.gs_usb.device_capability.fclk_can 170000000
I think instead of relying on this conversion, we can use the python-can's BitTiming. I'll write some quick fix and send a pull request.
BitTiming
Sorry, something went wrong.
fixed in #1748
No branches or pull requests
Describe the bug
Cannot set bitrate for some Candlelight devices. I'm using MKS CANable V2.0 Pro board with Candlelight firmware.
To Reproduce
Demonstrated here on an interactive session:
Expected behavior
bus.gs_usb.set_bitrate(1000000)
returnsTrue
.Additional context
OS and version: Windows 10
Python version: 3.9.15
python-can version: main (@d40915ca)
python-can interface/s (if applicable):
The board works perfectly fine in Linux / SocketCAN, bitrate can be set through
ip link
command as is usual with native SocketCAN devices.Traceback and logs
The text was updated successfully, but these errors were encountered: