40X2 Frequency with Resonator

techElder

Well-known member
I thought I knew everything, but PICAXE is always throwing a wrench at my head to confuse me. So, while waiting for my parts to arrive ...

There are mentions in the manuals about the 40X2 defaulting to 8MHz without an external resonator.

Then there are mentions about the PLL-based 4x frequency multiplier.

Which makes me think that to maintain the 8MHz operating frequency using an external resonator, I would have to install a 2MHz resonator. Is that the way it works?

So, if I put an 8MHz resonator on a 40X2, the operating frequency will be 32MHz. This means commands like PAUSE have to be adjusted because they are running quicker. Right?

I understand there are serial port setup parameters to use for 32MHz operation, too. I'll be using hSerin etc. in my project.

I also thought I read where the 40X2 can't be slowed down for certain commands that need a slower operating frequency, but now I can't locate that reference.

I'll be using more than one SLOT.

Besides the obvious increase in battery drain (not an issue for me), is there really any downside to running at 32MHz?
 

Circuit

Senior Member
Yes, you seem to be getting the right ideas...but may I ask why you are thinking of using an external resonator? If you have a look at the Microchip bumf on the 40X2 chip you will see that they are comfortable with using the internal clock for most purposes. I have played around with an external crystal - if you want the best timing then use a crystal rather than a resonator - but really the internal clock seems to suffice for 99% of applications. I seem to remember Hippy indicating that I was really going overboard with the external circuit. So what reason do you have for externalising the timing, if I may enquire?
 

Buzby

Senior Member
I find the only reason I use an external resonator with the 40X2 is because I need more speed.

The internal gives speeds upto 16MHz, and external gives upto 64MHz ( with a 16MHz resonator ).
 

techElder

Well-known member
Only planning at this stage, but I'm developing a timing device that will be counting (with external counter) a 1MHz clock developed from a crystal can oscillator (which will be way lower ppm change than I need.) Marketing requirements are driving the spec to new heights!

I'm working towards using PWM output (of course, suggested by Hippy) at 1MHz out of the 40X2 to replace the oscillator.

I thought a resonator was just an assembled crystal with 2 load capacitors? Have to look that up. Anyway, the specs on most resonators that I looked at show minimal ppm change, but I will take your suggestion on the crystal seriously.
 

geoff07

Senior Member
Resonators are ceramics, whereas crystals are quartz (there are probably exceptions). Crystals are more stable over time and with temperature. The caps are packaged with resonators for uc use, not generally with crystals. You can readily use a resonator with a microcontroller, as a little drift hardly matters. You wouldn't use one to set a radio frequency as you would want to avoid drift.
 

techElder

Well-known member
Murata Ceramic Resonator

geoff07, thanks for the reminder about ceramics and quartz. I went back to my datasheet example on resonators from Murata. These specs seem to indicate an approximately +/- 1uSec change from 1MHz. That sounds good for my application where +/-100uSec will not be visible.

What do y'all think?

Murata Resonator General Specs:
ResonatorCeramicGeneralSpecs.png

DATASHEET: View attachment Resonator_Murata_p17e-472029.pdf
 

techElder

Well-known member
Upon further research ... :)

At least from a marketing/competition point of view, it is hard to justify using a resonator (internal or external) in my application if I intend to replace an external crystal oscillator with the 40X2 PWM output. In comparing just a standard 8MHz crystal with 18pF load capacitors to an 8MHz resonator there is a factor of 100 difference in the frequency tolerance and near that in the temperature stability (-20C to 70C).

Actually, even at worst case 70ppm (20ppm + 50ppm = 0.007%) change that represents 70uSec accumulated difference in a 1 second duration. That's pretty close to my target number of 100uSec, but will be OK if I work the rounding correctly. (I know that in reality the tolerances will be very much closer to the datasheet stated specifications.)

ABRACON Crystal Datasheet: View attachment Crystal_ABL-10083_2pages.pdf
 

hippy

Technical Support
Staff member
For most people using internal clock, resonator or crystal doesn't make any difference. The main reason to use a resonator or crystal would be to get a higher operating speed than supported by the internal clock, and the main reason to choose a resonator is that it is usually cheaper and easier to use than a crystal.

If frequency accuracy is an issue it is probably easier to just choose to use a crystal and pick one with the lowest ppm error. A costing of using that crystal against a resonator or other crystal will determine how much effort can be afforded on deciding if a resonator or something else is worth using.
 
Top