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 758 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 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

    Christian EhrlicherC 1 Reply Last reply
    0
    • N NoobyLost

      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

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 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
      0
      • Christian EhrlicherC Christian Ehrlicher

        @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 last edited by
        #3

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

        JonBJ Christian EhrlicherC 2 Replies Last reply
        0
        • N NoobyLost

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

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on 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

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

            Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 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
            3
            • Christian EhrlicherC Christian Ehrlicher

              @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 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"

              Christian EhrlicherC aha_1980A 2 Replies Last reply
              0
              • N NoobyLost

                @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"

                Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on 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

                  @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"

                  aha_1980A Offline
                  aha_1980A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote on 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.

                  aha_1980A 1 Reply Last reply
                  0
                  • aha_1980A aha_1980

                    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.

                    aha_1980A Offline
                    aha_1980A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on 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

                    • Login

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