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. QSerialPort Custom BaudRate
Forum Updated to NodeBB v4.3 + New Features

QSerialPort Custom BaudRate

Scheduled Pinned Locked Moved General and Desktop
18 Posts 6 Posters 16.2k Views 3 Watching
  • 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
    Nex46
    wrote on last edited by
    #4

    I'd like to bump this thread, can't find an answer to this anywhere. I need to use 416000 Bd. Anyone got any ideas?

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

      Currently QSerialPort allow to setup any custom BR which are suported by HW/driver. You can try to download latest sources from Git, build it and try.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Nex46
        wrote on last edited by
        #6

        It doesn't seem to work. I check the baud rate using myPort.baudRate() and the return value of setBaudeRate() and for 416000 it returns 9600 resp. false.
        It does accept 400000 and 500000, but not numbers in between.
        I've checked the setBaudRate function in qserialport.cpp, and it does not contain any check of valid values. It simply sets the BR. My only idea is that some other control function listens to the emitted signal and immediately sets it to default value again. ???
        I can communicate over serial interface in 416000 Bd using a python script so it's not a hardware issue.

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

          bq. I check the baud rate using myPort.baudRate() and the return value of setBaudeRate() and for 416000 it returns 9600 resp. false.

          What version of QSerialPort do you use?

          This behavior can be occured in QSerialPort < 5.3, when you try to setup baud rate if a device is not open. You can get error code to see what happens.

          1 Reply Last reply
          0
          • N Offline
            N Offline
            Nex46
            wrote on last edited by
            #8

            I have Qt 5.3.1 installed and I set the baud rate after I've called open() function. I tried checking the error like this, just after I set the BR:
            @QSerialPort::SerialPortError e1 = myPort.error();@

            But I don't get any error message. It just returns 0.

            I do get the communication working through the port, but all data is just gibberish.

            1 Reply Last reply
            0
            • N Offline
              N Offline
              Nex46
              wrote on last edited by
              #9

              Here's an printout of all baud rates accepted by setBaudRate() between 0 and 600000 in steps of 100.

              600000
              576000
              500000
              480000
              460800
              400000
              375000
              320000
              300000
              250000
              240000
              230400
              200000
              192000
              187500
              160000
              150000
              125000
              120000
              115200
              100000
              96000
              80000
              75000
              64000
              62500
              60000
              57600
              50000
              48000
              40000
              38400
              37500
              32000
              30000
              25000
              24000
              20000
              19200
              16000
              15000
              12800
              12500
              12000
              10000
              9600
              8000
              7500
              6400
              6000
              5000
              4800
              4000
              3200
              3000
              2500
              2400
              2000
              1800
              1600
              1500
              1200
              1000
              800
              600
              500
              400
              300
              200
              100

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

                Then you can try latest 5.3.3 sources of QtSerialPort (you should build it manually), there are added some patches to improve detection of custom divider and so on.

                1 Reply Last reply
                0
                • N Offline
                  N Offline
                  Nex46
                  wrote on last edited by
                  #11

                  I can confirm that the latest sources for QtSerialPort work with custom baud rate. Thanks for the help.

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    kickoune103
                    wrote on last edited by kickoune103
                    #12

                    i have Qt 5.5.1 (Clang 6.1 (Apple), 64 bit)
                    Built on Nov 25 2015 01:02:16.

                    i try to use QserialPort to 62500.
                    i send QByteArray FF000000000000.
                    at 115200 work fine with terminal in windows. (FF0000000.. in terminal).

                    But if i add SetBaudRate(62500) before open ,(work return true).
                    BUT don't work correctly in data.
                    i connect terminal windows at 62500(works, i have capture correct trame in protocol who work in 62500)
                    the data in terminal is different. C0 00 000...

                    Can you help me? please.
                    my project may be abandoned why don't work.

                    i use two same USB-RS232 converter we work in 62500 ( in windows)
                    USB CONVERTER(pc windows) ==> croissing wire ==> USB CONVERTER (in mac Qt)

                    thank's

                    1 Reply Last reply
                    0
                    • mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #13

                      hi and welcome
                      Have you tried with other serial program on mac side to see
                      if qt or USB serial converter driver that is not working as expected with 62500
                      something like
                      http://www.macupdate.com/app/mac/31352/coolterm

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kickoune103
                        wrote on last edited by
                        #14

                        cool term not work in 62500, i have test with: stty -f /dev/usb.serial... 62500
                        invalid argument... (work with 9600)

                        have you a term with we work with custom baud or a solution for testing the hardware?

                        thank's for your reply

                        mrjjM 1 Reply Last reply
                        0
                        • K kickoune103

                          cool term not work in 62500, i have test with: stty -f /dev/usb.serial... 62500
                          invalid argument... (work with 9600)

                          have you a term with we work with custom baud or a solution for testing the hardware?

                          thank's for your reply

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #15

                          @kickoune103
                          Ok. Im only on win and linux so mac is sort of unknown land to me.
                          https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/stty.1.html

                          here they mention
                          ispeed number/ ospeed number
                          Set terminal input baud rate to the number given, if possible. If the input baud rate i
                          set to zero, the input baud rate is set to the value of the output baud rate.
                          I wonder if it will allow to set it this way ?

                          1 Reply Last reply
                          0
                          • K Offline
                            K Offline
                            kickoune103
                            wrote on last edited by
                            #16

                            i have solved this probleme to use qt6 beta.
                            with Qserialport 6.

                            but problem: setbaudRate(62500) return true before openning port but the open() bug...

                            the solution: open with standard baud and setBaudRate.

                            i think it's works, i have 0xFF00....

                            i have not tested in QT5.5 to setBaudRate(62500) after open().

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

                              with Qserialport 6.

                              there are no qt6 beta and Qserialport 6!

                              but problem: setbaudRate(62500) return true before openning port but the open() bug...

                              On my side (with the PL2303 and with built in on-motherboard's 16550 chip) all fine, so, please give more info or try to lookup a problem on your side.

                              1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                kickoune103
                                wrote on last edited by
                                #18

                                sorry i use QT 5.6

                                http://download.qt.io/development_releases/qt/5.6/5.6.0-beta/

                                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