Searching \ for '[PIC] PIC18LF Baud Generator weirdness with BRG16' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'PIC18LF Baud Generator weirdness with BRG16'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] PIC18LF Baud Generator weirdness with BRG16 '
2008\11\09@230318 by Forrest W Christian

flavicon
face
I'm hoping that I've missed something in the data sheet or errata...

I'm having some weird problems generating a correct baud rate of
19,200.  What is weird is that this *was* working, and has stopped for
some reason.  It is apparently code-related as I've swapped an entirely
new circuit board and processor in with the same results.
I have an application which uses a PIC18 serial port at 19,200  (I'm
currently using a '2620, but have tried with others as well).    I'm
clocking the PIC at 25Mhz (External clock source).

With BRG16=0, the closest I can get to 19,200 is 19290, or 0.47%
error.   As the other end of this link is a 'F887 running on the
internal RC oscillator, I'd really like to shave every little bit of
error off of the 18F side with the 20ppm XTAL....   So I figured I'd
turn on BRG16 and BRGH and set the value of SPBRG/SPBRGH to 325, which
should generate a baud rate of 19171, and reduce the error to 0.15%.

Imagine my surprise when I discovered the baud rate was actually closer
to 22.6kb/s.

I have dug through the data sheets and errata and haven't found anything
which indicates that this shouldn't work.   What am I missing?  Or does
this just not work with a 25Mhz clock on a PIC18LF....

-forrest

2008\11\09@233155 by Xiaofan Chen

face picon face
On Mon, Nov 10, 2008 at 12:04 PM, Forrest W Christian
<spam_OUTforrestcTakeThisOuTspamimach.com> wrote:
>
> I have dug through the data sheets and errata and haven't found anything
> which indicates that this shouldn't work.   What am I missing?  Or does
> this just not work with a 25Mhz clock on a PIC18LF...

Are you using 3.3V since you are using an LF version. If I remember
right, LF version of many PIC18Fs (like PIC18LF2550 and
PIC18LF2620) should not operate above 20MHz according
to the datasheet. It may run. It may not run since you
are running the chip out of spec.

Xiaofan

2008\11\09@233248 by Xiaofan Chen

face picon face
On Mon, Nov 10, 2008 at 12:31 PM, Xiaofan Chen <.....xiaofancKILLspamspam@spam@gmail.com> wrote:
> On Mon, Nov 10, 2008 at 12:04 PM, Forrest W Christian
> <forrestcspamKILLspamimach.com> wrote:
>>
>> I have dug through the data sheets and errata and haven't found anything
>> which indicates that this shouldn't work.   What am I missing?  Or does
>> this just not work with a 25Mhz clock on a PIC18LF...
>
> Are you using 3.3V since you are using an LF version. If I remember
> right, LF version of many PIC18Fs (like PIC18LF2550 and
> PIC18LF2620) should not operate above 20MHz according
> to the datasheet

I mean for 3.3V operation, the maximum CPU frequency
should not exceed about 20MHz.

> It may run. It may not run since you
> are running the chip out of spec.
>
> Xiaofan
>

2008\11\09@235958 by Forrest W Christian

flavicon
face
Xiaofan Chen wrote:
> Are you using 3.3V since you are using an LF version. If I remember
> right, LF version of many PIC18Fs (like PIC18LF2550 and PIC18LF2620)
> should not operate above 20MHz according to the datasheet. It may run.
> It may not run since you are running the chip out of spec.
I'm not running it out of spec, actually:

FMAX = (16.36 MHz/V) (VDDAPPMIN – 2.0V) + 4 MHz

Doing this backwards....

25-4= 21
21/16.36 = 1.28

1.28+2.0V = 3.28, which means that 3.3V is in spec... I actually cranked
the voltage up a bit as well, and still the same thing.

I should also mention that the baud rate generator is *rock solid*, just
wrong... I've tried several different parts as well - and usually a
too-high clock for the part issue will manifest itself differently on
different parts. ... 2685, 2620, etc, all seem the same.

-forrest

2008\11\10@003141 by Xiaofan Chen

face picon face
On Mon, Nov 10, 2008 at 1:01 PM, Forrest W Christian <.....forrestcKILLspamspam.....imach.com> wrote:
>
> FMAX = (16.36 MHz/V) (VDDAPPMIN – 2.0V) + 4 MHz
>
> Doing this backwards....
>
> 25-4= 21
> 21/16.36 = 1.28
>
> 1.28+2.0V = 3.28, which means that 3.3V is in spec... I actually cranked
> the voltage up a bit as well, and still the same thing.

So it is kind of marginal. Could you try 5V operation and see if that
it is working or not?

And I see a huge list of errata about EUSART in the errata document
for the A3 silicon. Maybe you want to check them again. Just in case.


Xiaofan

2008\11\10@091250 by Martin

face
flavicon
face
Xiaofan Chen wrote:
{Quote hidden}

Also.. make sure it's actually running at 25MHz though I assume you've
done that.
-
Martin

2008\11\10@111347 by Harold Hallikainen

face
flavicon
face

>>
>> And I see a huge list of errata about EUSART in the errata document
>> for the A3 silicon. Maybe you want to check them again. Just in case.
>>
>>
>> Xiaofan

I looked through those errata this morning and did not see anything
similar to this. The only thing I really found was the addition of bits to
invert the transmit and receive lines. That really got me on a previous
project. I just could not figure out why my transmit data was upside down.
Microchip couldn't either. I finally sent them a board with the upside
down data. They then pointed me to the errata.

On the 24H series, I've had problems with the uart when BRGH is high. This
is in the errata for the 24H chips. The receive side gets errors when BRGH
is set. I SEEM to remember something like that on early 18F or maybe 16F
chips. But, I don't see that for the chip being discussed here.

Harold



--
FCC Rules Updated Daily at http://www.hallikainen.com - Advertising
opportunities available!

More... (looser matching)
- Last day of these posts
- In 2008 , 2009 only
- Today
- New search...