Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can Bus does not transmit (writeFrame)
Forum Updated to NodeBB v4.3 + New Features

Can Bus does not transmit (writeFrame)

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 749 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.
  • N Offline
    N Offline
    NoobyLost
    wrote on 30 Mar 2024, 17:29 last edited by
    #1

    I'm using Qt 6.6 + QSerialBus plugin , with a USB Peak PCAN adapter. Qt sees the plugin (outputs "Using PCAN-API version: 4.8.0.030"), and setting the bitrate works.

    However, writeFrame doesn't do anything.. I don't see any activity using a scope, nor does the receiving PC's PCAN-View show any data.

    If I open PCAN-View (on the Qt computer) after executing the line 'device->connectDevice()' , it says another application [Qt] has configured the device.

    The only anomalies I can see is that it says "<optimized out> on one line for some reason. Also whenever I stop the debugger, popups appear saying: "Could not connect to the in-process QML Debugger".

    I verified the hardware is good, by using PCAN-View on both computers and I can send messages back and forth.

    Untitled.png

    C 1 Reply Last reply 30 Mar 2024, 19:13
    0
    • N NoobyLost
      30 Mar 2024, 17:29

      I'm using Qt 6.6 + QSerialBus plugin , with a USB Peak PCAN adapter. Qt sees the plugin (outputs "Using PCAN-API version: 4.8.0.030"), and setting the bitrate works.

      However, writeFrame doesn't do anything.. I don't see any activity using a scope, nor does the receiving PC's PCAN-View show any data.

      If I open PCAN-View (on the Qt computer) after executing the line 'device->connectDevice()' , it says another application [Qt] has configured the device.

      The only anomalies I can see is that it says "<optimized out> on one line for some reason. Also whenever I stop the debugger, popups appear saying: "Could not connect to the in-process QML Debugger".

      I verified the hardware is good, by using PCAN-View on both computers and I can send messages back and forth.

      Untitled.png

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 30 Mar 2024, 19:13 last edited by Christian Ehrlicher
      #2

      @NoobyLost Check the return values of the QCanBusDevice functions and do proper error handling to find out what's going wrong.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      N 1 Reply Last reply 30 Mar 2024, 19:55
      0
      • C Christian Ehrlicher
        30 Mar 2024, 19:13

        @NoobyLost Check the return values of the QCanBusDevice functions and do proper error handling to find out what's going wrong.

        N Offline
        N Offline
        NoobyLost
        wrote on 30 Mar 2024, 19:55 last edited by
        #3

        @Christian-Ehrlicher The writeFrame/connectDevice functions don't have a return.. and errorString is empty.

        J C 2 Replies Last reply 30 Mar 2024, 20:36
        0
        • N NoobyLost
          30 Mar 2024, 19:55

          @Christian-Ehrlicher The writeFrame/connectDevice functions don't have a return.. and errorString is empty.

          J Offline
          J Offline
          JonB
          wrote on 30 Mar 2024, 20:36 last edited by JonB
          #4

          @NoobyLost
          Without knowing anything about QCanBusDevice I can see void QCanBusDevice::errorOccurred(QCanBusDevice::CanBusError) signal?

          1 Reply Last reply
          1
          • N NoobyLost
            30 Mar 2024, 19:55

            @Christian-Ehrlicher The writeFrame/connectDevice functions don't have a return.. and errorString is empty.

            C Offline
            C Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 30 Mar 2024, 20:43 last edited by Christian Ehrlicher
            #5

            @NoobyLost said in Can Bus does not transmit (writeFrame):

            @Christian-Ehrlicher The writeFrame/connectDevice functions don't have a return..

            The have: https://doc.qt.io/qt-6/qcanbusdevice.html#connectDevice

            I also doubt you can directly read afterwards. Use framesReceived signal.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            N 1 Reply Last reply 30 Mar 2024, 23:47
            3
            • C Christian Ehrlicher
              30 Mar 2024, 20:43

              @NoobyLost said in Can Bus does not transmit (writeFrame):

              @Christian-Ehrlicher The writeFrame/connectDevice functions don't have a return..

              The have: https://doc.qt.io/qt-6/qcanbusdevice.html#connectDevice

              I also doubt you can directly read afterwards. Use framesReceived signal.

              N Offline
              N Offline
              NoobyLost
              wrote on 30 Mar 2024, 23:47 last edited by
              #6

              @Christian-Ehrlicher Sorry, you're right.. it returns True (success).

              Also, just as a check, if I don't plug in the USB PCAN, it returns False.. and the Application Output is
              "Cannot initialize hardware: The value of a handle (PCAN-Channel, PCAN-Hardware, PCAN-Net, PCAN-Client)
              is invalid"

              C A 2 Replies Last reply 31 Mar 2024, 13:00
              0
              • N NoobyLost
                30 Mar 2024, 23:47

                @Christian-Ehrlicher Sorry, you're right.. it returns True (success).

                Also, just as a check, if I don't plug in the USB PCAN, it returns False.. and the Application Output is
                "Cannot initialize hardware: The value of a handle (PCAN-Channel, PCAN-Hardware, PCAN-Net, PCAN-Client)
                is invalid"

                C Offline
                C Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on 31 Mar 2024, 13:00 last edited by
                #7

                @NoobyLost So did you connect the frameReceived() message and do you send to message to yourself?

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                1 Reply Last reply
                1
                • N NoobyLost
                  30 Mar 2024, 23:47

                  @Christian-Ehrlicher Sorry, you're right.. it returns True (success).

                  Also, just as a check, if I don't plug in the USB PCAN, it returns False.. and the Application Output is
                  "Cannot initialize hardware: The value of a handle (PCAN-Channel, PCAN-Hardware, PCAN-Net, PCAN-Client)
                  is invalid"

                  A Offline
                  A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote on 2 Apr 2024, 16:47 last edited by
                  #8

                  Hi @NoobyLost,

                  have you already tried the CAN Manager example?

                  I've used it with a PCAN-USB-Pro FD, one channel connected to PCAN-View and the other to the example and could receive and trasnsmit frames between both channels.

                  My PCAN-API version is 4.5.4.508, Qt version 6.6.3, MinGW 11.2.0 x64.

                  Qt has to stay free or it will die.

                  A 1 Reply Last reply 5 Apr 2024, 09:56
                  0
                  • A aha_1980
                    2 Apr 2024, 16:47

                    Hi @NoobyLost,

                    have you already tried the CAN Manager example?

                    I've used it with a PCAN-USB-Pro FD, one channel connected to PCAN-View and the other to the example and could receive and trasnsmit frames between both channels.

                    My PCAN-API version is 4.5.4.508, Qt version 6.6.3, MinGW 11.2.0 x64.

                    A Offline
                    A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on 5 Apr 2024, 09:56 last edited by
                    #9

                    And I've now tried the Qt 6.7 CAN Manager example with PCAN-Basic 4.8.2.897. Sending and receiving works like a charm.

                    @NoobyLost Do you have an event loop running?

                    Qt has to stay free or it will die.

                    1 Reply Last reply
                    0

                    1/9

                    30 Mar 2024, 17:29

                    • Login

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