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. Using PeakCAN Backend
Forum Update on Monday, May 27th 2025

Using PeakCAN Backend

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 4 Posters 4.7k 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.
  • B Offline
    B Offline
    Bremenpl
    wrote on last edited by
    #1

    Hello there,
    I have noticed that in QT 5.6 support for PCAN has been added. So I headed to http://doc.qt.io/qt-5/qtserialbus-peakcan-overview.html and tried to make an example program. I have noticed that there is a mistake in the instructions in line:

    QCanBusDevice *device = QCanBus::createDevice("peakcan", QStringLiteral("usbbus1"));
    

    One forgot to call singleton through instance():

    QCanBusDevice *device = QCanBus::instance()->createDevice("peakcan", QStringLiteral("usbbus1"));
    

    Right after I noticed that it says that only USB PCAN interfaces are supported and I have a mini-pcie PCAN adapter. Hoped for a miracle I typed in "pcibus1" but was not able to connect. Could you please tell me either there are plans for adding pci backend? Also, is the api fully functional for now if I had the USB PCAN adapter? I would really apreciate all help regarding this matter.

    lprzenioslo.zut.edu.pl

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kuzulis
      Qt Champions 2020
      wrote on last edited by
      #2

      As far I know, this were added for next 5.6.1 reelase: https://codereview.qt-project.org/#/c/155604/

      1 Reply Last reply
      2
      • B Offline
        B Offline
        Bremenpl
        wrote on last edited by
        #3

        Thank you for info. Any idea when is release going to go out?

        lprzenioslo.zut.edu.pl

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kuzulis
          Qt Champions 2020
          wrote on last edited by
          #4

          I don't know when... but you can download the qtserialbus module and rebuild it and install via QtCreator.. Just open a project file, rebuild and then do: 'make install'.

          B 1 Reply Last reply
          1
          • K kuzulis

            I don't know when... but you can download the qtserialbus module and rebuild it and install via QtCreator.. Just open a project file, rebuild and then do: 'make install'.

            B Offline
            B Offline
            Bremenpl
            wrote on last edited by Bremenpl
            #5

            @kuzulis So All I have to do it clone the qtserialbus repo and build the qt project that is there? Dont I need to put the compiled output inside the qt dir? Is there any instructions for doing this? I would appreciate help.
            Also I am not sure I have make under windows.

            lprzenioslo.zut.edu.pl

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kuzulis
              Qt Champions 2020
              wrote on last edited by kuzulis
              #6
              1. git clone git://code.qt.io/qt/qtserialbus.git
              2. cd qtserialbus
              3. git checkout 5.6
              4. cd ..
              5. mkdir qtserialbus-build
              6. cd qtserialbus-build
              7. qmake ../qtserialbus/qtserialbus.pro
              8. make
              9. make install
              

              If you want to use QtCreator (that is preffered, because it sets desired Qt automatically from your Kit), then:

              1. instead of p. 4...8 just open the qtserialbus/qtserialbus.pro file with the desired Kit
              2. instead of p.9 just write to the empty project's make step field: install (to Projects -> Build Settings -> Build Steps -> Make -> Make Arguments)
              3. try to rebuild the project... it will compile and install a module to the desired Qt-instance automatically.
              B 2 Replies Last reply
              2
              • K kuzulis
                1. git clone git://code.qt.io/qt/qtserialbus.git
                2. cd qtserialbus
                3. git checkout 5.6
                4. cd ..
                5. mkdir qtserialbus-build
                6. cd qtserialbus-build
                7. qmake ../qtserialbus/qtserialbus.pro
                8. make
                9. make install
                

                If you want to use QtCreator (that is preffered, because it sets desired Qt automatically from your Kit), then:

                1. instead of p. 4...8 just open the qtserialbus/qtserialbus.pro file with the desired Kit
                2. instead of p.9 just write to the empty project's make step field: install (to Projects -> Build Settings -> Build Steps -> Make -> Make Arguments)
                3. try to rebuild the project... it will compile and install a module to the desired Qt-instance automatically.
                B Offline
                B Offline
                Bremenpl
                wrote on last edited by
                #7

                @kuzulis Thank you for the extended explanation, I will try this first thing in the morning and let you know.

                lprzenioslo.zut.edu.pl

                1 Reply Last reply
                0
                • K kuzulis
                  1. git clone git://code.qt.io/qt/qtserialbus.git
                  2. cd qtserialbus
                  3. git checkout 5.6
                  4. cd ..
                  5. mkdir qtserialbus-build
                  6. cd qtserialbus-build
                  7. qmake ../qtserialbus/qtserialbus.pro
                  8. make
                  9. make install
                  

                  If you want to use QtCreator (that is preffered, because it sets desired Qt automatically from your Kit), then:

                  1. instead of p. 4...8 just open the qtserialbus/qtserialbus.pro file with the desired Kit
                  2. instead of p.9 just write to the empty project's make step field: install (to Projects -> Build Settings -> Build Steps -> Make -> Make Arguments)
                  3. try to rebuild the project... it will compile and install a module to the desired Qt-instance automatically.
                  B Offline
                  B Offline
                  Bremenpl
                  wrote on last edited by
                  #8

                  @kuzulis Hi,
                  When I am trying to build with Qt Creator, I get following error:

                  :-1: error: Failed to run: perl -w B:\Qt\Qt5.6.0\5.6\mingw49_32\bin\syncqt.pl -module QtSerialBus -version 5.6.1 -outdir K:/build-qtserialbus-Desktop_Qt_5_6_0_MinGW_32bit-Debug K:/qtserialbus
                  

                  When I try to do it manually, I get another one:

                  Microsoft Windows [Wersja 6.1.7601]
                  Copyright (c) 2009 Microsoft Corporation. Wszelkie prawa zastrzeżone.
                  
                  K:\>git clone git://code.qt.io/qt/qtserialbus.git
                  Cloning into 'qtserialbus'...
                  remote: Counting objects: 6106, done.
                  remote: Compressing objects: 100% (2892/2892), done.
                  remote: Total 6106 (delta 3962), reused 4880 (delta 3186)
                  Receiving objects: 100% (6106/6106), 1.18 MiB | 684.00 KiB/s, done.
                  Resolving deltas: 100% (3962/3962), done.
                  Checking connectivity... done.
                  
                  K:\>cd qtserialbus
                  
                  K:\qtserialbus>git checkout 5.6
                  Branch 5.6 set up to track remote branch 5.6 from origin.
                  Switched to a new branch '5.6'
                  
                  K:\qtserialbus>cd ..
                  
                  K:\>mkdir qtserialbus-build
                  
                  K:\>cd qtserialbus
                  
                  K:\qtserialbus>cd ..
                  
                  K:\>cd qtserialbus-build
                  
                  K:\qtserialbus-build>qmake ../qtserialbus/qtserialbus.pro
                  Info: creating cache file K:\qtserialbus-build\.qmake.cache
                  Checking for language... no
                  Checking for socketcan... no
                  Checking for socketcan_fd... no
                  Project WARNING: Cannot compile the module with your compiler, missing C++11 language features.
                  
                  K:\qtserialbus-build>
                  

                  And I used it already to compile c++11 code. Do yoy know what could be the case?

                  lprzenioslo.zut.edu.pl

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    Bremenpl
                    wrote on last edited by Bremenpl
                    #9

                    Okay I simply installed perl and made the install through qt creator. The problem is that when I try to run this line:

                    QCanBusDevice *device = QCanBus::instance()->createDevice("peakcan", QStringLiteral("pcibus1"));
                    

                    I get a message in the console:

                    Failed to load the library: pcanbasic
                    The PCAN runtime library is not found
                    

                    Do I need to place the libs/dll's in any special places or does the qtserialbus should have it already?

                    EDIT: For some reason the qt application didnt want to pick up the DLL from System32. I placed the PCANBasic api dll next to the executable and it work now. Ill figure this out later. Thank you very much for your time.

                    lprzenioslo.zut.edu.pl

                    P3DR0P 1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      kuzulis
                      Qt Champions 2020
                      wrote on last edited by
                      #10

                      Do I need to place the libs/dll's in any special places or does the qtserialbus should have it already?

                      It is enough to add this library in same directory with the application executable... it is wrong to copy it to system32...

                      1 Reply Last reply
                      0
                      • B Bremenpl

                        Okay I simply installed perl and made the install through qt creator. The problem is that when I try to run this line:

                        QCanBusDevice *device = QCanBus::instance()->createDevice("peakcan", QStringLiteral("pcibus1"));
                        

                        I get a message in the console:

                        Failed to load the library: pcanbasic
                        The PCAN runtime library is not found
                        

                        Do I need to place the libs/dll's in any special places or does the qtserialbus should have it already?

                        EDIT: For some reason the qt application didnt want to pick up the DLL from System32. I placed the PCANBasic api dll next to the executable and it work now. Ill figure this out later. Thank you very much for your time.

                        P3DR0P Offline
                        P3DR0P Offline
                        P3DR0
                        wrote on last edited by
                        #11

                        @Bremenpl have you been able to get PCAN working with QT example? I loaded the dll in the same folder as the executable as you did and when I am debugging I get a connection error and it shows to be "The transmit buffer in CAN controller is full"

                        InsurgI 1 Reply Last reply
                        0
                        • P3DR0P P3DR0

                          @Bremenpl have you been able to get PCAN working with QT example? I loaded the dll in the same folder as the executable as you did and when I am debugging I get a connection error and it shows to be "The transmit buffer in CAN controller is full"

                          InsurgI Offline
                          InsurgI Offline
                          Insurg
                          wrote on last edited by
                          #12

                          @P3DR0 said:

                          @Bremenpl have you been able to get PCAN working with QT example? I loaded the dll in the same folder as the executable as you did and when I am debugging I get a connection error and it shows to be "The transmit buffer in CAN controller is full"

                          same issue

                          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