[En-Nut-Discussion] Serial Lockup

Tim DeBaillie debaillie at ciholas.com
Thu May 8 03:29:21 CEST 2008


Has anyone had any issues with a serial port file descriptor closing due 
to lots of data at the baud rate being received.

Here is the scenario
- serial port thread that does an fgetc(uart)
- uart is a file descriptor to USART1 on a SAM7X256
- the uart is setup for 115200 (we have tried 19200 as well)
- we send a command over serial like:
    line 100 {string}
where {string} is 512 bytes long

Now I know you might say that the buffer for the usart is only 256 bytes, 
but we did an ioctl and changed it to 1024 (getrxbufsize confirms this).

Additionally it only takes about 20 quick characters to actually cause 
this issue.

Some things we have considered are changing the fgetc into an fgets or 
fread.  However it shouldn't matter because the OS serial port interrupt 
should handle this even if we don't read quick enough right?

What ends up happening is that the system continues to operate but the 
file descriptor is closed because the fgetc gets an EOF.  So how do we 
avoid this?  We need to operate at 115200 and really operate at 115200 not 
something much slower.

Thanks for any ideas.

Tim




More information about the En-Nut-Discussion mailing list