Main Site Documentation

NETMF Serial Port Buffer Overflow


#1

Hi,

I’m getting “Buffer OVFLW” on my screen and i believe it’s due to serial board data read.

I’m using FEZ Raptor with GHI RS232 gadgeteer. I believe similar report on the buffer overflow of RS232 is also reported on codeplex - https://netmf.codeplex.com/workitem/2226

Any idea how to solve this?


#2

Try to read the data faster our more efficiently.


#3

I am a strong believer in handling serial data like an interrupt. Don’t try to process it at all, get it out and stuff it into a queue you can manage outside the incoming data handler. Certainly keep away from strings and stay in byte arrays as long as possible as well !


#4

I have also found that upping the baud rate(for the same quantity of data) helps to reduce CPU load.


#5

Thanks. I managed to solved it by using thread. Here’s my sample code

        void Port_LineReceived(GTI.Serial sender, string line)
        {
            SerialDataInput = line;
            var processThread = new Thread(Process);
            processThread.Start();
        }

        private void Process()
        {
            ...
        }

#6

After reading (too fast) your post I was wondering wow how can it be possible, in fact the important word are: “for the same quantity of data”.

This makes sense now!