Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Qt CAN Bus (vectorcan) with Vector VN1640A only receives data when CANoe is running

Qt CAN Bus (vectorcan) with Vector VN1640A only receives data when CANoe is running

Scheduled Pinned Locked Moved Unsolved Qt 6
6 Posts 2 Posters 138 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eric_1994
    wrote 21 days ago last edited by
    #1

    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: vectorcan

    The 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!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      aha_1980
      Lifetime Qt Champion
      wrote 21 days ago last edited by
      #2

      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

      Qt has to stay free or it will die.

      E 1 Reply Last reply 20 days ago
      0
      • A aha_1980
        21 days ago

        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

        E Offline
        E Offline
        eric_1994
        wrote 20 days ago last edited by
        #3

        @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

        vector_can_conoe_off.png vector_can_conoe_on.png

        1 Reply Last reply
        0
        • A Offline
          A Offline
          aha_1980
          Lifetime Qt Champion
          wrote 20 days ago last edited by
          #4

          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?

          Qt has to stay free or it will die.

          E 1 Reply Last reply 20 days ago
          0
          • A aha_1980
            20 days ago

            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?

            E Offline
            E Offline
            eric_1994
            wrote 20 days ago last edited by
            #5

            @aha_1980
            I also connected a kvaser device (which works fine in the CAN-Example app) and an ECU that sends a message with id 0x52 every 5ms.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              aha_1980
              Lifetime Qt Champion
              wrote 19 days ago last edited by
              #6

              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?

              Qt has to stay free or it will die.

              1 Reply Last reply
              0

              1/6

              27 Apr 2025, 09:00

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved