On 1/19/10, Rob Hamerling <[email protected]> wrote: > > Hi Joep, > > 2010/1/19 Rob Hamerling <[email protected]>: >>> With 20 MHz serial comms is no problem at 115200 bps, but with >>> 16MHz I get sometimes garbled data. When my calculations are correct (and >>> the 16MHZ resonator is really 16MHz) this is with a baud deviation of >>> 3.6 >>> percent, while the library has an error limit of 5%. >>> >> > > [Joep] > >> Interesting... Theoretical baudrate deviations close to -10% should be >> possible iirc, so 5%should be safe. However, if transmission speed is >> higher then receiving speed and transmission is continues, garbage can >> occure. So I'm interested what happens. Are there overruns? Is the >> baudrate divisor calculated correctly? >> > > I don't know if there are overruns, these are hidden by the library. But > that would result in missing characters in the echo: none! > The baudrate divisor is correct (SPBRG is loaded with 8). > > Has it to do with you specific host (probably not)? >> I think we need to know what happens, before we decide to reduce the >> tolerance allowed. Adding a warning may be wise though. >> > > The data garbling occurs when sending a burst of data, typically a few > hundred of the same character to a 16F877a which only task is to echo the > incoming data one-to-one at 115200 bps. The program uses the > serial-hw_int_cts library CTS handling active. On the PC side I use a > relatively simple terminal program, 8 databits, 1 stopbit, no parity, serial > port FiFo transmit buffer active (16 bytes), CTS output flow control > enabled. > > The garbling has a pattern! When I send a large number of 'x' chars the > first part comes back as 'x' (0x78), but is then followed by a burst of 0xE1 > chars. When you look at the bit pattern (put a number of 0x78 and 0xE1 after > each other) the bits are shifted two positions (as if the 16f877a missed 2 > databits). Later a series of another character is echoed (could also be 'x' > !). Two different 16f877A, same results. > It doesn't look to me like caused by a baudrate mismatch, but what else? > > I've just done a similar test with a 16f886 also at 16MHz oscillator and > also everything else the same: no problem.
oscillator or resonator?
A low Q factor for the resonator (which is quite common) may
cause variable amplitude in the OSCOUT pin. Take a look with a good scope
and see if you have enough amplitude above the trigger point. If not, the
cause may be but the gaps in the oscillation.
Are you reading the chars from the buffer or directly from the RCREG? I had
some similar problems untill I didn't use the buffer from
the serial-hw_int_cts library. The chars where shifted when moved in the
buffer.
Vasile (wesley)
-- You received this message because you are subscribed to the Google Groups "jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
