1

I'm trying to set a custom baud rate of 10400 to my connected device. I'm using the Qt Creator IDE in order to interact with the device. However, through several methods, I'm unable to change the baud rate from 9600, which is the default baud rate.

I've tried QSerialPort::setBaudRate(), but fails because of an unsupported divisor. I've tried stty -F /dev/ttyUSB0 10400, however it returns as an invalid argument.

I'm attempting to use the freediag API in order to now set the baud rate to 10400. However, because of the poor documentation provided, I'm not really sure how to set the baud rate. The command is IB 10, however I have no idea as to where to execute this command (might be executing the command in the wrong directory?)?

If there's any alternative solutions than the one I'm trying, please explain it to me as I'm running out of options.

xcyl40
  • 43
  • 1
  • 9

1 Answers1

1

I am assuming your device is connected through a USB virtual COM port. In this application, QSerialPort is an abstraction layer above USB, so attempting to directly set the USB baud rate through stty will not work (if it is possible at all- USB is a very strictly-defined protocol).

What you want to set is the baud of the QSerialPort object itself, as you are attempting to do, but 10400 isn't a standard baud rate. It's highly unlikely that the device uses that baud - try using QSerialPort::setBaudRate() with a value of 14400 instead.

You should probably edit your post with details about your setup. What is the nature of the device? Does it use RS232, RS485 or some other serial protocol? Do you have example code to verify that you are communicating with it correctly, and what outcome (on the hardware or software side) do you expect upon correct communication?

automaton
  • 495
  • 6
  • 16
  • For reference, standard baud rates include 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 128000 and 256000 bits per second – automaton Jul 18 '16 at 20:21