PDA

View Full Version : qextserialport BAUDRATE problem



dheeraj
24th July 2008, 16:08
Hi friends i am working on a serial communication project in Qt. I am using qextserialport for the serial communication.I am trying to send some data from one computer to another computer and receive it and view it in Hyperterminal. But there seems to be a small problem the data is received on the HyperTerminal only with some BaudRates like (9600,38400,115200.... etc) and when i change the BAUDRATE in the program the BAUDRATE does't change, i think it is taking some default value. I confirmed it by checking the output waveform in the CRO with different BAUD RATES but i get the same waveform for all the different BAUDRATES i have tried. What do you think the problem is, How can i solve my problem so that the BAUDRATE actually changes when i change in the program.

This is the code i am using.


void frame:: framegeneration()
{
static const char mydata[] = {0x0c, 0x14, 0x03, 0x84, 0x78, 0x9c, 0x3b, 0x76,
0xec, 0x18, 0xc3, 0x31, 0x0a, 0xf1};
QByteArray data = QByteArray::fromRawData(mydata, sizeof(mydata));
char i1 = port->write(data.toHex(),data.length());
textEdit->append(data.toHex());
}


These are the settings for the port in the constructor.


setupUi(this);
port = new QextSerialPort("COM1");
port->setBaudRate(BAUD19200);
port->setFlowControl(FLOW_OFF);
port->setParity(PAR_NONE);
port->setDataBits(DATA_8);
port->setStopBits(STOP_2);
port->open(QIODevice::ReadWrite | QIODevice::Unbuffered);


Thank You

awanish_jmi
25th July 2008, 18:16
hi...
i hav worked on same type of project...i think the problem is in the receving terminal...since in hyperterminal u can receive bytes only on standard baudrates that are available...suppose u set the hyperterminal to receive bytes on baud 2400 and ur program is sending the data at baud 2500;so it wil not display the data...

it's better to write program for receiving end to read the data at the baud u want..

thanks...
awanish_jmi@yahoo.com

dheeraj
26th July 2008, 06:20
Hey thanks for the reply, Actually i will be connecting the RS-232 cable to a target board and then from the the target board it will connected to another computer to check out in its Huperterminal. So i really don't think i can write a program to receive and display on other computer. Actually the test program written in Qt with qextserialport works perfectly fine i can receive and display it on the other computer but i get the problem when i try to view it on the HyperTerminal. It is not consistent i can receive and view the data at times and all of a sudden it stops working. I cross checked all the hardware connections replaced the RS232 cables also but no luck. I think its because of the Baud and other serial comm configuration. The configuration which i have given in the program is not setting at all i think the program is taking some default values on it own. !!


Thank You

dheeraj
26th July 2008, 11:45
Hello

Has any one sucessfully done a program in Qt using qextserialport to send some data or any thing to another computer using RS232 and receive it on the other computers Hyperterminal. I am having serious problems with qextserialport in communicating with the Hyperterminal. I am able to send data using the same program and the same settings to another computer to a program written in Qt to receive from comm port. I downloaded a windows program and tested it in which i can view every thing i send on the other computers Hyperterminal. But no luck with qextserialport. Any body have some idea regarding this problem.


Thank You

b1
26th July 2008, 12:28
G'Day,

I have played with qextserialport a little bit and found that I had to close the serial port then change the baud rate and reopen the serial port again. I also found hyperterminal to be flakey. I used minicom under Linux and Telex under windows when testing my apps.

Hope this helps...

B1.

dheeraj
28th July 2008, 06:12
Hey i have a small problem there. Actually i have to communicate with a ATMELTarget board to its Hyperterminal, So if i see the data pass through the systems hyperterminal it will be the same for Target Board. Thats the reason i have to use Hyperminal program to test my program before i cud actually use it on the target board. ??!!


Thank You

fwallenwein
19th March 2009, 19:29
I have played with qextserialport a little bit and found that I had to close the serial port then change the baud rate and reopen the serial port again. I also found hyperterminal to be flakey. I used minicom under Linux and Telex under windows when testing my apps.


I know - this is an old thread, but maybee this helps others.

Under Linux, I also had to to close the serial port then change the baud rate and reopen the serial port again.

Under Window - this didn't work. I had to do it the other way arround. First open the port, and than set the baud rate. Strange - but that's how it works for me.

Frank