CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

18F67K22 UART NO-GO if OSC=64MHz

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
avatarengineer



Joined: 13 May 2013
Posts: 51
Location: Arizona

View user's profile Send private message Visit poster's website

18F67K22 UART NO-GO if OSC=64MHz
PostPosted: Thu Jan 30, 2014 3:57 pm     Reply with quote

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
Ttelmah



Joined: 11 Mar 2010
Posts: 19219

View user's profile Send private message

PostPosted: Thu Jan 30, 2014 4:01 pm     Reply with quote

Have a look at the link from this thread:

<http://www.ccsinfo.com/forum/viewtopic.php?t=51799>

May be the same problem....
avatarengineer



Joined: 13 May 2013
Posts: 51
Location: Arizona

View user's profile Send private message Visit poster's website

PostPosted: Thu Jan 30, 2014 4:45 pm     Reply with quote

didn't work
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 30, 2014 6:33 pm     Reply with quote

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 ?
avatarengineer



Joined: 13 May 2013
Posts: 51
Location: Arizona

View user's profile Send private message Visit poster's website

PostPosted: Thu Jan 30, 2014 9:31 pm     Reply with quote

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.
Ttelmah



Joined: 11 Mar 2010
Posts: 19219

View user's profile Send private message

PostPosted: Fri Jan 31, 2014 2:47 am     Reply with quote

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 ?".
Ttelmah



Joined: 11 Mar 2010
Posts: 19219

View user's profile Send private message

PostPosted: Fri Jan 31, 2014 4:49 am     Reply with quote

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
sezgin ozan



Joined: 05 Jan 2014
Posts: 5

View user's profile Send private message Send e-mail

PostPosted: Sun Feb 16, 2014 2:50 pm     Reply with quote

Hi, if you use pll then your rate is also multiplied by 4 and becomes 38400,

sezgin
Ttelmah



Joined: 11 Mar 2010
Posts: 19219

View user's profile Send private message

PostPosted: Sun Feb 16, 2014 3:10 pm     Reply with quote

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.
ilker07



Joined: 03 Jun 2022
Posts: 18

View user's profile Send private message

PostPosted: Tue Nov 01, 2022 6:11 am     Reply with quote

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
Ttelmah



Joined: 11 Mar 2010
Posts: 19219

View user's profile Send private message

PostPosted: Tue Nov 01, 2022 6:53 am     Reply with quote

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.
temtronic



Joined: 01 Jul 2010
Posts: 9104
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Nov 02, 2022 5:59 am     Reply with quote

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 ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19219

View user's profile Send private message

PostPosted: Wed Nov 02, 2022 9:05 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group