[LCP]reg serial communication in linux.

James Attard james_attard at ieee.org
Wed Oct 15 17:29:01 UTC 2003


Paste the port initialisation code. The first thing which comes into my
mind is that you have enabled CTS/RTS (hardware flow control), whereas you
would have needed XON/XOFF (software flow control), or vice-versa. As
regards to the cabling, check that you have a NULL-MODEM-CABLE (i.e. pin 2
of one end of the cable goes to pin 3 of the other end of the cable, and
vice versa).

James

>
>
> On Wednesday, October 15, 2003 8:28 AM, sowmya.k [SMTP:sowmi99 at yahoo.com]
> wrote:
>>  I could execute my program well but It just hangs while reading data.
>>  I tested whether my data is transmitted or not through
>>
>>  cat /proc/tty/driver/serial
>> It says  that
>> 0 :uart:16550A port:3F8 irq:4 tx:3 rx:0 (becoz I am making use of ttyS0)
>>
>> where has at the receiver end I got the message as
>>
>> 0 :uart:16550A port:3F8 irq:3 tx:0 rx:0
>>
>> Are there any formatted way I should follow such that the written data
>> can
> be properly read.
>>
>> Thanx i advance
>> Sowmya
>
> Have you checked the pin connections on your cable? You say you have null
> modem and that (IIRC) will deal with RTS/CTS. Have you checked that the RX
> and TX pins are crossed? Are you aware of DCE vs DTE?
>
> I think they are pins 2 and 3 but it's been a while. Nub of the point is
> that if 2 is the send on one side, then 3 is the receive on the other (or
> vice-versa obviously).
>
>
>> Andrew Weaver <Andrew.Weaver at tecnomen.fi> wrote:
>>
>>
>>
>> On Tuesday, October 14, 2003 12:19 PM, sowmya.k [SMTP:sowmi99 at yahoo.com]
>> wrote:
>> > I had connected 2 systems using null modem
>> > cable(RS232).
>> > My problem comes in the reading part.
>> > My coding goes this way.
>> > First I had opened my tty (i.e my terminal screen
>> > and keyboard)
>> > Then I set some parameters to it.
>> > Third I opened my port and finished all my
>> > settings.
>> > Fourth I started to write and read datas from the
>> > port.
>> > Atlast I closed everything.
>> > Let me give the code I used to read and write
>> >
>> >
>> > To write datas to the port
>> >
>> > while (STOP==FALSE) //STOP is defined to be
>> > TRUE
>> > {
>> > status = fread(&Key,1,1,input);
>> > if (status==1) //if a key was hit
>> > {
>> > fputc((int) Key,output);
>> > write(fd,&Key! ,1); //write 1 byte
>> > to the port
>> > }
>> > }
>> >
>> >
>> >
>> > To read from the port
>> >
>> > if (wait_flag==FALSE) //if input is
>> > available
>> > {
>> > res = read(fd,buf,255);
>> > if (res)
>> > {
>> > for (i=0; i
>> > in string
>> > {
>> > In1 = buf[i];
>> > printf(message,"%c ",In1);
>> > fputs(message,output);
>> > }
>> > }
>> > wait_flag = TRUE; /* wait for new
>> > input */
>> > } //end if wait flag == FALSE
>> >
>> > } //while stop==FALSE
>> >
>> >
>> > Thanking you
>> >
>> > sowmya
>> >
>> So... what is the problem that you are getting?
>>
>>
>>
>>
>> > __________________________________
>> > Do you Yahoo!?
>> > The New Yahoo! Shopping - with improved product search
>> > http://shopping.yahoo.com
>> > _______________________________________________
>> > This is the Linux C Programming List
>> > : http://lists.linux.org.au/listinfo/linuxcprogramming List
>> _______________________________________________
>> This is the Linux C Programming List
>> : http://lists.linux.org.au/listinfo/linuxcprogramming List
>>
>>   _____
>>
>> Do you Yahoo!?
>> The New Yahoo! Shopping
> <http://shopping.yahoo.com/?__yltc=s%3A150000443%2Cd%3A22708228%2Cslk%3Atext
> %2Csec%3Amail> - with improved product search
> _______________________________________________
> This is the Linux C Programming List
> :  http://lists.linux.org.au/listinfo/linuxcprogramming List
>



More information about the linuxCprogramming mailing list