writing data over RS232

writing data over RS232

Valery Reznic valery_reznic at yahoo.com
Mon May 7 22:05:34 IDT 2012


RS232 has a lot of settings, baud rate is only one of them

You can use 'stty -a' to see what available.
Unless all your settings are correct you are going to have a problem with communication.


Valery.


>________________________________
> From: Diego Iastrubni <elcuco at kde.org>
>To: "linux-il at cs.huji.ac.il" <linux-il at cs.huji.ac.il> 
>Sent: Monday, May 7, 2012 9:24 PM
>Subject: writing data over RS232
> 
>Hi all,
>
>I have been assigned at work to write a specific protocol between two 
>machines, which eventually will be over RS232. As part of the development I 
>decided to write it on linux, and simulate the communication using a named 
>pipe. In theroy, it should be trivail since the protocol only needs to know 
>about the FD to read/write to, correct? Wrong.
>
>I face two problems (maybe one, as both problems seem similar):
>
>When I try to read from the PC (Ubuntu 12.04, 64bit), the read just aborts 
>returning "0". If I run the application several times, I somtimes see that the 
>app can read ONE byte. Sometimes.
>
>When I write from the PC, and read from the device (Andriod, 2.3.7, Linux 
>2.6.38.8) the android device reads garbage. I mean, the byte count is wrong, 
>and the content is usually garbage.
>
>When I connect microcom (busybox) on Android (actually "microcom /dev/ttyS3 | 
>hexdump -C") I can see that the bytes sent are mostly arriving, however maybe 
>times bytes are missing, and sometimes the same bytes are read twice (I sent 
>"testing 123" and read "testing 12323").
>
>Some remarks:
>
>- ttyS* are opened on both sides using "open(file, O_RDWR|O_NOCTTY)"
>- speeds are set on both side using "csetispeed(&to, B1900);csetospeed(&to, 
>B1900);", note that I lowered the speed for the test. 
>- The Android side has no HW flow control (that might be the trigger).
>
>What would you recommend me to do?
>
>- diego
>
>_______________________________________________
>Linux-il mailing list
>Linux-il at cs.huji.ac.il
>http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20120507/72bc691c/attachment.html>


More information about the Linux-il mailing list