[Solved] Crash when i try serial->open with QSerialPort
-
[quote author="kqt-mr-nv6" date="1383907587"]ok
change
bq.
QSerialPort serial;to
QSerialPort *serial;refer this post for settings
"http://qt-project.org/forums/viewthread/34592/":http://qt-project.org/forums/viewthread/34592/try 'echo' some data directly to '/dev/ttyS0' and
check the serial port working using minicom/cutecom
if port is found ok
QSerialPort should work
I am using it from since it was launched[/quote]
I have installed cutecom on both computers connected through ttyS0, both have same configuration and I can send messages from mine to my mate's comp (and he reads them correctly), but not on the other side (him to me). I don't know what this means.
About the "this" constructor parameter, I don't have the "children-parent" error if I just type "new QSerialPort()", but I still have the same problem. I'm not sure what I'm suppossed to type on that parameter.
We want run the same program on both computers, one module of the program send messages and other module read them. Just saying for make more understable what we want to do.
Sorry for my bad english and thank you for your time.
-
bq.
I can send messages from mine to my mate’s comp (and he reads them correctly), but not on the other side (him to me). I don’t know what this means.First check loop-back
short 2,3 terminals on one side of the cable
and connect other end to the systemtry to send some data, you will receive what ever you transmit
try on both PC'sif data is not received on both systems, then cable is not good
otherwise there is some problem with the system portbq.
I don’t have the “children-parent” error if I just type “new QSerialPort()”,if you pass nothing, parent is NULL so you will no more get the
QObject errorwhy are you opening serial port in a thread ?
-
- Where you take the QtSerialPort? From the git?
- Do not use different threads if you don't know how use it.
- Show more your code.
Note: The QtSeiralPort is not a thread-safe class yet!
-
[quote author="kqt-mr-nv6" date="1383912692"]
bq.
I can send messages from mine to my mate’s comp (and he reads them correctly), but not on the other side (him to me). I don’t know what this means.First check loop-back
short 2,3 terminals on one side of the cable
and connect other end to the systemtry to send some data, you will receive what ever you transmit
try on both PC'sif data is not received on both systems, then cable is not good
otherwise there is some problem with the system portbq.
I don’t have the “children-parent” error if I just type “new QSerialPort()”,if you pass nothing, parent is NULL so you will no more get the
QObject errorwhy are you opening serial port in a thread ?
[/quote][quote author="kuzulis" date="1383916275"]1. Where you take the QtSerialPort? From the git?
2. Do not use different threads if you don't know how use it.
3. Show more your code.Note: The QtSeiralPort is not a thread-safe class yet![/quote]
Well, i have news.
We tried the code on my mates comp and works fine, he is able to read with QSerialPort class from my computer (BUT i'm sending with NO QSerialPort). I copied his code to my computer and it still crashing when I try to open, when it didn't crash on the other comp.
We have the same machines (Ubuntu 64 bits VirtualBox) and installed Qt and QtSerialPort (from github) the same way both. My "/dev/ttyS0" seems works fine since I'm able to read the data that he sends through serialport (using cutecom).
Resuming:
- Cutecom works fine on both computers, we can receive data through rs232 from each other.
- The same code thats works fine on his computer (QtSerialPort object can open and read), crashes on mine when it tries to QSerialPortObject->open.
- Both computers have the same whole configuration.
Any idea of what happens here? Sorry if I can't explain better.
-
try this example code and first make sure
that it works"http://qt-project.org/doc/qt-5.1/qtserialport/terminal.html":http://qt-project.org/doc/qt-5.1/qtserialport/terminal.html
-
[quote author="kqt-mr-nv6" date="1383991793"]
try this example code and first make sure
that it works"http://qt-project.org/doc/qt-5.1/qtserialport/terminal.html":http://qt-project.org/doc/qt-5.1/qtserialport/terminal.html[/quote]
It crashes when i press connect button the same way as my project. The port is "ttyS0", the only available. The weird think about this is that I can receive data from ttyS0 if I use cutecom.
PS: I'm installing another Ubuntu machine and I'll try again there
-
ok, then there must be some problem with the system/os itself
you can check kernel debug messages,
using 'dmesg' command
try and check if any relevant info is present -
[quote author="kqt-mr-nv6" date="1383993829"]ok, then there must be some problem with the system/os itself
you can check kernel debug messages,
using 'dmesg' command
try and check if any relevant info is present [/quote]Now ALL works fine in the new Virtual Machine. It's strange because I have the same config than in the other one. Shit happens.
Thank you really much for your time, the problem is solved.
-
2 moratilla,
you didn't answer this question:
bq. 1. Where you take the QtSerialPort? From the git?
Because it is important, because has been introduced a regression, see more: https://codereview.qt-project.org/#change,70634
-
[quote author="kuzulis" date="1384025002"]2 moratilla,
you didn't answer this question:
bq. 1. Where you take the QtSerialPort? From the git?
Because it is important, because has been introduced a regression, see more: https://codereview.qt-project.org/#change,70634
[/quote]Yes I downloaded with "git clone git://gitorious.org/qt/qtserialport.git"
Anyway, I don't know what was the problem because I made a new Virtual Machine, installed all the same way than in the other one and now it works fine.
Thank you again, br