-
Notifications
You must be signed in to change notification settings - Fork 633
can.viewer hangs when encountering CANFD data frames #1400
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
Comments
Have you tried the develop branch? The can.viewer works fine with CAN FD and long messages, i just tested it. |
@o92 To install the develop branch, you can use |
@j-c-cook @zariiii9003 First of all, thank you very much for your response. I got myself the dev branch installed and tried out. However, when I execute the script with > python -m can.viewer -c 1 -i vector, I can see the messages but they are truncated. The DLC indication is correct. Note that, I did NOT have to supply --fd flag. If I did that, I couldn't see the messages that I was sending with DLC> 8. https://user-images.githubusercontent.com/8834529/193082331-c0920d00-b3dc-4b1a-afb1-71757de3c251.png And when I try to print msg.data field on console, I get as follows: |
Can you run this? import curses
import random
import threading
import time
import can
from can.interfaces.vector import VectorBus
from can.viewer import CanViewer
def send_fd_messages(bus: VectorBus) -> None:
while True:
length = random.randint(1, 64)
data = random.randbytes(length)
msg = can.Message(
arbitration_id=length,
data=bytearray(data),
is_fd=True,
is_rx=False,
bitrate_switch=True,
dlc=length,
)
bus.send(msg)
time.sleep(0.1)
if __name__ == '__main__':
bus = VectorBus(
serial=100, # the serial number of your virtual bus. Can be 0 or 100
channel=0,
fd=True,
bitrate=500_000,
data_bitrate=1_000_000,
receive_own_messages=True,
)
send_thread = threading.Thread(target=send_fd_messages, args=(bus,), daemon=True)
send_thread.start()
curses.wrapper(CanViewer, bus, None) |
Just an update: I can now see the CAN FD messages from the ECU, but I cannot see the messages that I sent out. The script is as follows:
|
Also, the moment I initialize Kvaser device in code, it throws the following error.
TracebackTraceback (most recent call last): Kvaser Device guide |
Hello, Thank you both @j-c-cook @zariiii9003 for your help. I have managed to found out that the Kvaser VCI device that I have, only supports CAN and not CAN FD. As for the Vector device, our ECU has some special set up that only can communicate with specific peripheral devices. When I connected such a peripheral unit, I could read and send CAN FD messages directly on the CAN bus. And it works with both the older version of can.viewer as well as the dev branch. I will close this case as it has been resolved for me. |
Thank you for the update and closing your issue now that it's resolved. Glad to know the |
That doesn't sound plausible to me. I assume that you set your bit timings correctly. python-can/can/interfaces/vector/canlib.py Line 399 in 89c395f
canfd_conf = xlclass.XLcanFdConf()
canfd_conf.options = xldefine.XL_CANFD_ConfigOptions.CANFD_CONFOPT_NO_ISO.value |
Description
can.viewer stops displaying incoming messages and the screen hangs upon encountering CAN messages that are sent using flexible data rate mode.
Expected behavior
The expected behavior should be that the can viewer must not crash or hang. It should display the CAN message even if DLC > 8
Additional context
OS and version: Windows 10 Enterprise
Python version: 3.8.10
python-can version: 4.0.0
python-can interface/s (if applicable): Vector VN1630A
While running can.viewer on one instance by executing as follows:
I try to pump in some arbitrary messages using parameters for flexible data rate. The following is my simple script for replication.
The can.viewer hangs upon receiving a frame whose DLC > 8.
The text was updated successfully, but these errors were encountered: