QSerialPort hardware considerations
-
Hi,
i managed to get two bytes sent through the serial port today, but the output became gibberish when i restarted the computer, what could possibly cause this?@agmar said in QSerialPort hardware considerations:
but the output became gibberish
What does this mean exactly?
-
@agmar said in QSerialPort hardware considerations:
but the output became gibberish
What does this mean exactly?
-
@jsulm the values i see on a scope connected to the lines show anywhere from 2 to 4 bytes of transmitted data, with some of the pulse lengths being shorter than the others, while other times the first byte is double the baud rate, it looks really bizarre
Hi,
Might be a silly question but are you sure you did properly reconfigure the serial port before using it ?
Also, is the device at the other hand properly initialized ?
-
as @SGaist alluded to, guessing the speed or char format changed to system default upon reboot and that isn't what your app expects.
-
Hi,
Might be a silly question but are you sure you did properly reconfigure the serial port before using it ?
Also, is the device at the other hand properly initialized ?
@SGaist This is the initialization code :
void MainWindow::openSeriall(){ m_serial->setPortName(portName); m_serial->setBaudRate(QSerialPort::Baud19200); m_serial->setDataBits(QSerialPort::Data8); m_serial->setParity(QSerialPort::NoParity); m_serial->setFlowControl(QSerialPort::NoFlowControl); m_serial->setStopBits(QSerialPort::OneStop); } the portName is acquired with QSerialportInfo and correctly identifies the USB device. i initialize the port only once and the transmissions take place without touching the port setup, the device on the other end is programmed to respond to an 0xAA and 0xFF command, it works as expected every time with hterm and term and the terminal example seems to work ok too, so im not sure... -
as @SGaist alluded to, guessing the speed or char format changed to system default upon reboot and that isn't what your app expects.
@Kent-Dorfman does it matter tho? because i initialize the serial port everytime i run the program? the baudrate and so on are set everytime the app runs, so it would really make no sense if that were the case(for me, at least)
-
@Kent-Dorfman does it matter tho? because i initialize the serial port everytime i run the program? the baudrate and so on are set everytime the app runs, so it would really make no sense if that were the case(for me, at least)
-
@agmar are you sure, you're using the same instance to communicate, that you here initialise ?
You wouldn't believe how many people mess this up!