[uCsimm] Bug on UART

From: Alain Paschoud (alain.paschoud@smartdata.ch)
Date: Wed Jul 18 2001 - 03:47:20 EDT


Hello,

I think the uCsimm has a big problem with his UART. I need to use it to
communicate with a bluetoot module. So I commented out the use of
"ttyS0:vt100:/sbin/agetty 9600 ttyS0" in inittab file, and I removed the
registering of the function that send printk on the serial port. With these
changes, nothing more ccomes on the serial port, and I communicate through
ethernet with the uCsimm.

I use a simple test program to send data through the serial port. I put
options : for serial port as inidicated at the end of this e-mail.

I use kermit on a PC on the other side to see incoming characters

Results at different speeds :

9600 : success : characters are well recieved
19200 : success : characters are well recieved
57600 : bug : I recieve neither the good characters, nor the good number of
characters.
115200 : bug : I recieve "Xbcdef" instead of "abcdef". So first characters are
not correct.

In my case, I asbolutely need a 57600 and a 115200 connection speed that
works...

Where is the bug ? in the UART driver ?

Thank you for any help.

Alain Paschoud

---- serial port options used -----

  options.c_cflag |= (CLOCAL | CREAD);

  /*
   * Set parity checking and character size. No parity.
   * 8N1 = 8 bits, no parity, 1 stop bit
   */
  options.c_cflag &= ~PARENB;
  options.c_cflag &= ~CSTOPB;
  options.c_cflag &= ~CSIZE; /* Mask the character size bits */
  options.c_cflag |= CS8; /* Select 8 data bits */

 /* Disable hardware flow control, because we don't have it
   */
  options.c_cflag &= ~CRTSCTS;

  /*
   * Raw Output is selected by resetting the OPOST option in the c_oflags
   * member. When the OPOST option is disabled, all other option bits in
   * c_oflags are ignored.
   */
  options.c_oflag &= ~OPOST;

  /*
   * Raw input is unprocessed. Input characters are passed through exactly as
   * they are received, when they are received. Generally you'll deselect the
   * ICANON, ECHO, and ISIG options when using raw input.
   * Never enable input echo (ECHO) when sending commands to a MODEM or other
   * computer that is echoing characters you send to it as you will generate a
   * feedback loop between the two serial interfaces!
   */
  options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);

/*
   * IGNPAR : ignore bytes with parity errors
   * ICRNL : map CR to NL (otherwise a CR input on the other computer
   * will not terminate input)
   * otherwise make device raw (no other input processing)
   */
  /*
   * IGNPAR is a somewhat dangerous option that tells the serial driver to
   * ignore parity errors and pass the incoming data through as if no errors
   * had occurred. This can be useful for testing the quality of a
   * communications link, but in general is not used for practical reasons.
   */
  options.c_iflag |= (IGNPAR /*| ICRNL*/);

  /* Disable software flow control */
  options.c_iflag &= ~(IXON | IXOFF | IXANY);

  /* Set the new options for the port */
  tcsetattr(fd, TCSANOW, &options);

This message resent by the ucsimm@uclinux.com list server http://www.uClinux.com/



This archive was generated by hypermail 2b30 : Sun Apr 07 2002 - 00:01:43 EST