Qt Serial Port "parameter is incorrect" error
-
Hi @raymalifalitiko,
I am using Qt Creator 4.11.2. Based on Qt 5.14.2.
More interesting would be the Qt version and the operating system you are using.
QtSerialPort creates a lockfile on successful port open, if that file still exists you cannot open it again. That may happen after a crash of your program for example. However, after reboot it should be fine...
Regards
-
@raymalifalitiko said in Qt Serial Port "parameter is incorrect" error:
I am using qt creator on Windows 64 Bit machine.
Windows 10? And you still didn't tell us the Qt version that you use in your Kit.
Which type of serial port is that, by the way?
Regards
-
What's a serial port chip do you use (is it USB/serial port converter, is it your custom device with a custom FW, e.g. based on Arduino, STM32 or other stuff)?
-
@kuzulis I used two different devices and get the same error within different times. One of them is my STM board. I am connecting to it through USB CDC Virtual Port. Another is the power meter device from Siemens. I tried with 3 different USB-232 convertors when this problem occurs. I can connect with 3rd party terminal programs in this case with these different converters and also to STM board directly using virtual com port.
-
One of them is my STM board.
power meter device from SiemensMost likely, these devices does not handles properly some CDC-class callbacks (or does not support some ioctl's or its values) in their FW's.
F.e. it may not support some properties of DCB or COMMTIMEOUTS structures, its ranges and so forth (or it does not suport the OVERLAPPED operations). You need re-build the QSP, add there the debug outputs and to see where it fails.
-
@raymalifalitiko said in Qt Serial Port "parameter is incorrect" error:
Desktop_Qt_5_14_2_MinGW_64_bit
Have you ever been tried it on MSVC based kit? Did you have the same problem?
-
@raymalifalitiko said in Qt Serial Port "parameter is incorrect" error:
@kuzulis Is it normal that after rebooting of both devices and host computer, the problem still continues?
I' don't know. You need debug it himself.
-
Thanks, @kuzulis for giving me a reference to look at the device side.
The problem is solved by adding line coding settings to the CDC buffer on the STM. It is related to the hardware. STM users should bind USBD_CDC_LineCodingTypeDef data structure to CDC_Control_FS function.
In ready-made examples, this binding does not exist. Users who do not add this binding can face the same problem in long term tests. Maybe it can help people who face the same problem.
Regards