Can QT access any company's serial port card?
-
@jsulm Its like I am sending a Hex code data like 1a 52 24 f1 12 upto 91 bytes through RS 422 cable in another PC where I have written the code I just shown. I am transmitting the data in Qbytearray and so what need to receive is the same but I am receiving like 1a 92 @ & so on and now I don't understand why am I getting this problem.
May be it's because I opened the port twice or may be need to set buffersize double of what I am receiving or may be something with the time mismatch or may be something like datatype is wrong.
-
@jsulm Its like I am sending a Hex code data like 1a 52 24 f1 12 upto 91 bytes through RS 422 cable in another PC where I have written the code I just shown. I am transmitting the data in Qbytearray and so what need to receive is the same but I am receiving like 1a 92 @ & so on and now I don't understand why am I getting this problem.
May be it's because I opened the port twice or may be need to set buffersize double of what I am receiving or may be something with the time mismatch or may be something like datatype is wrong.
-
-
then if I already open the slot of RS-422 so no need to reopen it through QSerialPort
Wrong. QSerialPort is a class wrapping O/S specific functions, so you cannot simply omit it's
open()function@aha_1980 Yeah I have already used it but still the same problem.
As said, we cannot help you if you don't use QSerialPorts functions.
So the only thing you need to do after open is configuring it to RS-422?What is tty2?
You should also double check if the serial line settings are identical on both sides (bitrate, start, stop, parity, flow control).
-
Seems, you don't need to open a device twice. Just try to use QSerialPort::handle() after opening to do vendor-specific IOCTL's.
OOPS: I'm too late.. :)
-
Seems, you don't need to open a device twice. Just try to use QSerialPort::handle() after opening to do vendor-specific IOCTL's.
OOPS: I'm too late.. :)
-
then if I already open the slot of RS-422 so no need to reopen it through QSerialPort
Wrong. QSerialPort is a class wrapping O/S specific functions, so you cannot simply omit it's
open()function@aha_1980 Yeah I have already used it but still the same problem.
As said, we cannot help you if you don't use QSerialPorts functions.
So the only thing you need to do after open is configuring it to RS-422?What is tty2?
You should also double check if the serial line settings are identical on both sides (bitrate, start, stop, parity, flow control).
@aha_1980 I haven't used tty2.
But if I am opening the serial port using QSerialPort then I am unable to configure the RS 422 channel accordingly so I need to open it though what I did in the program that's the basic opening of the serial port.
I am setting the serial line according to Qt and it is opening when I am setting the port using QSerialPort.What do you mean by this:
QSerialPort is a class wrapping O/S specific functions. -
Seems, you don't need to open a device twice. Just try to use QSerialPort::handle() after opening to do vendor-specific IOCTL's.
OOPS: I'm too late.. :)
-
Can you please change the code according to our suggestions and upload a minimal example again?
Your current example is already quite complex. Thanks.
-
Seems, you don't need to open a device twice. Just try to use QSerialPort::handle() after opening to do vendor-specific IOCTL's.
OOPS: I'm too late.. :)
-
What does not working? I do not see any your code, sorry, but I am not a psychic.
-
Creating
QObjects before theQCoreApplicationis up and running is not supported. I imagine you get some warnings in the debug output, that need to be addressed before anything else. -
Creating
QObjects before theQCoreApplicationis up and running is not supported. I imagine you get some warnings in the debug output, that need to be addressed before anything else.By looking at the code again, I also see that
QSerialPortis a global variable. That is bad also as it is created at unknown time and may be accessed before it its constructor is run. -
@Nimika said in Can QT access any company's serial port card?:
TEWS technology TCP-469
From documentation regarding this product, and assuming you're under Linux and you built the device driver from TDRV002-SW-82-SRC.tar.gz are you able to run the examples provided? (i.e. Send and receive example application, etc.)
If so, for whatever reason you need/want to use Qt, you can still write C code like the examples in the Qt application and forget about QSerialPort() at all. You need to decide if you'll go that way, or if you use QSerialPort() rely on the handle to perform I/O specific functions for your card (as stated in previous posts).