This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Serial buffer overrun


I'm trying to debug a serial problem I'm having with receiving data from a remote system. It appears that I'm spending too much time processing data on the eb40a side and hence the serial buffer is filling up and I'm losing data (data comes through correctly for a while, then I start getting lots of errors. If I stop the remote host, the eb40a keeps going for a while before blocking).

I've set the serial buffer size to 2048 bytes. My baud rate is 19,200. I'm doing very little work on the eb40a side - receiving 12 bytes of data, computing a 16 bit crc and debug printfs. By debug serial channel is the default 38400 baud (just using hyperterm to display the output, not gdb).

I was appearing to have this problem without the printfs, but I was doing lots of data processing before along with some lcd screen updates (which were very poorly written). I killed all the extra code and added printfs to debug, and got back to the same point (with minimal printfs I can send megabytes of error free data across the channel). Obviously I'm sending more data out the debug channel than it can handle and hence writes are blocking there (it's a single thread) which in turn causes my input buffer to fill up.

So, my real question: how do I tell when a buffer overflow has occured? I would like to detect this, flush the input buffer and start over. I believe I remember seeing a flush command, but what about the overflow?

Thanks!

Shannon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]