Tux

...making Linux just a little more fun!

doubt in accessing serial port

vasavi s [vasavi.naga at gmail.com]


Fri, 29 Aug 2008 12:56:58 +0530

Hello,

I have a problem in accessing the serial port. I am trying to send data to another system using null modem. When we are using the program in loopback method it's working fine like we are able to transmit data and receive the data on a pc. But when trying to communicate between two systems based on linux (using c code) we are not getting the output. When writing to the port it is showing that it has written the data to the port. But on other side (i.e., on another system) we couldn't read the data which we have sent from first system. What to do? Tried h/w flow control & sftware flowcontrol but no use. Till now it was showing error like " error no.11,Could not read , the resourcet is temporarily unavailable. Now It's saying like reading the port successfully. But the number of bytes it's showing is zero. We could nt understand if the data we are writing in first system is reaching the second system with null modem and the other system is having a problem in reading the data or what ? Kindly suggest where the problem could be?

Thanks & Regards, vasavi


Top    Back


Jim Jackson [jj at franjam.org.uk]


Fri, 29 Aug 2008 11:11:08 +0100 (BST)

On Fri, 29 Aug 2008, vasavi s wrote:

> Hello,
>             I have a problem in accessing the serial port .I am trying to
> send data to another system using null modem.When we are using the program
> in loopback method it's working fine like we are able to transmit data and
> receive the data on a pc.But when trying to communicate between two systems
> based on linux (using c code) we are not getting the output.

In situations like this I use minicom or kermit on the receive side to confirm that the serial data is actually being transmitted.

Remember you have to have all the serial paramaters set correctly - baud rate, number of data bits, whether parity is added, number of stop bits, hardware/software flow control, whether to ignore DTR/DSR etc.

Once I confirmed my transmission code proved, then I use minicom or kermit to transmit to my receiving software. Once I've got that sorted it should work fine.

Serial programming under *nix systems can be a bit daunting. You have to telling the kernel how to handle the incoming data, is it coming in raw, or "cooked". Check out the serial programming howto at

http://tldp.org/HOWTO/Serial-Programming-HOWTO/index.html


Top    Back