Qt Serial Port (works ok on Mac, can't read on Windows only write)
-
Hello,
I'm having a strange problem with qtserialport. I'll be thankful if someone help me solve this problem:
- I'm not an expert in QT and STM.
- I already search for this issue in several forums but I didn't have any luck.
Problem:
- I'm trying to communicate with STM32F767
- The port device is a virtual one.
- STM is sending a package of data each 250 ms (~100bytes).
- Using Mac OS I don't have problems with the code and readyRead() signal is trigger normally.
- If I use Windows and run the app readyRead() is never triggered and if I try to readAll() no data is showed.
- Write method is working.
Important note: Using Windows and after open and close the port with putty the app works normally. In these case readyRead() is triggered.
You can find bellow the setup code used:
firmware = new QSerialPort(this); ... firmware -> setPortName(port); firmware -> open(QIODevice::ReadWrite); firmware -> setBaudRate(QSerialPort::Baud115200); firmware -> setDataBits(QSerialPort::Data8); firmware -> setFlowControl(QSerialPort::NoFlowControl); firmware -> setParity(QSerialPort::NoParity); firmware -> setStopBits(QSerialPort::OneStop); connect(firmware, SIGNAL(readyRead()), this, SLOT(receivedata()));
Thank you for your help,
Hugo -
Hello,
I'm having a strange problem with qtserialport. I'll be thankful if someone help me solve this problem:
- I'm not an expert in QT and STM.
- I already search for this issue in several forums but I didn't have any luck.
Problem:
- I'm trying to communicate with STM32F767
- The port device is a virtual one.
- STM is sending a package of data each 250 ms (~100bytes).
- Using Mac OS I don't have problems with the code and readyRead() signal is trigger normally.
- If I use Windows and run the app readyRead() is never triggered and if I try to readAll() no data is showed.
- Write method is working.
Important note: Using Windows and after open and close the port with putty the app works normally. In these case readyRead() is triggered.
You can find bellow the setup code used:
firmware = new QSerialPort(this); ... firmware -> setPortName(port); firmware -> open(QIODevice::ReadWrite); firmware -> setBaudRate(QSerialPort::Baud115200); firmware -> setDataBits(QSerialPort::Data8); firmware -> setFlowControl(QSerialPort::NoFlowControl); firmware -> setParity(QSerialPort::NoParity); firmware -> setStopBits(QSerialPort::OneStop); connect(firmware, SIGNAL(readyRead()), this, SLOT(receivedata()));
Thank you for your help,
HugoHi @hugofreitas,
firmware = new QSerialPort(this);
I guess firmware is a member variable ... right?
firmware -> open(QIODevice::ReadWrite);
Open returns a bool, check it!
Also, I'd move all the setBaudRate & co. calls before calling open.
Also, most of these calls have a return value to check.Regarding the controller: does it have an internal USB-serial port or do you use an external chip (e.g. FTDI)?
Regards
-
Thank you for your answer @aha_1980
@aha_1980 said in Qt Serial Port (works ok on Mac, can't read on Windows only write):
I guess firmware is a member variable ... right?
Yes!
@aha_1980 said in Qt Serial Port (works ok on Mac, can't read on Windows only write):
I guess firmware is a member variable ... right?
firmware -> open(QIODevice::ReadWrite);
Open returns a bool, check it!
Also, most of these calls have a return value to check.
Everything that can return bools returns a true state and without errors. (firmware -> error())
@aha_1980 said in Qt Serial Port (works ok on Mac, can't read on Windows only write):
Regarding the controller: does it have an internal USB-serial port or do you use an external chip (e.g. FTDI)?
Internal.
@aha_1980 said in Qt Serial Port (works ok on Mac, can't read on Windows only write):
Also, I'd move all the setBaudRate & co. calls before calling open.
I'll try this and come back later.
Regards,
Hugo