Dear All,
I am trying to collect data from Gumstix connex's UART. Wireless transceiver is at the STUART.
UART setting is configured as in the following program. When I run the program on CONNEX, it shows only "I/O possible" at the minicom screen.
I am sure that transceiver is forwarding data to UART. But data are not shown on minicom. When I do $: cat /dev/ttyS2
some funny funny data are shown. Can  I get help? Is it because of configuration problem?
Best regards,
Andrew

#include <termios.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <sys/time.h>
#include <stdlib.h>
#include <sys/ioctl.h>
/* Serial port information for talking to the mote */
#define TOS_PACKET_LENGTH 21        
/* Four data transmitted Default TOS packet length */
#define SERIAL_PORT "/dev/ttyS2"/*STUART-230kbps*/      
#define BAUDRATE1 B115200         
 
void open_serial (void);    /* Open a serial channel to mote */

/*Global variable*/
int inout_stream,result;
char input_buffer[TOS_PACKET_LENGTH];
char *serial_port = SERIAL_PORT;
char c, str[80];
 
int main(int argc, char ** argv) {
      static int counter=0;
      int count=0;
      open_serial();
      bzero(input_buffer, TOS_PACKET_LENGTH);
      //while(1){
             count=0;
             while(count < TOS_PACKET_LENGTH){
               
                //count = read(inout_stream, input_buffer + count, TOS_PACKET_LENGTH - count);
                count = read(inout_stream, input_buffer , TOS_PACKET_LENGTH);
              
                fprintf(stderr,"%d ",count);}
}
 
/* Open serial channel to mote */ 
void open_serial() {
  struct termios tio;
  inout_stream = open(serial_port, O_RDWR|O_NOCTTY| O_NONBLOCK);
  if (inout_stream < 0) {
    fprintf(stderr,"Cannot open serial device %s\n", serial_port);
    exit(-1);
  }
  fprintf(stderr,"Serial port configure \n");
  /* Serial port setting */
  //clear data in struct
  bzero(&tio, sizeof(tio));
  //get the current port setting
  fcntl( inout_stream, F_SETFL, 0 );
  tcgetattr( inout_stream, &tio );
  //econtrol flag
  tio.c_cflag |= ( CLOCAL | CREAD );//set local mode
  tio.c_cflag &= ~CRTSCTS;   //disable HW flow control
  tio.c_cflag &= ~PARENB;    //no parity
  tio.c_cflag &= ~CSTOPB;    //1 stop bit
  tio.c_cflag &= ~CSIZE;     //clear the size bits
  tio.c_cflag |= CS8;     //8 data bits
  tio.c_cflag |= BAUDRATE1;
 
  //input flag
  tio.c_iflag &= ~( IXON | IXOFF | IXANY ); //disable SW flow control
  tio.c_iflag |= IGNPAR;     //ignore parity errors
  //
  tio.c_lflag &= ~( ICANON | ECHO | ECHOE | ISIG ); //non-canonical
  tio.c_lflag |= ( PENDIN | NOFLSH ); //
  
  /* Raw output_file */
  tio.c_oflag &= ~OPOST;    //
  tio.c_oflag &= ~(NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY); //no delays
 
  //we don't want to block indefinitely on reads
  //tio.c_cc[VMIN] = 1;
  //tio.c_cc[VTIME] = 2;
  
  // enter command mode
  tcflush( inout_stream, TCIFLUSH );
  // read the response and ensure it was OK
      
  /* Flush buffer; parameters take effect immediately */
  
  /* Enable non-blocking IO */
  fcntl(inout_stream, F_SETFL, O_NONBLOCK);
  fcntl(inout_stream, F_SETFL,FASYNC);
  tcsetattr(inout_stream, TCSANOW, &tio);
  fprintf(stderr,"Serial port opened \n");
}