View previous topic :: View next topic |
Author |
Message |
avatarengineer
Joined: 13 May 2013 Posts: 51 Location: Arizona
|
18F67K22 UART NO-GO if OSC=64MHz |
Posted: Thu Jan 30, 2014 3:57 pm |
|
|
Using latest rev 5.017.
UART doesn't play on 18F67K22 when PLL used and OSC=64MHz.
Looking for typical 9600Baud with 64MHz Osc to work.
All works Ok with 16MHz Osc (no PLL).
Tried many variations of #USE232, etc...
Anyone with proven code example?
Thanks,
AE |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Thu Jan 30, 2014 4:01 pm |
|
|
Have a look at the link from this thread:
<http://www.ccsinfo.com/forum/viewtopic.php?t=51799>
May be the same problem.... |
|
![](templates/subSilver/images/spacer.gif) |
avatarengineer
Joined: 13 May 2013 Posts: 51 Location: Arizona
|
|
Posted: Thu Jan 30, 2014 4:45 pm |
|
|
didn't work |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 30, 2014 6:33 pm |
|
|
Explain what you mean by "didn't work". Do you mean you get garbled
output ? Partial or completely garbled on all characters ?
Post your test program. Post something like this for your main():
Code: |
void main()
{
int8 c;
while(1)
{
c = getc();
putc(c);
}
} |
Also post the #include line for your PIC, #fuses, #use delay(), and
#use rs232(). Post any other setup code. Keep the program short.
Also tell us if you are using the internal or external oscillator. If external,
are you using a crystal or a oscillator package ? Also tell us the Vdd
voltage of your PIC.
Finally, tell us how you are testing it. Are you typing characters at low
speed from a terminal program and looking for them to be echoed back ?
(As shown in the code above). Or something else ? |
|
![](templates/subSilver/images/spacer.gif) |
avatarengineer
Joined: 13 May 2013 Posts: 51 Location: Arizona
|
|
Posted: Thu Jan 30, 2014 9:31 pm |
|
|
Not a newbie here.
within Main loop is;
IF(kbhit()) {
Charin=fgetc(Comport1);
...do stuff...
}
works at 16MHz, not at 64MHz.
in other words, at 64MHz, there is no kbhit. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Fri Jan 31, 2014 2:47 am |
|
|
Answer the rest of PCM_programmers questions:
"Also post the #include line for your PIC, #fuses, #use delay(), and
#use rs232(). Post any other setup code. Keep the program short.
Also tell us if you are using the internal or external oscillator. If external,
are you using a crystal or a oscillator package ? Also tell us the Vdd
voltage of your PIC.
Finally, tell us how you are testing it. Are you typing characters at low
speed from a terminal program and looking for them to be echoed back ?
(As shown in the code above). Or something else ?". |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Fri Jan 31, 2014 4:49 am |
|
|
As a comment, check the supply voltage actually _at_ the PIC pin.
There are some threads on the MPLAB forums with various 'having problems at 64MHz" connections, and in two cases the people were powered off an ICD, and when they switched to 64MHz, the load went up enough to cause the supply at the PIC pin to droop, and the chips started to behave 'peculiarly'....
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
sezgin ozan
Joined: 05 Jan 2014 Posts: 8
|
|
Posted: Sun Feb 16, 2014 2:50 pm |
|
|
Hi, if you use pll then your rate is also multiplied by 4 and becomes 38400,
sezgin |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Sun Feb 16, 2014 3:10 pm |
|
|
sezgin ozan wrote: | Hi, if you use pll then your rate is also multiplied by 4 and becomes 38400,
sezgin |
No.
CCS does this for you. It sets the baud rate automatically based on the clock statement. |
|
![](templates/subSilver/images/spacer.gif) |
ilker07
Joined: 03 Jun 2022 Posts: 18
|
|
Posted: Tue Nov 01, 2022 6:11 am |
|
|
for example you set uart
#pragma use rs232(baud=14400, xmit=PIN_G1, rcv=PIN_G2, stream=TTL, errors)
Then baudrate on serial terminal 14400 * 8 =115200 |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Tue Nov 01, 2022 6:53 am |
|
|
NO.
Blatantly wrong.
With CCS, if you set the clock statement correctly, the baud rate is
what you set in the #USE RS232. Nothing else.
What you post is wrong.
It would only behave as you describe, if you incorrectly set the #USE
DELAY, with the crystal rate, not the clock rate, and then manually turn
on the PLL yourself, rather than letting the compiler do this for you.
Incorrect #FUSE/#USE settings. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Wed Nov 02, 2022 5:59 am |
|
|
Since it works at 16MHz and not 64MHz, build both versions and dump the listings to see IF the compiler is setting the PLL and UART bits properly.
If you use the PLL (x4) , I'd expect the UART BRG to be /4 to get the same speed (9600 in your case )
It may be a compiler bug ?
Have you tried previous compiler versions ? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Wed Nov 02, 2022 9:05 am |
|
|
If you look Jay the original problem was in 2014. The latest poster
just attached a completely 'wrong' statement to the end of the thread.
Dozens (hundreds?) of us here have since used this chip at 64Mhz OK.
Just using correct clock settings, fuses and baud rate settings. |
|
![](templates/subSilver/images/spacer.gif) |
|