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 using Peak Can
QtWS25 Last Chance

Can bus using Peak Can

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 4 Posters 3.0k 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.
  • G Offline
    G Offline
    Giampietro
    wrote on 31 Aug 2018, 10:19 last edited by
    #1

    Hello, I need to use Pcan basic for comunicate on can bus.
    I download the pcan-basic.zip from peak site, but I don't know how use it in QT.

    I need to include pcan dll in the project (which files dll, lib, h should I use??)
    How include these files il a QT project ??

    I am using windows 10 and Qt 5.11.1 (MSVC 2015, 32 bit)

    Thankyou

    A 1 Reply Last reply 31 Aug 2018, 15:00
    0
    • C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 31 Aug 2018, 14:49 last edited by
      #2

      There is no difference using an external library in a Qt project or a plain C++ project. So I don't see a Qt problem here. Afaik the library brings some example on how to access it.

      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
      0
      • G Giampietro
        31 Aug 2018, 10:19

        Hello, I need to use Pcan basic for comunicate on can bus.
        I download the pcan-basic.zip from peak site, but I don't know how use it in QT.

        I need to include pcan dll in the project (which files dll, lib, h should I use??)
        How include these files il a QT project ??

        I am using windows 10 and Qt 5.11.1 (MSVC 2015, 32 bit)

        Thankyou

        A Offline
        A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on 31 Aug 2018, 15:00 last edited by
        #3

        Hi @Giampietro,

        have you already seen Qt CAN bus?

        The Peak plugin is described here. In short - you need the device drivers and the DLL to run your program.

        Regards.

        Qt has to stay free or it will die.

        1 Reply Last reply
        2
        • G Offline
          G Offline
          Giampietro
          wrote on 3 Sept 2018, 06:41 last edited by
          #4

          Hello all,
          I've already saw Qt CAN Bus
          And I create a widget project fon comunication on can bus.
          I imported the sample in the link pages :

          In the .pro file I used: QT += core gui widgets serialbus

          in the form cpp file I used :
          #include <QCanBus>

          and the code is :
          if (QCanBus::instance()->plugins().contains(QStringLiteral("peakcan"))) {
          // plugin available
          qDebug() << "plugin "peakcan" available ";
          }

          QString errorString;
          QCanBusDevice *device = QCanBus::instance()->createDevice(
              QStringLiteral("peakcan"), QStringLiteral("usb0"), &errorString);
          if (!device) {
              // Error handling goes here
              qDebug() << errorString;
          } else {
              device->connectDevice();
          }
          

          as illustrated into web page.
          When I run the project I find into ouput this :

          plugin "peakcan" available
          qt.canbus.plugins.peakcan: Cannot load library pcanbasic: Impossibile trovare il modulo specificato.
          "Cannot load library pcanbasic: Impossibile trovare il modulo specificato."

          I find the pcanbasic.dll in peak website (download pcan-basic.zip) but I don't understand which files .h include in project.
          there are header pcanbasic.h files for C#·, C++_Builder, C++_CLR, C++_MFC. which should I use??

          So, I understand that pcan basic is missing from the project: How import it with the relative .h ?

          I used also sample find here : CAN Bus example
          But I have the same answer in output : Cannot load library pcanbasic.

          How use pcanbasic.dll??

          Thankyou for help

          A 1 Reply Last reply 3 Sept 2018, 07:03
          0
          • G Giampietro
            3 Sept 2018, 06:41

            Hello all,
            I've already saw Qt CAN Bus
            And I create a widget project fon comunication on can bus.
            I imported the sample in the link pages :

            In the .pro file I used: QT += core gui widgets serialbus

            in the form cpp file I used :
            #include <QCanBus>

            and the code is :
            if (QCanBus::instance()->plugins().contains(QStringLiteral("peakcan"))) {
            // plugin available
            qDebug() << "plugin "peakcan" available ";
            }

            QString errorString;
            QCanBusDevice *device = QCanBus::instance()->createDevice(
                QStringLiteral("peakcan"), QStringLiteral("usb0"), &errorString);
            if (!device) {
                // Error handling goes here
                qDebug() << errorString;
            } else {
                device->connectDevice();
            }
            

            as illustrated into web page.
            When I run the project I find into ouput this :

            plugin "peakcan" available
            qt.canbus.plugins.peakcan: Cannot load library pcanbasic: Impossibile trovare il modulo specificato.
            "Cannot load library pcanbasic: Impossibile trovare il modulo specificato."

            I find the pcanbasic.dll in peak website (download pcan-basic.zip) but I don't understand which files .h include in project.
            there are header pcanbasic.h files for C#·, C++_Builder, C++_CLR, C++_MFC. which should I use??

            So, I understand that pcan basic is missing from the project: How import it with the relative .h ?

            I used also sample find here : CAN Bus example
            But I have the same answer in output : Cannot load library pcanbasic.

            How use pcanbasic.dll??

            Thankyou for help

            A Offline
            A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on 3 Sept 2018, 07:03 last edited by
            #5

            Hi @Giampietro,

            I'd suggest you to try with the CAN bus example first.

            • Have you installed the Peak device drivers? I.e. do you have the hardware successfully installed in device manager?
            • QtSerialBus loads the pcanbasic.dll at runtime. So either copy it to the same folder your executable resides, or make sure it is in a directory which is contained in the PATH environment variable.

            That should be all you need, no header files, no lib files etc.

            Regards

            Qt has to stay free or it will die.

            1 Reply Last reply
            0
            • G Offline
              G Offline
              Giampietro
              wrote on 3 Sept 2018, 09:20 last edited by
              #6

              Hello aha_1980,
              I find the solution :

              the problem was the wrong drivers:
              I used 4.1.4.247 version driver. With this, the problem is present.
              Now I use a 4.0.18.96 driver version (an older version), and the problem is solved.
              My test application and also CAN bus example works fine.

              Thnkyou all for help!.

              1 Reply Last reply
              1
              • A Offline
                A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on 3 Sept 2018, 09:25 last edited by
                #7

                Hi @Giampietro

                Glad you figured it out. So please mark this topic as SOLVED now. Thanks!

                Qt has to stay free or it will die.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  alpacino
                  wrote on 2 Mar 2021, 09:09 last edited by
                  #8

                  hi Giampietro
                  i have the same issue..
                  if i use the example of CAN Bus example in qt , do i need to add the dll to the app ? if the response is yes which files.h I should include and how I add the library ??
                  and thank u

                  A 1 Reply Last reply 2 Mar 2021, 19:28
                  0
                  • A alpacino
                    2 Mar 2021, 09:09

                    hi Giampietro
                    i have the same issue..
                    if i use the example of CAN Bus example in qt , do i need to add the dll to the app ? if the response is yes which files.h I should include and how I add the library ??
                    and thank u

                    A Offline
                    A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on 2 Mar 2021, 19:28 last edited by
                    #9

                    @alpacino

                    please see my post above:

                    https://forum.qt.io/topic/94197/can-bus-using-peak-can/5

                    Regards

                    Qt has to stay free or it will die.

                    1 Reply Last reply
                    1

                    • Login

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