ts-7000
[Top] [All Lists]

[ts-7000] Re: troubleshooting COM2 code

To:
Subject: [ts-7000] Re: troubleshooting COM2 code
From: "BillBergeron" <>
Date: Fri, 20 Jul 2007 14:20:45 -0000
I can give you a possible anecdotal answer (as opposed to specific 
code) to the problem. In my experience with passing data via the COM 
ports, mostly with various modem connections both on the main board 
and on the daughter boards, is they quickly overrun the buffer. This 
seems to happen with available daemons (pppd), terminal programs 
(minicom, microcom) or with code that I have written (well, 
modified). Granted, I have little experience in managing data on a 
hardware level like this so I may be speaking from ignorance but 
maybe this will give you something to think about. And if you happen 
to figure it out I would be interested in what you did...

Bill 

--- In  "lerougegorge" <> 
wrote:
>
> I wrote the C program below to echo characters received on COM2 
(19200
> 8N1) to the standard out, but I seem to be having the following
> problems:
> 
> 1. It always drops the first character.
> 2. It only echoes about 15 - 20 characters (it varies).
> 3. It then outputs some random looking data (e.g. 0x1842C202) and 
then
> stops echoing.
> 
> I tested this by connecting via telnet and connecting COM2 to my
> computers' serial ports.  I tried this on both a windows machine 
with
> hyperterm and an Ubuntu machine with Minicom.  Anyone have any idea 
what
> is wrong?
> 
> #include <stdio.h>
> #include <termios.h>
> #include <fcntl.h>
> #include <unistd.h>
> 
> int main()
> {
>      printf("Echo program starting\n");
> 
>      //Open COM2
>      int fd = open("/dev/ttyAM1", O_RDWR | O_NOCTTY | O_NDELAY);
> 
>      if(fd <= 0)
>      {
>          printf("Error, failed to open COM2\n");
>          return 0;
>      }
> 
>      //Set for COM2 19200 8N1, non-blocking reads
>      struct termios options;
>      tcgetattr(fd, &options);
> 
>      options.c_cflag     = CS8 | CLOCAL | CREAD;
>      options.c_iflag     = IGNPAR;
>      options.c_oflag     = 0;
>      options.c_lflag     = 0;
>       options.c_cc[VTIME] = 0;
>       options.c_cc[VMIN]  = 0;
> 
>      cfsetispeed(&options, B19200);
>      cfsetospeed(&options, B19200);
> 
>         tcflush(fd, TCIFLUSH);
>       tcsetattr(fd, TCSANOW, &options);
> 
>      //Loop indefinitely and echo
>      while(1)
>      {
>          char c;
>          if(read(fd, &c, 1) > 0)
>              printf("received %c\n", c);
>      }
> }
>




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU