Blackfin uart problem

MOLM mads.lemaire at gmail.com
Mon Dec 1 10:00:12 UTC 2008


I have an application running on a BF537 stamp card, using posix code that
is working using uClinux on the same card. What I experience now is loss of
characters, even at 300baud, so I do not think the problem is primary
interrupthandler related. I have ended up with a test scenario connecting
the Tx line to the Rx line of the uart, writing a string of characters, and
then reading one by one characters back. When the string written contains
more than 3 characters I am only able to read back the last three
characters. I have scanned through the termios implementation, buf it seems
to me that the default buffersize is not modified by the BSP implemetation.
Below is the code I used for the test and the output. Anyone experienced
something like this?


{
  int fd=0;
  char buftx[] = "ABCD";
  fd = open("/dev/tty1",O_RDWR | O_NOCTTY );
  if (fd != -1)
  {
      int len,n;
      struct termios tio;
      tcgetattr(fd,&tio);
      tio.c_cflag = CLOCAL | CS8 | CREAD;
      tio.c_oflag = 0;
      tio.c_lflag = 0;
      tio.c_iflag = IGNPAR | IGNBRK;
      cfsetispeed(&tio,B300);
      cfsetospeed(&tio,B300);
      tio.c_cc[VMIN]=0;
      tio.c_cc[VTIME]=10;
      tcflush(fd, TCIFLUSH);
      tcsetattr(fd,TCSANOW,&tio);
      len = write(fd,&buftx[0],sizeof(buftx)-1);
      for (n=0; n < len; n++)
      {
        char chData;
        if (read(fd,&chData,1) > 0)
          printf("%02d %c %c\n",n,chData, buftx[n]);
        else
         printf("Timeout!\n");
      }
    }

writing 'AB'        reading A,B
writing 'ABC'     reading  A,B,C
writing 'ABCD'   reading B,C,D  + Timeout
writing 'ABCDE' reading C,D,E + 2xTimeout
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20081201/40db695e/attachment.html>


More information about the users mailing list