Blackfin uart problem
Joel Sherrill
joel.sherrill at OARcorp.com
Mon Dec 1 14:20:52 UTC 2008
MOLM wrote:
> 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?
>
>
Random thoughts without reading the hardware manual.
Since you have tied the TX to the RX, is there any chance that the
RX has a 3 byte FIFO and the TX has a deeper one? If this is the
case, then you would keep putting characters into the TX and
simultaneously overflowing the RX.
Another possibility is that the serial port is polled by default.
> {
> 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
>
>
--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the users
mailing list