[En-Nut-Discussion] NutOS serial driver

Ole Reinhardt ole.reinhardt at embedded-it.de
Tue Nov 3 11:36:11 CET 2009


Hi Jason,

> I am using the NutOS v4.8.0. The application that I am writing needs to
>  received 2070 bytes in one shot and also transmit 4096 bytes in one
>  shot via RS232, I enabled interruptions to detect the end of the
>  packet when I received data. If I increase the USART_RXBUFSIZ to 3072
>  bytes and the USART_TXBUFSIZ tp 5120. Do I have to have any
>  considerations? Will The nutOS v4.8.0 crush due to this changes?

Some time ago we just had a discussion concerning a bug in the serial
driver implementation triggered when changing the rx / tx buffer size.

If you like to do so you should always also set the hight and low
watermark of the rx an tx buffers. Otherwise you might get corrupted
data.

At least the size of your buffers is only limited by the available free
memory. As Ulrich just mentioned you should better take into account if
you realy need such large buffers.

If you want to check if the buffer is empty (tx as completed) you can
use the following code:

int      cycle = 0;
uint32_t parm;

do {
    _ioctl(_fileno(uart0), UART_GETSTATUS, &parm);
    NutSleep(10);
} while (!(parm & UART_TXBUFFEREMPTY) || (cycle > 1000));

Btw: Instead of sleeping you could do something usefull too...

Bye,

Ole


-- 
 _____________________________________________________________
|                                                             |
| Embedded-IT                                                 |
|                                                             |
| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
| Germany              Web:         http://www.embedded-it.de |
|_____________________________________________________________|




More information about the En-Nut-Discussion mailing list