LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-21-2006, 09:55 AM   #1
seraph-seph
Member
 
Registered: Jul 2005
Location: /dev/ATX3
Distribution: Slackware 11(kernel 2.6.17.13), SuSE 10, Caldera, CentOS 4.3
Posts: 38

Rep: Reputation: 15
Setup serial port at 1200b, 7bits, even parity and 1 top bit


Hi everyone.


I'm having some troubles with the configuration of the serial port, I'm traying to communicate two machines (one with winxp and the other with slackware) when I set up the communication at 1200, 7, even parity and one(1) stop bits it works fine sending. The setup in linux is this
Code:
stty -F /dev/ttyS0 speed 1200 cs7 -parodd -cstopb 
echo "testing" > /dev/ttyS0
I receive in a HyperTerminal (winXP) set up as 1200b, 7bits, parity even and one stop bit. testing

But when I try to read data using
Code:
cat /dev/ttyS0
And send data using an app in vbasic set up with the same parameters, it doesn't read anything, I tried with another linux machine and I received everything from the linux machine using the cat /dev/ttyS0 command.

Does any body knows how to set the serial port at 1200, 7 bits, one stop bit and even parity in oder to read the data sent from a xp machine?

Thanks
Mario
 
Old 10-21-2006, 10:06 AM   #2
dxqcanada
Member
 
Registered: Sep 2006
Location: Canada
Distribution: Gentoo
Posts: 702

Rep: Reputation: 43
Re: Serial port

If you are using the stty command to change the characteristics of a TTY then ensure:

- the TTY device is open before running the stty command. If you cannot then run some other process against the port ... like sleep 9999999 > /dev/ttyS0 &

- stty 1200 cs7 -parodd -cstopb < /dev/ttyS0

- run stty -a < /dev/ttyS0 to verify

Last edited by dxqcanada; 10-21-2006 at 10:11 AM.
 
Old 10-21-2006, 10:37 AM   #3
seraph-seph
Member
 
Registered: Jul 2005
Location: /dev/ATX3
Distribution: Slackware 11(kernel 2.6.17.13), SuSE 10, Caldera, CentOS 4.3
Posts: 38

Original Poster
Rep: Reputation: 15
Still can't read it, I type cat /dev/ttyS0 and echo "dfkjl" > /dev/ttyS0 from another machine and can read it but from the vb application can't read anything but I can send.

I guess something is missing in the set up

Mario
 
Old 10-21-2006, 12:32 PM   #4
seraph-seph
Member
 
Registered: Jul 2005
Location: /dev/ATX3
Distribution: Slackware 11(kernel 2.6.17.13), SuSE 10, Caldera, CentOS 4.3
Posts: 38

Original Poster
Rep: Reputation: 15
Found the problem but not yet the solution.

Seems like the application is sending as carriage return key the charactarer 20 (¶) but the data is the bufer
do u know how to disable carriage validation or charge the carriage char?
 
Old 10-21-2006, 12:49 PM   #5
dxqcanada
Member
 
Registered: Sep 2006
Location: Canada
Distribution: Gentoo
Posts: 702

Rep: Reputation: 43
Re: Serial port

Quote:
Originally Posted by seraph-seph
the application is sending as carriage return key the charactarer 20 (¶)
Hex character 20 = Space

Hex character 0D = CR

The data should have been sent.
Does the same problem happen with Hyperterminal ??
 
Old 10-21-2006, 12:57 PM   #6
seraph-seph
Member
 
Registered: Jul 2005
Location: /dev/ATX3
Distribution: Slackware 11(kernel 2.6.17.13), SuSE 10, Caldera, CentOS 4.3
Posts: 38

Original Poster
Rep: Reputation: 15
No not all but in WinNT long time ago I had the same problem.
The point is that when I send manually the return key the data shows up.

Now I can confirm that the data is at the buffer; Is there any way to change the carriage return or set up to print data asumming char 20 as return or print data without waiting the carriage return?

Last edited by seraph-seph; 10-21-2006 at 01:14 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
linux serial port to router console port connection? frankie_fix Linux - General 3 02-26-2007 09:32 PM
timedia 4 port serial port i/o card configuration binu_edl Linux - Hardware 0 03-09-2006 09:39 AM
IBM AIX 5.2/5.3 serial port/tty0 port vinod_balani AIX 2 02-19-2006 03:38 PM
Using serial port card(PCMCIA) with IPAQ running Linux, can't find ttyS0 port d2army Linux - Laptop and Netbook 0 11-12-2005 08:07 PM
Using an USB port as a standard DB9 Serial Port Lsteele Linux - Newbie 1 10-22-2005 09:48 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration