writing data over RS232

writing data over RS232

Amos Shapira amos.shapira at gmail.com
Wed May 9 03:45:31 IDT 2012


Read avoirdupois tty line discipline and all that shit. Start with tty(4)
and work from there.
On May 8, 2012 4:25 AM, "Diego Iastrubni" <elcuco at kde.org> wrote:

> 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/20120509/cf31aac4/attachment.html>


More information about the Linux-il mailing list