[SOLVED] Connecting arduino (Galileo) failed with QSerialPort
-
I think you can try something like this:
@
QSerialPort * serial = new QSerialPort(“/dev/ttyACM0”);
if(serial->open(QIODevice::ReadWrite))
{
//setup your serialport params - baudrate, databits, parity, flowcontrol, stopbits, dataerrorpolicy
//do something there whatever you want - send "a" for example
}
else
{
out << serial->errorString() << endl;
}
@ -
[quote author="MrMNight" date="1394527326"]I think you can try something like this:
[/quote]Thanks for your reply, but it seems that the error occurs when it goes to
@serial->open()@
and then, jumps to
@serial->errorString()@
and I also tried to set databits\parity\etc. but it still doesn't work.
I wonder if it need some extra setting.
-
try run this
@
for (QSerialPortInfo port : QSerialPortInfo::availablePorts())
{
qDebug() << port.portName();
}
@Does this list contains "ttyACM0"?
-
[quote author="MrMNight" date="1394533009"]try run this
@
for (QSerialPortInfo port : QSerialPortInfo::availablePorts())
{
qDebug() << port.portName();
}
@Does this list contains "ttyACM0"?[/quote]
Yes. It can be found by QSerialPortInfo::availablePorts() on both OS X(cu.modemxxxxx) and Xubuntu(ttyACM0).
-
Do you have enough permissions to read and write to your ttyACM0?
I don't know how to perform this on Mac, but in Xubuntu you can add your user to dialout group, simply write in console (terminal)
@
sudo adduser your_user_name dialout
@and try to run again your code.
-
[quote author="MrMNight" date="1394535113"]Do you have enough permissions to read and write to your ttyACM0?
I don't know how to perform this on Mac, but in Xubuntu you can add your user to dialout group, simply write in console (terminal)
@
sudo adduser your_user_name dialout
@and try to run again your code.[/quote]
Thanks for your help! I solved this by removing
@QIODevice::Unbuffered@
It seems that ardunio doesn't support such openmode. -
- QIODevice::Unbuffered does not supported by QtSerialPort
- After write() you should call waitForBytesWritten(), because otherwise nothing to be write.
-
You are welcome, in "documentation":http://qt-project.org/doc/qt-5.1/qtserialport/qserialport.html#open there are warning "The mode has to be QIODevice::ReadOnly, QIODevice::WriteOnly, or QIODevice::ReadWrite. Other modes are unsupported."
-
Hi edward_zhu,
Can you share the code for connecting to USB(/dev/ttyACM0) in QT here?
I need to connect to the device from Linux QT.Please consider this as High Priority.I will be waiting for the code.
Regards,
Kripa -
@kripashree said in [SOLVED] Connecting arduino (Galileo) failed with QSerialPort:
Please consider this as High Priority.I will be waiting for the code.
Please don't be so demanding!
This is user forum where people help for free.
Nobody here is obliged to consider anything high priority or deliver code!And when asking you should provide more information.
What is the device you want to connect to? -
Hi @kripashree: edward_zhu was last only 5 years ago, I doubt he will see your request. And even if he did, he might not even have it anymore.
So please answer the questions @jsulm gave you, and we will see if we can help you.
Regards