Page 1 of 2

Serial overrun error

Posted: Wed Apr 08, 2015 5:36 pm
by dnishimura
Periodically when reading off the UART1 using ReadWithTimeout, I get a overrun error as reported from GetUartErrorReg. There's no way the buffer is being overrun by the small amount of data that is being received. Are there any other conditions that would cause this error? I used both NNDK 2.7.1 and NNDK 2.7.0 on SB70LC.

Re: Serial overrun error

Posted: Wed Apr 08, 2015 9:47 pm
by pbreed
You opened the serial port with openserial, not just leaving the polled normal startup in place?

What other code do you have running that might cause interrupts to turn off?

Re: Serial overrun error

Posted: Thu Apr 09, 2015 8:01 pm
by dnishimura
Yes I closed the serial port and reopened the port with openserial before reading from the port.

I am reading from the serial port in one task and sending data out on the IP network in another task. Would anything there cause interrupts to turn off?

Re: Serial overrun error

Posted: Fri Apr 10, 2015 5:54 am
by pbreed
Can you post your reading code?

Also what exact value are you getting for

GetUartErrorReg.

Re: Serial overrun error

Posted: Fri Apr 10, 2015 11:01 am
by dnishimura
I emailed you the code. The error code that's returned is 1.

Re: Serial overrun error

Posted: Fri Apr 10, 2015 2:01 pm
by pbreed
Don't see anything obviously wrong....

What baud rate are you running.... (IE is it a non-standard baud rate)
What do all of your log functions do time wise?

What sort of data are you receiving and at what rate?

Show me the details of opening the serial port ie what does
reset_serial(); do exactly.

What other tasks are running....

Re: Serial overrun error

Posted: Fri Apr 10, 2015 2:01 pm
by pbreed
Also is this in release or debug?

If its in debug and you are stopped in the debugger the serial interrup cant fire and you will get overflows...

Re: Serial overrun error

Posted: Fri Apr 10, 2015 4:00 pm
by dnishimura
Happens in both debug and release without any breakpoints.

Re: Serial overrun error

Posted: Sat Apr 11, 2015 5:33 pm
by rnixon
I think you missed the majority of his questions. He'll probably need those answers to help you.

Re: Serial overrun error

Posted: Mon Apr 13, 2015 12:52 pm
by dnishimura
Ah yes sorry...overlooked the first set of questions:

1) baudrate: 115200, stopbits: 1, databits: 8, no parity
2) We are receiving just ascii data in packets of 24 to 49 characters. On average we get about 1 packet per second.
3) log functions are just a wrapper around iprintf with some additional info added in.
4) reset_serial() code here:

Code: Select all

int reset_serial()
{
    int gateway;
    SerialClose(1);
    gateway = OpenSerial(1, 115200, 1, 8, eParityNone);
    writestring(gateway, "!Gateway\r\n");
    return gateway;
}

5) The other task that's running is a task that sends data the data read from the serial port to a webserver using the SSL library (SSL_connect). There are no shared data between the tasks besides data that's passed between the tasks using OS_FIFO.