To: | |
---|---|
Subject: | [ts-7000] Failure to read serial comm on TS-7300 |
From: | "shusshinchi" <> |
Date: | Mon, 11 Oct 2010 04:34:11 -0000 |
As mentioned in the subject. I am not doing anything complicated at all. I merely connected a peripheral device to com2 (/dev/ttyAM1). My program then sends out a series of bytes out on com2 to the peripheral device and the device responds. However, my program gets nothing. "cat /dev/ttyAM1" shows nothing either. Below is a sample code that I have used to produce this problem. Is there anything that I need to set anywhere to enable the OS to receive data on the serial comm link? int main ( int argc, char** argv ) { for ( short c = 0 ; c < argc ; ++c ) cout << "[" << c << "] " << argv[c] << endl ; int fd = open ( argv[1], O_RDWR | O_NOCTTY | O_NDELAY ) ; termios port_settings ; cout << "fd = " << fd << endl ; memset ( &port_settings, 0, sizeof port_settings ) ; cfsetispeed ( &port_settings, B9600 ) ; cfsetospeed ( &port_settings, B9600 ) ; port_settings.c_cc[VMIN] = 0 ; port_settings.c_cc[VTIME] = 10 ; port_settings.c_iflag &= ~ICRNL ; port_settings.c_lflag &= ~ICANON ; port_settings.c_cflag &= ~PARENB ; port_settings.c_cflag &= ~CSTOPB ; port_settings.c_cflag &= ~CSIZE ; port_settings.c_cflag &= ~CRTSCTS ; port_settings.c_cflag |= CS8 ; port_settings.c_cflag |= CREAD ; port_settings.c_cflag |= CLOCAL ; tcsetattr ( fd, TCSANOW, &port_settings ) ; tcflush( f d, TCIOFLUSH ) ; char output[ ] = { 0x06, 0x01, 0x00, 0x00, 0x00, 0x10, 0x3c, 0x71 } ; short charCount = 0 ; char c ; char cA[8] ; int r ; memset ( cA, 0, 8 ) ; cA[7] = '\0' ; tcflush ( fd, TCIOFLUSH ) ; write ( fd, output, 8 ) ; usleep ( 500000 ) ; cout << "Bytes read = " << ( r = read ( fd, cA, 7 ) ) << endl ; // this line fails to read anything tcflush ( fd, TCIOFLUSH ) ; if ( r == -1 ) { switch ( errno ) { case EAGAIN : cout << "eagain" << endl ; sleep ( 1 ) ; break ; case EBADF : cout << "ebadf" << endl ; break ; case EFAULT : cout << "efault" << endl ; break ; case EINTR : cout << "eintr" << endl ; break ; case EINVAL : cout << "einval" << endl ; break ; case EIO : cout << "eio" << endl ; break ; case EISDIR : cout << "eisdir" << endl ; break ; default : cout << "errno = " << errno ; } } } __._,_.___
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required) Change settings via email: =Email Delivery: Digest | m("yahoogroups.com?subject","ts-7000-fullfeatured");=Change Delivery Format: Fully Featured">Switch to Fully Featured Visit Your Group | Yahoo! Groups Terms of Use | =Unsubscribe __,_._,___ |
<Prev in Thread] | Current Thread | [Next in Thread> |
---|---|---|
|
Previous by Date: | RE: [ts-7000] Re: ts 7300 LCD drıver problem for HD44780, alper kalkan |
---|---|
Next by Date: | [ts-7000] Stereo vision, vadim.bartko |
Previous by Thread: | Re: [ts-7000] getty and 'dialout' on the same serial port, Ken Irving |
Next by Thread: | Re: [ts-7000] Failure to read serial comm on TS-7300, Jim Jackson |
Indexes: | [Date] [Thread] [Top] [All Lists] |
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