Qt CAN Bus (vectorcan) with Vector VN1640A only receives data when CANoe is running
-
wrote 21 days ago last edited by
Hi everyone,
I'm encountering a strange issue using Qt's CAN Bus framework with a Vector VN1640A interface and the vectorcan plugin. My Qt application can only receive CAN frames when Vector CANoe is running simultaneously. When my Qt application runs standalone, it connects successfully but receives no data.
My Setup:
Hardware: Vector VN1640A
Vector Driver/Firmware: Version 10.9.12
Qt Version: [Qt 6.7]
Operating System: [Windows 10]
Qt Plugin: vectorcanThe Problem:
When Vector CANoe is not running:
My Qt application successfully finds the CAN interface using QCanBus::instance()->availableDevices("vectorcan").
QCanBus::instance()->createDevice(...) successfully creates the QCanBusDevice object.
m_pluginDevice->connectDevice() returns true.
The device state changes to QCanBusDevice::ConnectedState.
m_pluginDevice->error() reports QCanBusDevice::NoError.
However, calling m_pluginDevice->readAllFrames() periodically always returns an empty list. No CAN frames are received.When Vector CANoe is running (and configured to use the same hardware channel):
My Qt application connects successfully (same steps as above).
Crucially, m_pluginDevice->readAllFrames() now successfully receives CAN frames.
Troubleshooting Done & Observations:I have checked the Vector Hardware Configuration tool. It shows the relevant channel (Channel 1) status as "EricMotorApp; Init, Activated", indicating the driver believes the channel is active and associated with my intended application context ("EricMotorApp").
My code uses a QTimer to periodically call a function that invokes m_pluginDevice->readAllFrames() and processes the results. This works fine when CANoe is running.
Standard frame sending (writeFrame) from Qt might work (needs confirmation), but receiving is the primary issue.My Questions & Hypothesis:
It seems my standalone Qt application, despite successfully connecting according to the Qt CAN Bus API, is missing a step or requirement that CANoe fulfills.My main hypothesis revolves around the Application Name ("AppName") association. The hardware channel is configured for "EricMotorApp".
Does the vectorcan plugin correctly associate itself with the "AppName" specified in the Vector Hardware Configuration? If not, could this prevent it from accessing the receive queue even if the channel shows as "Activated"?
Is there a standard QCanBusDevice::ConfigurationKey or a specific method/parameter for the vectorcan plugin to explicitly set the "AppName" (e.g., "EricMotorApp") when connecting? I couldn't find one in the standard documentation.
Are there any known quirks or required additional configuration steps for the VN1640A with the vectorcan plugin (beyond setting bitrate) that might only be correctly performed when CANoe is active? Could it be related to buffer initialization, access rights (shared/exclusive), or specific driver modes?
Has anyone encountered a similar dependency on CANoe when using Qt CAN Bus with Vector hardware? Any insights or suggestions on how to make the Qt application receive data standalone would be greatly appreciated.Thanks in advance!
-
Hi @eric_1994,
please try the CAN bus example first. You can download it from the Qt servers (link at the bottom of the page) or use the preinstalled examples.
Regards
-
Hi @eric_1994,
please try the CAN bus example first. You can download it from the Qt servers (link at the bottom of the page) or use the preinstalled examples.
Regards
wrote 20 days ago last edited by@aha_1980 Hi, I tried to use CAN Bus Manager, and the test results are consistent with the app I wrote. It is necessary to connect to CANOE to receive CAN data frames normally. During the test, can0 is connected to CAN Bus Manager, and can1 is connected to CANOE
-
Interesting. From you first screenshot it looks like the app receives something, but the CAN-ID and data is "empty".
But can you please clarify your hardware setup a bit more? Especially the case when you only run the CAN-Example app. Which other CAN node is on the bus then?
-
Interesting. From you first screenshot it looks like the app receives something, but the CAN-ID and data is "empty".
But can you please clarify your hardware setup a bit more? Especially the case when you only run the CAN-Example app. Which other CAN node is on the bus then?
-
Hi @eric_1994
- It's interesting that you say the Kvaser device is working. Which CAN plugin do you use for that?
- Regarding your Vector problem: Is there anything you can do from the Vector API side (like creating a log of API calls) or do you think you could debug the Qt plugin?
One question that is still unanswered: Can you send from the Qt CAN Example?
1/6