View Full Version : Uart baud rate errors
korda
10-21-2008, 10:43 AM
As you aware, there is an error (%) when setting up BRR register in the UART hardware of any micro controller.
Can you supply a list of BRR errors for each baud rate selection in RFET?
The reason I am asking this, we have following problems when passing data (in data mode) to our "smart device":
115200 - almost works, occasionally (1 out of 10 msgs) missing 1-2 bytes.
57600 - does not work at all.
38400 - did not test yet
19200 - works well so far.
This problem does not require any changes on your side, just a list of errors.
This is obviously the problem created by both sides of communication imperfect BRR setup.
kbanks
10-21-2008, 12:48 PM
As your baudrate goes up, your need for hardware flow control increases.
Missing bytes probably point to overrun errors, not baudrate inaccuracies.
That said, the piece of data you are missing is the formula used to calculate the baudrate divisors within SNAP.
Our software assumes a BUSCLK of 19995429 HZ (19.995429 MHZ).
For the UARTs that are built-in to our microcontroller, there is a 16-bit divisor registor.
As you probably know, for ASYNC UARTS, you typically have an internal serial clock (a sampling clock if you will) that is 16X the actual BPS desired.
So, for a given Bits Per Second (BPS),
hardwareDivisor = BUSCLK / (BPS * 16)
Any fractional result must be truncated for use in the 16 bit internal register.
So, the actual baudrate should be reverse calculated from
resultantBPS = (BUSCLK / hardwareDivisor) / 16
From this info you can perform whatever error calculations you want.
Do keep in mind that we compute the divisors on the fly, so we don't care if you request a non-standard rate of 1199 instead of 1200. This also gives you some room for adjustment. If the data rates from the SNAP node are not matching well with some piece of external hardware, you can try tweaking the requested baud rate (initUart()) up or down to see if you can get a closer match.
We do make an exception to the above calculation for 115200 bps. For it we have to substitute a value of 113610 BPS to get a good value.
korda
10-21-2008, 02:29 PM
In case of overrun errors, can this condition be detected by Snapy script or Portal software?
kbanks
10-21-2008, 04:56 PM
I suppose you could peek() the appropriate register yourself (in the SNAP node).
I can't think of anything you could do from the Portal side.
vBulletin® v3.8.0, Copyright ©2000-2012, Jelsoft Enterprises Ltd.