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. Qt Serial Port "parameter is incorrect" error

Qt Serial Port "parameter is incorrect" error

Scheduled Pinned Locked Moved Solved General and Desktop
serialportqtserialportqt 5.14.2creator 4.11.2
12 Posts 4 Posters 2.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.
  • A aha_1980
    6 Apr 2020, 09:45

    Hi @raymalifalitiko,

    I am using Qt Creator 4.11.2. Based on Qt 5.14.2.

    More interesting would be the Qt version and the operating system you are using.

    QtSerialPort creates a lockfile on successful port open, if that file still exists you cannot open it again. That may happen after a crash of your program for example. However, after reboot it should be fine...

    Regards

    R Offline
    R Offline
    raymalifalitiko
    wrote on 6 Apr 2020, 09:52 last edited by
    #3

    @aha_1980 Thanks for your answer. I am using qt creator on Windows 64 Bit machine. As I mentioned in my post, even if I restart the computer and the target device, I get the same error again.

    A 1 Reply Last reply 6 Apr 2020, 09:58
    0
    • R raymalifalitiko
      6 Apr 2020, 09:52

      @aha_1980 Thanks for your answer. I am using qt creator on Windows 64 Bit machine. As I mentioned in my post, even if I restart the computer and the target device, I get the same error again.

      A Offline
      A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on 6 Apr 2020, 09:58 last edited by
      #4

      @raymalifalitiko said in Qt Serial Port "parameter is incorrect" error:

      I am using qt creator on Windows 64 Bit machine.

      Windows 10? And you still didn't tell us the Qt version that you use in your Kit.

      Which type of serial port is that, by the way?

      Regards

      Qt has to stay free or it will die.

      R 1 Reply Last reply 6 Apr 2020, 11:02
      0
      • A aha_1980
        6 Apr 2020, 09:58

        @raymalifalitiko said in Qt Serial Port "parameter is incorrect" error:

        I am using qt creator on Windows 64 Bit machine.

        Windows 10? And you still didn't tell us the Qt version that you use in your Kit.

        Which type of serial port is that, by the way?

        Regards

        R Offline
        R Offline
        raymalifalitiko
        wrote on 6 Apr 2020, 11:02 last edited by
        #5

        @aha_1980 Win10 and Desktop_Qt_5_14_2_MinGW_64_bit. I could not understand what you mean for serial port type? I use qt serial port example as a reference.

        K 1 Reply Last reply 6 Apr 2020, 12:14
        0
        • R raymalifalitiko
          6 Apr 2020, 11:02

          @aha_1980 Win10 and Desktop_Qt_5_14_2_MinGW_64_bit. I could not understand what you mean for serial port type? I use qt serial port example as a reference.

          K Offline
          K Offline
          kuzulis
          Qt Champions 2020
          wrote on 6 Apr 2020, 12:14 last edited by kuzulis 4 Jun 2020, 12:16
          #6

          @raymalifalitiko

          What's a serial port chip do you use (is it USB/serial port converter, is it your custom device with a custom FW, e.g. based on Arduino, STM32 or other stuff)?

          R 1 Reply Last reply 6 Apr 2020, 12:23
          1
          • K kuzulis
            6 Apr 2020, 12:14

            @raymalifalitiko

            What's a serial port chip do you use (is it USB/serial port converter, is it your custom device with a custom FW, e.g. based on Arduino, STM32 or other stuff)?

            R Offline
            R Offline
            raymalifalitiko
            wrote on 6 Apr 2020, 12:23 last edited by raymalifalitiko 4 Jun 2020, 12:33
            #7

            @kuzulis I used two different devices and get the same error within different times. One of them is my STM board. I am connecting to it through USB CDC Virtual Port. Another is the power meter device from Siemens. I tried with 3 different USB-232 convertors when this problem occurs. I can connect with 3rd party terminal programs in this case with these different converters and also to STM board directly using virtual com port.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kuzulis
              Qt Champions 2020
              wrote on 6 Apr 2020, 13:10 last edited by kuzulis 4 Jun 2020, 13:13
              #8

              One of them is my STM board.
              power meter device from Siemens

              Most likely, these devices does not handles properly some CDC-class callbacks (or does not support some ioctl's or its values) in their FW's.

              F.e. it may not support some properties of DCB or COMMTIMEOUTS structures, its ranges and so forth (or it does not suport the OVERLAPPED operations). You need re-build the QSP, add there the debug outputs and to see where it fails.

              R 1 Reply Last reply 6 Apr 2020, 13:55
              3
              • K kuzulis
                6 Apr 2020, 13:10

                One of them is my STM board.
                power meter device from Siemens

                Most likely, these devices does not handles properly some CDC-class callbacks (or does not support some ioctl's or its values) in their FW's.

                F.e. it may not support some properties of DCB or COMMTIMEOUTS structures, its ranges and so forth (or it does not suport the OVERLAPPED operations). You need re-build the QSP, add there the debug outputs and to see where it fails.

                R Offline
                R Offline
                raymalifalitiko
                wrote on 6 Apr 2020, 13:55 last edited by
                #9

                @kuzulis Is it normal that after rebooting of both devices and host computer, the problem still continues?

                K 1 Reply Last reply 6 Apr 2020, 14:58
                0
                • C Offline
                  C Offline
                  CKurdu
                  wrote on 6 Apr 2020, 14:20 last edited by
                  #10

                  @raymalifalitiko said in Qt Serial Port "parameter is incorrect" error:

                  Desktop_Qt_5_14_2_MinGW_64_bit

                  Have you ever been tried it on MSVC based kit? Did you have the same problem?

                  You reap what you sow it

                  1 Reply Last reply
                  0
                  • R raymalifalitiko
                    6 Apr 2020, 13:55

                    @kuzulis Is it normal that after rebooting of both devices and host computer, the problem still continues?

                    K Offline
                    K Offline
                    kuzulis
                    Qt Champions 2020
                    wrote on 6 Apr 2020, 14:58 last edited by
                    #11

                    @raymalifalitiko said in Qt Serial Port "parameter is incorrect" error:

                    @kuzulis Is it normal that after rebooting of both devices and host computer, the problem still continues?

                    I' don't know. You need debug it himself.

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      raymalifalitiko
                      wrote on 6 Apr 2020, 17:30 last edited by
                      #12

                      Thanks, @kuzulis for giving me a reference to look at the device side.

                      The problem is solved by adding line coding settings to the CDC buffer on the STM. It is related to the hardware. STM users should bind USBD_CDC_LineCodingTypeDef data structure to CDC_Control_FS function.

                      In ready-made examples, this binding does not exist. Users who do not add this binding can face the same problem in long term tests. Maybe it can help people who face the same problem.

                      Regards

                      1 Reply Last reply
                      1

                      12/12

                      6 Apr 2020, 17:30

                      • Login

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