serialport considerations for linux
-
@SGaist Hi, this is the response i get from the port if i add the suggested code to the oenSeriall function :
bool QSerialPort::setRequestToSend(bool): device not open
bool QSerialPort::setDataTerminalReady(bool): device not openhowever, if i try adding either of these, nothing sends through the serial port...
m_serial->open(QSerialPort::ReadWrite); m_serial->open(QIODevice::ReadWrite);
-
Hi,
The serialport stuff i was working on ended up working for windows, but it still fails to function correctly on linux and sends random values, even on another (identical) setupAre there anythings specifically that could cause this to happen?
-
@agmar said in serialport considerations for linux:
Are there anythings specifically that could cause this to happen?
No.
I'm not an expert, but at least make sure the baud rate etc. parameters are correct under Linux?
well, this is the setup:
private: Ui::MainWindow *ui; QSerialPort *m_serial; }; 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); } void MainWindow::writeSerial() { QByteArray message; message.append(0xFF); if (m_serial->open(QIODevice::ReadWrite)) { m_serial->write(message); m_serial->waitForBytesWritten(-1); m_serial->close(); } }
i cant see anything wrong, i took care of the baud rate, data bits...
maybe no flow control could be causing this? the transmission is successful on a windows pc , strangely enough...
-
Hi,
In which direction does the randomness happen ? From your machine to your device ?
Did you already tried setting requestToSend ? Maybe you need dataTerminalReady. -
Hi,
In which direction does the randomness happen ? From your machine to your device ?
Did you already tried setting requestToSend ? Maybe you need dataTerminalReady.@SGaist Hi, this is the response i get from the port if i add the suggested code to the oenSeriall function :
bool QSerialPort::setRequestToSend(bool): device not open
bool QSerialPort::setDataTerminalReady(bool): device not openhowever, if i try adding either of these, nothing sends through the serial port...
m_serial->open(QSerialPort::ReadWrite); m_serial->open(QIODevice::ReadWrite);
-
@SGaist Hi, this is the response i get from the port if i add the suggested code to the oenSeriall function :
bool QSerialPort::setRequestToSend(bool): device not open
bool QSerialPort::setDataTerminalReady(bool): device not openhowever, if i try adding either of these, nothing sends through the serial port...
m_serial->open(QSerialPort::ReadWrite); m_serial->open(QIODevice::ReadWrite);
-