external resonator on 28x2 chip


New Member
Hi all,

I purchased a 64Mhz resonator, and installed it on my 28x2 picaxe.
I used setfreq em64 command in the editor.
It accepted a download and it works.

But then I remembered that the chips have a 4x PLL phase lock loop and I SHOULD have installed a 16Mhz resonator instead.

From the manual:
"Note that the X2 parts have an internal x4 PLL inside the chip. This multiplies the external resonator speed by 4. Therefore the external resonator value to be used is 1/4 of the desired final speed (ie in mode em40 use an external 10MHz resonator, for em16 use a 4MHz resonator). "

So my question is why does it work with the 64Mhz resonator? Is it overclocked? The simple program works, and the debug command has no problems communicating with the PC.... I have not tried serial communications yet. I'm guessing that won't work?


Technical Support
Staff member
The PICAXE would not run at 256MHz and, given the DEBUG command works, it has likely automatically dropped back to using its internal 8MHz oscillator. The EM64 is effectively ignored.


New Member
I am sending Sertxd ("hello") after the setfreq em64 command and both the editor and a third party serial program are picking up the ASCII string at the higher baud rate. I'll confirm what that baud rate is tomorrow. From memory it's 76800 baud.


Technical Support
Staff member
Probably the best way to tell what speed the PICAXE is actually running at is to use a PAUSE command in a loop to send a single character or pulse a LED and see what PAUSE value is needed to make that a once per second event -

PAUSE 1000 = 8MHz
PAUSE 2000 = 16MHz
PAUSE 4000 = 32MHz
PAUSE 8000 = 64MHz
PAUSE 16000 = 128MHz
PAUSE 32000 = 256MHz
let us know what happens - I'd be VERY interested to try a PICAXE at 256MHz!! :LOL::LOL::LOL: Mind you, it would take me a while to come up with a proper use-case that would make use of such a high clock speed!


Senior Member

The PICaxe's internal oscillator is accurate (factory calibrated) to better than +/-1% so to determine if the crystal is actually being used needs the frequency to be measured to much better than +/- 0.1% resolution.. If you don't have any suitable measurement tool (which itself would need to be crystal-controlled) then measure a period of at least one minute (e.g. PAUSE 48000 inside a FOR 0 TO 9 .. NEXT loop) with a stopwatch.

It's unlikely that an oscillator designed for operation up to 16 MHz will even run at 64 MHz, so it's probable that the PICaxe clock input pin sees "nothing" and, as hippy said, it defaults to the internal oscillator. IIRC, Westaust55 managed to overclock X2s up to about 80MHz (20 MHz crystal).

"In the old days" 64 MHz was a very high frequency for a crystal and such crystals would be typically tuned to 12.8 MHz (but marked 64) and used in "fifth overtone" mode. Square waves are rich in Odd harmonics and the oscillator would include a simple L-C resonant circuit for 64 MHz. These days, frequency synthesiser systems often use a power-of-two divider chain, with base crystal frequencies still in the (optimum) low tens of MHz.

Cheers, Alan.


New Member
Sorry guys, I must be going crazy. I thought I bought a 64Mhz resonator, but I was about to post the link to the datasheet of the part i bought, and I realised that I bought the 16Mhz resonator, so all this time, when I was shopping for the resonator, I must have subliminally known that I needed 1/4 the speed..... It's strange how the mind works.