[SOLVED] PIC18F47J53 Crystal does not oscillate

Status
Not open for further replies.

Rokas

Newbie level 4
Joined
May 28, 2011
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Coventry, UK
Activity points
1,341
Hello,
Refering to PIC18F47J53 datasheet it can be clocked up to 48MHz, but I can't make it to work with such frequency crystal. I'll explain everything from the begining:

I set oscillator to be in HS mode and CPU clock division to be 1:1. So, the CPU clock should be 48MHz (with 48MHz crystal) and the instruction clock -12MHz. But somehow it overrides my fuse settings and switches to the default internal clock (4MHz).

I've tried to make it work with 48MHz crystal and different capacitors (ranging from 2.2pF to 22pF) - in every way it switches to the internal clock. And on both crystal legs I can't see any oscillation, only DC.

With 40Mhz crystal: crystal oscillates, MCU takes external crystal as a clock, but crystal's frequency isn't 40MHz it somehow becomes ~13.3MHz.

With 20MHz crystal: everything works. CPU clock - 20MHz, instruction - 5MHz (I'm able to get PWM of 5MHz).

P.S. All the crystals are tested with external circuit.

Does anybody have any ideas?
 

Are you sure you can use a crystal higher than 16MHz on that PIC?

Keith

---------- Post added at 22:27 ---------- Previous post was at 22:25 ----------

See page 535 of the data sheet. You can use a 48MHz external clock but only a 16MHz crystal.

Keith
 
Reactions: Rokas

    Rokas

    Points: 2
    Helpful Answer Positive Rating
I don't think that the internal oscillator circuit can run with such a high frequency crystal. It can take an external oscillator at those frequencies because that won't use the internal oscillator, but probably not a crystal.

Edit:
Beaten to it again, lol.
 
Reactions: Rokas

    Rokas

    Points: 2
    Helpful Answer Positive Rating
Thanks to all. Now I understood that this is only achievable with PLL.
Q1: But why it does work with 20MHz crystal?
Q2: So the best way to achieve max CPU frequency is to use 16MHz and multiply it by 3?
Q3: What do you about PLL? Is it ok for high precision?
 

It probably works with a 20MHz crystal because there has to some margin for temperature and supply variations. A design intended to 16MHz operation shouldn't stop working at 16.1MHz.

Using the PLL will be as accurate as the clock source it is locked to.

Keith
 
Reactions: Rokas

    Rokas

    Points: 2
    Helpful Answer Positive Rating

So what's the point of using external crystal if can achieve the same good effect with multiplying internal clock?
 

You can't multiply by three, although you can divide by three. You don't want to though for a 16MHz source.

The clock circuitry in these PIC's works by dividing down the input frequency to 4MHz, then using the PLL to multiply it to 96MHz. This is the divided down by 2 for the USB clock, and by a selectable ratio for the system clock with a maximum of 48MHz allowed. Plus many other options. Refer to page 36 of the datasheet.

So, you can use your 16MHz crystal, with a PLL prescaler of 4 to give the required 4MHz to the PLL, and CPDIV of 2 with the system clock source set as the PLL output. That will give a 48MHz system clock too.
 
Reactions: Rokas

    Rokas

    Points: 2
    Helpful Answer Positive Rating
The internal clock is not as accurate as an external clock can be.

Keith
 
Reactions: Rokas

    Rokas

    Points: 2
    Helpful Answer Positive Rating
So what's the point of using external crystal if can achieve the same good effect with multiplying internal clock?

The internal oscillator is probably not as accurate as an external crystal; they are usually RC-based. It does have a tuning ability for this very reason. Using an external clock source gives you control over the accuracy and more flexibility.
 
Reactions: Rokas

    Rokas

    Points: 2
    Helpful Answer Positive Rating
keith1200rs, FoxyRick, thank you both so much for helping me out

P.S. glad to join this forum.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…