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.
So it seems it's an issue with the 16f887A.
I would like to do the same tests with a 20 MHz resonator, but I have
currently no 40-pins test board with 20 MHz oscillator and serial
interface, and don't want to (re)solder resonators.
BTW. Newer PICs have EUSARTs, which alow a more accurate baudrate
setting. Would be nice if the serial libraries could use these! Seems to
me not too complicated to implement. But is no solution of the 16f877a
of course.
Regards, Rob.
--
Rob Hamerling, Vianen, NL (http://www.robh.nl/)
--
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.