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?<br>
<br><br>{<br> int fd=0;<br> char buftx[] = "ABCD";<br> fd = open("/dev/tty1",O_RDWR | O_NOCTTY );<br> if (fd != -1)<br> {<br> int len,n;<br>
struct termios tio;<br> tcgetattr(fd,&tio);<br> tio.c_cflag = CLOCAL | CS8 | CREAD;<br> tio.c_oflag = 0;<br> tio.c_lflag = 0;<br> tio.c_iflag = IGNPAR | IGNBRK;<br> cfsetispeed(&tio,B300);<br>
cfsetospeed(&tio,B300);<br> tio.c_cc[VMIN]=0;<br> tio.c_cc[VTIME]=10;<br> tcflush(fd, TCIFLUSH);<br> tcsetattr(fd,TCSANOW,&tio);<br> len = write(fd,&buftx[0],sizeof(buftx)-1);<br>
for (n=0; n < len; n++)<br> {<br> char chData;<br> if (read(fd,&chData,1) > 0)<br> printf("%02d %c %c\n",n,chData, buftx[n]);<br> else<br> printf("Timeout!\n");<br>
}<br> }<br><br>writing 'AB' reading A,B<br>writing 'ABC' reading A,B,C<br>writing 'ABCD' reading B,C,D + Timeout<br>writing 'ABCDE' reading C,D,E + 2xTimeout<br><br>
<br>